Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1321061 > unrolled thread

[PATCH 5/3] mm, vmscan: make zone_reclaimable_pages more precise

Started byMichal Hocko <mhocko@kernel.org>
First post2016-01-28 22:20 +0100
Last post2016-01-29 22:40 +0100
Articles 6 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 5/3] mm, vmscan: make zone_reclaimable_pages more precise Michal Hocko <mhocko@kernel.org> - 2016-01-28 22:20 +0100
    Re: [PATCH 5/3] mm, vmscan: make zone_reclaimable_pages more  precise David Rientjes <rientjes@google.com> - 2016-01-29 00:30 +0100
    Re: [PATCH 5/3] mm, vmscan: make zone_reclaimable_pages more precise "Hillf Danton" <hillf.zj@alibaba-inc.com> - 2016-01-29 04:50 +0100
    Re: [PATCH 5/3] mm, vmscan: make zone_reclaimable_pages more precise Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-01-29 11:40 +0100
      Re: [PATCH 5/3] mm, vmscan: make zone_reclaimable_pages more precise Michal Hocko <mhocko@kernel.org> - 2016-01-29 16:20 +0100
        Re: [PATCH 5/3] mm, vmscan: make zone_reclaimable_pages more precise Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-01-29 22:40 +0100

#1321061 — [PATCH 5/3] mm, vmscan: make zone_reclaimable_pages more precise

FromMichal Hocko <mhocko@kernel.org>
Date2016-01-28 22:20 +0100
Subject[PATCH 5/3] mm, vmscan: make zone_reclaimable_pages more precise
Message-ID<qW28W-R2-3@gated-at.bofh.it>
From: Michal Hocko <mhocko@suse.com>

zone_reclaimable_pages is used in should_reclaim_retry which uses it to
calculate the target for the watermark check. This means that precise
numbers are important for the correct decision. zone_reclaimable_pages
uses zone_page_state which can contain stale data with per-cpu diffs
not synced yet (the last vmstat_update might have run 1s in the past).

Use zone_page_state_snapshot in zone_reclaimable_pages instead. None
of the current callers is in a hot path where getting the precise value
(which involves per-cpu iteration) would cause an unreasonable overhead.

Suggested-by: David Rientjes <rientjes@google.com>
Signed-off-by: Michal Hocko <mhocko@suse.com>
---
 mm/vmscan.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 489212252cd6..9145e3f89eab 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -196,21 +196,21 @@ unsigned long zone_reclaimable_pages(struct zone *zone)
 {
 	unsigned long nr;
 
-	nr = zone_page_state(zone, NR_ACTIVE_FILE) +
-	     zone_page_state(zone, NR_INACTIVE_FILE) +
-	     zone_page_state(zone, NR_ISOLATED_FILE);
+	nr = zone_page_state_snapshot(zone, NR_ACTIVE_FILE) +
+	     zone_page_state_snapshot(zone, NR_INACTIVE_FILE) +
+	     zone_page_state_snapshot(zone, NR_ISOLATED_FILE);
 
 	if (get_nr_swap_pages() > 0)
-		nr += zone_page_state(zone, NR_ACTIVE_ANON) +
-		      zone_page_state(zone, NR_INACTIVE_ANON) +
-		      zone_page_state(zone, NR_ISOLATED_ANON);
+		nr += zone_page_state_snapshot(zone, NR_ACTIVE_ANON) +
+		      zone_page_state_snapshot(zone, NR_INACTIVE_ANON) +
+		      zone_page_state_snapshot(zone, NR_ISOLATED_ANON);
 
 	return nr;
 }
 
 bool zone_reclaimable(struct zone *zone)
 {
-	return zone_page_state(zone, NR_PAGES_SCANNED) <
+	return zone_page_state_snapshot(zone, NR_PAGES_SCANNED) <
 		zone_reclaimable_pages(zone) * 6;
 }
 
-- 
2.7.0.rc3

[toc] | [next] | [standalone]


#1321146 — Re: [PATCH 5/3] mm, vmscan: make zone_reclaimable_pages more precise

FromDavid Rientjes <rientjes@google.com>
Date2016-01-29 00:30 +0100
SubjectRe: [PATCH 5/3] mm, vmscan: make zone_reclaimable_pages more precise
Message-ID<qW4aJ-2gf-1@gated-at.bofh.it>
In reply to#1321061
On Thu, 28 Jan 2016, Michal Hocko wrote:

> From: Michal Hocko <mhocko@suse.com>
> 
> zone_reclaimable_pages is used in should_reclaim_retry which uses it to
> calculate the target for the watermark check. This means that precise
> numbers are important for the correct decision. zone_reclaimable_pages
> uses zone_page_state which can contain stale data with per-cpu diffs
> not synced yet (the last vmstat_update might have run 1s in the past).
> 
> Use zone_page_state_snapshot in zone_reclaimable_pages instead. None
> of the current callers is in a hot path where getting the precise value
> (which involves per-cpu iteration) would cause an unreasonable overhead.
> 
> Suggested-by: David Rientjes <rientjes@google.com>
> Signed-off-by: Michal Hocko <mhocko@suse.com>

Acked-by: David Rientjes <rientjes@google.com>

[toc] | [prev] | [next] | [standalone]


#1321468

From"Hillf Danton" <hillf.zj@alibaba-inc.com>
Date2016-01-29 04:50 +0100
Message-ID<qW8el-5ca-3@gated-at.bofh.it>
In reply to#1321061
> 
> From: Michal Hocko <mhocko@suse.com>
> 
> zone_reclaimable_pages is used in should_reclaim_retry which uses it to
> calculate the target for the watermark check. This means that precise
> numbers are important for the correct decision. zone_reclaimable_pages
> uses zone_page_state which can contain stale data with per-cpu diffs
> not synced yet (the last vmstat_update might have run 1s in the past).
> 
> Use zone_page_state_snapshot in zone_reclaimable_pages instead. None
> of the current callers is in a hot path where getting the precise value
> (which involves per-cpu iteration) would cause an unreasonable overhead.
> 
> Suggested-by: David Rientjes <rientjes@google.com>
> Signed-off-by: Michal Hocko <mhocko@suse.com>
> ---

Acked-by: Hillf Danton <hillf.zj@alibaba-inc.com>

>  mm/vmscan.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 489212252cd6..9145e3f89eab 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -196,21 +196,21 @@ unsigned long zone_reclaimable_pages(struct zone *zone)
>  {
>  	unsigned long nr;
> 
> -	nr = zone_page_state(zone, NR_ACTIVE_FILE) +
> -	     zone_page_state(zone, NR_INACTIVE_FILE) +
> -	     zone_page_state(zone, NR_ISOLATED_FILE);
> +	nr = zone_page_state_snapshot(zone, NR_ACTIVE_FILE) +
> +	     zone_page_state_snapshot(zone, NR_INACTIVE_FILE) +
> +	     zone_page_state_snapshot(zone, NR_ISOLATED_FILE);
> 
>  	if (get_nr_swap_pages() > 0)
> -		nr += zone_page_state(zone, NR_ACTIVE_ANON) +
> -		      zone_page_state(zone, NR_INACTIVE_ANON) +
> -		      zone_page_state(zone, NR_ISOLATED_ANON);
> +		nr += zone_page_state_snapshot(zone, NR_ACTIVE_ANON) +
> +		      zone_page_state_snapshot(zone, NR_INACTIVE_ANON) +
> +		      zone_page_state_snapshot(zone, NR_ISOLATED_ANON);
> 
>  	return nr;
>  }
> 
>  bool zone_reclaimable(struct zone *zone)
>  {
> -	return zone_page_state(zone, NR_PAGES_SCANNED) <
> +	return zone_page_state_snapshot(zone, NR_PAGES_SCANNED) <
>  		zone_reclaimable_pages(zone) * 6;
>  }
> 
> --
> 2.7.0.rc3

[toc] | [prev] | [next] | [standalone]


#1321641

FromTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date2016-01-29 11:40 +0100
Message-ID<qWeD8-1qJ-29@gated-at.bofh.it>
In reply to#1321061
Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> zone_reclaimable_pages is used in should_reclaim_retry which uses it to
> calculate the target for the watermark check. This means that precise
> numbers are important for the correct decision. zone_reclaimable_pages
> uses zone_page_state which can contain stale data with per-cpu diffs
> not synced yet (the last vmstat_update might have run 1s in the past).
> 
> Use zone_page_state_snapshot in zone_reclaimable_pages instead. None
> of the current callers is in a hot path where getting the precise value
> (which involves per-cpu iteration) would cause an unreasonable overhead.
> 
> Suggested-by: David Rientjes <rientjes@google.com>
> Signed-off-by: Michal Hocko <mhocko@suse.com>
> ---
>  mm/vmscan.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 

I didn't know http://lkml.kernel.org/r/20151021130323.GC8805@dhcp22.suse.cz
was forgotten. Anyway,

Acked-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

[toc] | [prev] | [next] | [standalone]


#1321823

FromMichal Hocko <mhocko@kernel.org>
Date2016-01-29 16:20 +0100
Message-ID<qWj05-517-19@gated-at.bofh.it>
In reply to#1321641
On Fri 29-01-16 19:35:18, Tetsuo Handa wrote:
> Michal Hocko wrote:
> > From: Michal Hocko <mhocko@suse.com>
> > 
> > zone_reclaimable_pages is used in should_reclaim_retry which uses it to
> > calculate the target for the watermark check. This means that precise
> > numbers are important for the correct decision. zone_reclaimable_pages
> > uses zone_page_state which can contain stale data with per-cpu diffs
> > not synced yet (the last vmstat_update might have run 1s in the past).
> > 
> > Use zone_page_state_snapshot in zone_reclaimable_pages instead. None
> > of the current callers is in a hot path where getting the precise value
> > (which involves per-cpu iteration) would cause an unreasonable overhead.
> > 
> > Suggested-by: David Rientjes <rientjes@google.com>
> > Signed-off-by: Michal Hocko <mhocko@suse.com>
> > ---
> >  mm/vmscan.c | 14 +++++++-------
> >  1 file changed, 7 insertions(+), 7 deletions(-)
> > 
> 
> I didn't know http://lkml.kernel.org/r/20151021130323.GC8805@dhcp22.suse.cz
> was forgotten. Anyway,

OK, that explains why this sounded so familiar. Sorry I comepletely
forgot about it.

> Acked-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

Can I change it to your Signed-off-by?

-- 
Michal Hocko
SUSE Labs

[toc] | [prev] | [next] | [standalone]


#1322111

FromTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date2016-01-29 22:40 +0100
Message-ID<qWoVQ-MS-7@gated-at.bofh.it>
In reply to#1321823
Michal Hocko wrote:
> On Fri 29-01-16 19:35:18, Tetsuo Handa wrote:
> > Michal Hocko wrote:
> > > From: Michal Hocko <mhocko@suse.com>
> > > 
> > > zone_reclaimable_pages is used in should_reclaim_retry which uses it to
> > > calculate the target for the watermark check. This means that precise
> > > numbers are important for the correct decision. zone_reclaimable_pages
> > > uses zone_page_state which can contain stale data with per-cpu diffs
> > > not synced yet (the last vmstat_update might have run 1s in the past).
> > > 
> > > Use zone_page_state_snapshot in zone_reclaimable_pages instead. None
> > > of the current callers is in a hot path where getting the precise value
> > > (which involves per-cpu iteration) would cause an unreasonable overhead.
> > > 
> > > Suggested-by: David Rientjes <rientjes@google.com>
> > > Signed-off-by: Michal Hocko <mhocko@suse.com>
> > > ---
> > >  mm/vmscan.c | 14 +++++++-------
> > >  1 file changed, 7 insertions(+), 7 deletions(-)
> > > 
> > 
> > I didn't know http://lkml.kernel.org/r/20151021130323.GC8805@dhcp22.suse.cz
> > was forgotten. Anyway,
> 
> OK, that explains why this sounded so familiar. Sorry I comepletely
> forgot about it.
> 
> > Acked-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> 
> Can I change it to your Signed-off-by?

No problem.

> 
> -- 
> Michal Hocko
> SUSE Labs
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web