[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210601033319.100737-1-gshan@redhat.com>
Date: Tue, 1 Jun 2021 11:33:19 +0800
From: Gavin Shan <gshan@...hat.com>
To: linux-mm@...ck.org
Cc: linux-kernel@...r.kernel.org, alexander.h.duyck@...ux.intel.com,
david@...hat.com, akpm@...ux-foundation.org, shan.gavin@...il.com
Subject: [RFC PATCH] mm/page_reporting: Adjust threshold according to MAX_ORDER
The PAGE_REPORTING_MIN_ORDER is equal to @pageblock_order, taken as
minimal order (threshold) to trigger page reporting. The page reporting
is never triggered with the following configurations and settings on
aarch64. In the particular scenario, the page reporting won't be triggered
until the largest (2 ^ (MAX_ORDER-1)) free area is achieved from the
page freeing. The condition is very hard, or even impossible to be met.
CONFIG_ARM64_PAGE_SHIFT: 16
CONFIG_HUGETLB_PAGE: Y
CONFIG_HUGETLB_PAGE_SIZE_VARIABLE: N
pageblock_order: 13
CONFIG_FORCE_MAX_ZONEORDER: 14
MAX_ORDER: 14
The issue can be reproduced in VM, running kernel with above configurations
and settings. The 'memhog' is used inside the VM to access 512MB anonymous
area. The QEMU's RSS doesn't drop accordingly after 'memhog' exits.
/home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \
-accel kvm -machine virt,gic-version=host \
-cpu host -smp 8,sockets=2,cores=4,threads=1 -m 4096M,maxmem=64G \
-object memory-backend-ram,id=mem0,size=2048M \
-object memory-backend-ram,id=mem1,size=2048M \
-numa node,nodeid=0,cpus=0-3,memdev=mem0 \
-numa node,nodeid=1,cpus=4-7,memdev=mem1 \
: \
-device virtio-balloon-pci,id=balloon0,free-page-reporting=yes
This tries to fix the issue by adjusting the threshold to the smaller value
of @pageblock_order and (MAX_ORDER/2). With this applied, the QEMU's RSS
drops after 'memhog' exits.
Signed-off-by: Gavin Shan <gshan@...hat.com>
---
mm/page_reporting.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/mm/page_reporting.h b/mm/page_reporting.h
index 2c385dd4ddbd..5dae3d171004 100644
--- a/mm/page_reporting.h
+++ b/mm/page_reporting.h
@@ -10,9 +10,10 @@
#include <linux/pgtable.h>
#include <linux/scatterlist.h>
-#define PAGE_REPORTING_MIN_ORDER pageblock_order
-
#ifdef CONFIG_PAGE_REPORTING
+#define PAGE_REPORTING_MIN_ORDER \
+ min_t(unsigned int, pageblock_order, (MAX_ORDER / 2))
+
DECLARE_STATIC_KEY_FALSE(page_reporting_enabled);
void __page_reporting_notify(void);
--
2.23.0
Powered by blists - more mailing lists