[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 2/6] xen/arm: do not merge reserved pages in free_heap_pages()


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Mon, 18 Apr 2022 20:22:47 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VsBClypD3Wkaou4TbtLWlS8ixNFn1OaoB4eWjjlhZLY=; b=Z+4r/H9JyyeKjnw2euYP1/ozHcE8Dn0p/X6hHcUceeq64JrOD7VzCQkAcuOLxy4i/w9aFgSXLKgMQ3xHv1NTF76U2NJnbzP27TnmIIbmxUv9buyD3g6R2k3HdijN2ik2oW6zRD7/KK+xrsOXcO0c0ebtS9FOM9Ny+OCvfRlLHVNVa/TtuA49xQ01aGKl3R78p8aHFIWSCo9h+fWFB9+ys3tRBy1qUkx/KMwt54gNnipDTl9rc26C/1LIQa74FbaZK6FH435rDTdgK7cRCzO8nG/jvv6ph3TN8U1XbNUClBAWIW6QT1iZcHq+nsauDk7cFVDqJuNMl9Jm1ftpfvrj2w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TuWLliA54m3uLQnWMXGz6AaT4+4IEDItBQEgMCFMI+T7TvHa+HSCO3e3oso/c2LMtJgjplY/qjSRfWnQsaWEuLgzHVOO+sSwyFU+TBLw5YvfNkHrAAcrW1bDb0Bl1frXB4ukKe9YAs6NoFFbTWo65RxfV/76Aji+DBfeUwWr/cfMDQr/hSph2/pnC5gosJoBZuurLG96O8zR9fAq8AMFdx6u6Ch2fdcJii9TYW9RqmJsA827LHHG45wQiCFxNDdVe5AnvRq8x3zuFqUbvr5ndorsNXDrQUNL2Gyok4ir4nQ5xdZONgbkzocWw8w0S1vqmxQjxM6iPJ1Mz/XqoLwvaA==
  • Cc: <wei.chen@xxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Penny Zheng <penny.zheng@xxxxxxx>
  • Delivery-date: Mon, 18 Apr 2022 12:23:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true

There is a slim chance that free_heap_pages() may decide to merge a chunk
from the static region(PGC_reserved) with the about-to-be-free chunk.

So in order to avoid the above scenario, this commit updates free_heap_pages()
to check whether the predecessor and/or successor has PGC_reserved set,
when trying to merge the about-to-be-freed chunk with the predecessor
and/or successor.

Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx>
---
v2 changes:
- new commit
---
 xen/common/page_alloc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 9a3e9c1328..8ba38bca9a 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1479,6 +1479,7 @@ static void free_heap_pages(
             /* Merge with predecessor block? */
             if ( !mfn_valid(page_to_mfn(predecessor)) ||
                  !page_state_is(predecessor, free) ||
+                 (predecessor->count_info & PGC_reserved) ||
                  (PFN_ORDER(predecessor) != order) ||
                  (phys_to_nid(page_to_maddr(predecessor)) != node) )
                 break;
@@ -1502,6 +1503,7 @@ static void free_heap_pages(
             /* Merge with successor block? */
             if ( !mfn_valid(page_to_mfn(successor)) ||
                  !page_state_is(successor, free) ||
+                 (successor->count_info & PGC_reserved) ||
                  (PFN_ORDER(successor) != order) ||
                  (phys_to_nid(page_to_maddr(successor)) != node) )
                 break;
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.