Skip to contentSkip to conversation

mm/mempolicy: fix NUMA_INTERLEAVE_HIT counter

PATCH Superseded Andrey Ryabinin 2 participants 4 messages Oct 3, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/mempolicy: fix NUMA_INTERLEAVE_HIT counter

Commit 3a321d2a3dde separated NUMA counters from zone counters, but the NUMA_INTERLEAVE_HIT call site wasn't updated to use the new interface. So alloc_page_interleave() actually increments NR_ZONE_INACTIVE_FILE instead of NUMA_INTERLEAVE_HIT.

Fix this by using __inc_numa_state() interface to increment NUMA_INTERLEAVE_HIT.

Fixes 3a321d2a3dde ("mm: change the call sites of numa statistics items")
---
 mm/mempolicy.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
mm/mempolicy.c +7 -2
index 006ba625c0b8..3a18f0a091c4 100644
@@ -1920,8 +1920,13 @@ static struct page *alloc_page_interleave(gfp_t gfp, unsigned order,
 	struct page *page;
 
 	page = __alloc_pages(gfp, order, nid);
-	if (page && page_to_nid(page) == nid)
-		inc_zone_page_state(page, NUMA_INTERLEAVE_HIT);
+	if (page && page_to_nid(page) == nid) {
+		unsigned long flags;
+
+		local_irq_save(flags);
+		__inc_numa_state(page_zone(page), NUMA_INTERLEAVE_HIT);
+		local_irq_restore(flags);
+	}
 	return page;
 }
 
Signature · 7 lines
2.13.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw
Quoted 23 lines · Andrey Ryabinin

Commit 3a321d2a3dde separated NUMA counters from zone counters, but the NUMA_INTERLEAVE_HIT call site wasn't updated to use the new interface. So alloc_page_interleave() actually increments NR_ZONE_INACTIVE_FILE instead of NUMA_INTERLEAVE_HIT.

Fix this by using __inc_numa_state() interface to increment NUMA_INTERLEAVE_HIT.

Fixes 3a321d2a3dde ("mm: change the call sites of numa statistics items")
---
 mm/mempolicy.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
mm/mempolicy.c +0 -1
index 006ba625c0b8..3a18f0a091c4 100644
@@ -1920,8 +1920,13 @@ static struct page *alloc_page_interleave(gfp_t gfp, unsigned order,
 	struct page *page;
 
 	page = __alloc_pages(gfp, order, nid);
-	if (page && page_to_nid(page) == nid)

mm/mempolicy.c static struct page *alloc_page_interleave(gfp_t gfp, unsigned order, · line 1931

Quoted 10 lines
mm/mempolicy.c +7 -1
-		inc_zone_page_state(page, NUMA_INTERLEAVE_HIT);
+	if (page && page_to_nid(page) == nid) {
+		unsigned long flags;
+
+		local_irq_save(flags);
+		__inc_numa_state(page_zone(page), NUMA_INTERLEAVE_HIT);
+		local_irq_restore(flags);
+	}
 	return page;
 }

alloc_page_interleave is only called from !irq contexts and the requirements for __inc_numa_state should only require interrupt disabling if that particular counter can be updated from interrupt context. Disabling preemption should be sufficient for NUMA_INTERLEAVE_HIT and would be cheaper.

Signature · 8 lines
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#2 lore raw

PATCH v2 1/1 mm/mempolicy: fix NUMA_INTERLEAVE_HIT counter

In reply to Andrey Ryabinin

Commit 3a321d2a3dde separated NUMA counters from zone counters, but the NUMA_INTERLEAVE_HIT call site wasn't updated to use the new interface. So alloc_page_interleave() actually increments NR_ZONE_INACTIVE_FILE instead of NUMA_INTERLEAVE_HIT.

Fix this by using __inc_numa_state() interface to increment NUMA_INTERLEAVE_HIT.

Fixes 3a321d2a3dde ("mm: change the call sites of numa statistics items")
---
 mm/mempolicy.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
mm/mempolicy.c +5 -2
index 006ba625c0b8..a2af6d58a68f 100644
@@ -1920,8 +1920,11 @@ static struct page *alloc_page_interleave(gfp_t gfp, unsigned order,
 	struct page *page;
 
 	page = __alloc_pages(gfp, order, nid);
-	if (page && page_to_nid(page) == nid)
-		inc_zone_page_state(page, NUMA_INTERLEAVE_HIT);
+	if (page && page_to_nid(page) == nid) {
+		preempt_disable();
+		__inc_numa_state(page_zone(page), NUMA_INTERLEAVE_HIT);
+		preempt_enable();
+	}
 	return page;
 }
 
Signature · 7 lines
2.13.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v2 1/1
#3 lore raw
Quoted 10 lines · Andrey Ryabinin

Commit 3a321d2a3dde separated NUMA counters from zone counters, but the NUMA_INTERLEAVE_HIT call site wasn't updated to use the new interface. So alloc_page_interleave() actually increments NR_ZONE_INACTIVE_FILE instead of NUMA_INTERLEAVE_HIT.

Fix this by using __inc_numa_state() interface to increment NUMA_INTERLEAVE_HIT.

Fixes 3a321d2a3dde ("mm: change the call sites of numa statistics items")
Signature · 8 lines
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>