From: Tamas K Lengyel Date: Fri, 24 Jan 2020 09:28:56 +0000 (+0100) Subject: x86/mem_sharing: Skip xen heap pages in memshr nominate X-Git-Tag: 4.14.0-rc1~728 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=67de3c5df067c6fcdc7c452752c1a14863d9b1c8;p=xen.git x86/mem_sharing: Skip xen heap pages in memshr nominate Trying to share these would fail anyway, better to skip them early. Signed-off-by: Tamas K Lengyel Reviewed-by: Jan Beulich --- diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index c39e56f5b9..5ce075d307 100644 --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -840,6 +840,11 @@ static int nominate_page(struct domain *d, gfn_t gfn, if ( !p2m_is_sharable(p2mt) ) goto out; + /* Skip xen heap pages */ + page = mfn_to_page(mfn); + if ( !page || is_xen_heap_page(page) ) + goto out; + /* Check if there are mem_access/remapped altp2m entries for this page */ if ( altp2m_active(d) ) { @@ -870,7 +875,6 @@ static int nominate_page(struct domain *d, gfn_t gfn, } /* Try to convert the mfn to the sharable type */ - page = mfn_to_page(mfn); ret = page_make_sharable(d, page, expected_refcnt); if ( ret ) goto out;