linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/mempolicy: fix NUMA_INTERLEAVE_HIT counter
@ 2017-10-03 16:47 Andrey Ryabinin
  2017-10-03 18:04 ` Mel Gorman
  2017-10-03 19:10 ` [PATCH v2] " Andrey Ryabinin
  0 siblings, 2 replies; 4+ messages in thread
From: Andrey Ryabinin @ 2017-10-03 16:47 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Kemi Wang, Mel Gorman, linux-mm, linux-kernel, 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")
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/mempolicy.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 006ba625c0b8..3a18f0a091c4 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -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;
 }
 
-- 
2.13.6

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/mempolicy: fix NUMA_INTERLEAVE_HIT counter
  2017-10-03 16:47 [PATCH] mm/mempolicy: fix NUMA_INTERLEAVE_HIT counter Andrey Ryabinin
@ 2017-10-03 18:04 ` Mel Gorman
  2017-10-03 19:10 ` [PATCH v2] " Andrey Ryabinin
  1 sibling, 0 replies; 4+ messages in thread
From: Mel Gorman @ 2017-10-03 18:04 UTC (permalink / raw)
  To: Andrey Ryabinin; +Cc: Andrew Morton, Kemi Wang, linux-mm, linux-kernel

On Tue, Oct 03, 2017 at 07:47:20PM +0300, Andrey Ryabinin wrote:
> 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")
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> ---
>  mm/mempolicy.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index 006ba625c0b8..3a18f0a091c4 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -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;
>  }

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.

-- 
Mel Gorman
SUSE Labs

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] mm/mempolicy: fix NUMA_INTERLEAVE_HIT counter
  2017-10-03 16:47 [PATCH] mm/mempolicy: fix NUMA_INTERLEAVE_HIT counter Andrey Ryabinin
  2017-10-03 18:04 ` Mel Gorman
@ 2017-10-03 19:10 ` Andrey Ryabinin
  2017-10-03 19:22   ` Mel Gorman
  1 sibling, 1 reply; 4+ messages in thread
From: Andrey Ryabinin @ 2017-10-03 19:10 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Kemi Wang, Mel Gorman, linux-mm, linux-kernel, 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")
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/mempolicy.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 006ba625c0b8..a2af6d58a68f 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -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;
 }
 
-- 
2.13.6

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] mm/mempolicy: fix NUMA_INTERLEAVE_HIT counter
  2017-10-03 19:10 ` [PATCH v2] " Andrey Ryabinin
@ 2017-10-03 19:22   ` Mel Gorman
  0 siblings, 0 replies; 4+ messages in thread
From: Mel Gorman @ 2017-10-03 19:22 UTC (permalink / raw)
  To: Andrey Ryabinin; +Cc: Andrew Morton, Kemi Wang, linux-mm, linux-kernel

On Tue, Oct 03, 2017 at 10:10:03PM +0300, Andrey Ryabinin wrote:
> 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")
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>

Acked-by: Mel Gorman <mgorman@techsingularity.net>

-- 
Mel Gorman
SUSE Labs

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-03 19:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-03 16:47 [PATCH] mm/mempolicy: fix NUMA_INTERLEAVE_HIT counter Andrey Ryabinin
2017-10-03 18:04 ` Mel Gorman
2017-10-03 19:10 ` [PATCH v2] " Andrey Ryabinin
2017-10-03 19:22   ` Mel Gorman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).