Linux-mm Archive on
 help / color / Atom feed
* [patch 140/158] autonuma: reduce cache footprint when scanning page tables
@ 2019-12-01  1:57 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2019-12-01  1:57 UTC (permalink / raw)
  To: akpm, dan.j.williams, dave.hansen, fengguang.wu, linux-mm,
	mgorman, mhocko, mingo, mm-commits, peterz, riel, torvalds,

From: Huang Ying <>
Subject: autonuma: reduce cache footprint when scanning page tables

In auto NUMA balancing page table scanning, if the pte_protnone() is true,
the PTE needs not to be changed because it's in target state already.  So
other checking on corresponding struct page is unnecessary too.

So, if we check pte_protnone() firstly for each PTE, we can avoid
unnecessary struct page accessing, so that reduce the cache footprint of
NUMA balancing page table scanning.

In the performance test of pmbench memory accessing benchmark with 80:20
read/write ratio and normal access address distribution on a 2 socket
Intel server with Optance DC Persistent Memory, perf profiling shows that
the autonuma page table scanning time reduces from 1.23% to 0.97% (that
is, reduced 21%) with the patch.

Signed-off-by: "Huang, Ying" <>
Acked-by: Mel Gorman <>
Cc: Michal Hocko <>
Cc: Rik van Riel <>
Cc: Peter Zijlstra <>
Cc: Ingo Molnar <>
Cc: Dave Hansen <>
Cc: Dan Williams <>
Cc: Fengguang Wu <>
Signed-off-by: Andrew Morton <>

 mm/mprotect.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/mm/mprotect.c~autonuma-reduce-cache-footprint-when-scanning-page-tables
+++ a/mm/mprotect.c
@@ -80,6 +80,10 @@ static unsigned long change_pte_range(st
 			if (prot_numa) {
 				struct page *page;
+				/* Avoid TLB flush if possible */
+				if (pte_protnone(oldpte))
+					continue;
 				page = vm_normal_page(vma, addr, oldpte);
 				if (!page || PageKsm(page))
@@ -97,10 +101,6 @@ static unsigned long change_pte_range(st
 				if (page_is_file_cache(page) && PageDirty(page))
-				/* Avoid TLB flush if possible */
-				if (pte_protnone(oldpte))
-					continue;
 				 * Don't mess with PTEs if page is already on the node
 				 * a single-threaded process is running on.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-01  1:57 [patch 140/158] autonuma: reduce cache footprint when scanning page tables akpm

Linux-mm Archive on

Archives are clonable:
	git clone --mirror linux-mm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mm linux-mm/ \
	public-inbox-index linux-mm

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone