[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 2/6] xen: do not merge reserved pages in free_heap_pages()
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Penny Zheng <Penny.Zheng@xxxxxxx>
- Date: Wed, 27 Apr 2022 17:27:39 +0800
- Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com])
- 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=2; 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=0qA9JxuQq7jj4LbeGwyi4Yeymfcd0bnxAGCmwirOLIs=; b=UnGIenCDFTFWpHO9cAVCJmo83LymqJR/v3K80WDoRgcyFxDxBCp0lsblpqoyW0AzMz983963X7BfShy250GpM6w9j52N7/UGLWkTDV3cy6LAbm5a/ok/BB8xXlJ2FrPAoOAJ2EQTVQnuAae9sLT4TtMRVxgFYj1B24YSvI8n4pXiUNXQJoqXXQZ1NPIv9qg6UN/ZCtVruyorbzLgFGltGdUDulYwrrnXdau8xYDJcKFcB52c7gZZ+zTvp/f3QvikryY8ewUvLiOXh/7yZyVT3bkEOvXIAWj1dihIoXm6yWHBw7XduA7eyOB+kkBdog2LxTzJbZQ/UDHQqOrKvd8YNQ==
- 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=0qA9JxuQq7jj4LbeGwyi4Yeymfcd0bnxAGCmwirOLIs=; b=AGCRo13vVysLgQ6zELxmR1cV2W+kcH1WTsGqo+iCVRX+ef9bU5Dtnuae/zTT8BIHFBGfcSUivV1IIkSGKUkpDXC7adCruk76l78OQG2gnBmPFUSd6OywHR+JcMWRDHoNtk8XpognIlFFhkXBEH4BnsWau8ptyBpVFqVv9Ludv7INS/xoXXRD7jHDJkaJtY1Fq6fKpHoycxD09lkcW6CuuohgUXyG3BsJpwORvXQnAqaREGuvBEenlXtHIoA8zKFq36p6fOv6WSDy0aIncI1DkgGldgTFapsVo8iorr9gN7bBaFaZvTeNjKjgWRwbvKBsUKENxd1uHd8RF4S+z0OLNw==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=ipdc3e1RnMQb/YeZhjG0nay+i9AURQsGfGhypTtQTZBqjqeA9i1hApU0hUe9Wr3wPIucwiG1kkHWS1MsjeBCr7HDQiKOtwpcLkiDM3smNsap0Y8Lz3FbQ5u9Pvkd8muWFg2HT8M6Ro3RL8Qn890P9j0+1DiVkZcbzh1DUyjLvw2MaCOT11mLNZCJxpNRKUKJsRpuJWsisboguWkhyIajD2eO35+y2VeI1lodA1oTfiTHGh0EgBp3jAdNxNnUIo//x0LJ+aVBYk2ZP3xWcojfzYDPM0r026re0cG+0hSJull+TSY5/IhUxGsNFJHxQ8klTPCb4rab4qDFuBVUUKiiQA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bMXZ6FPmUhRUIoKeaT3JrAo8nAdFFV9SBwmfJP3MEhKo5LqfY7j/C1Jr0fQFO+K0frNx5ScqEL9QkS50SCTUMbktq7oSQGSHFtC3SI/ENmZHwWbVNNsn8jjEI92fSwTbYRXbAkGozf0nz0v4ihMSIvRzI0IqREswNB0hd5//mLq/iiktZ2CSztWATJ80F9YyoK532EAaDFuQ1a4jk1l89gmUdkZeQWIQ4cG2bDIUdjn8Z562eLfkyzl7kRldcRqP+F05pggqYp3HIWUzMakQUUMlNCRpmaQndVgcWemNaCGcNCt19Gp7vFjRNegBdVHsWwZR/pAph5hCjjlL8If2pA==
- Cc: <wei.chen@xxxxxxx>, <henry.wang@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: Wed, 27 Apr 2022 09:28:50 +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>
---
v3 changes:
- no changes
---
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 be501582a3..1f3ad4bd28 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1483,6 +1483,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;
@@ -1506,6 +1507,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
|