All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] update sc->nr_reclaimed after each shrink_slab
@ 2016-07-22  3:43 ` Zhou Chengming
  0 siblings, 0 replies; 8+ messages in thread
From: Zhou Chengming @ 2016-07-22  3:43 UTC (permalink / raw)
  To: linux-kernel, linux-mm
  Cc: akpm, vdavydov, riel, mhocko, guohanjun, zhouchengming1

In !global_reclaim(sc) case, we should update sc->nr_reclaimed after each
shrink_slab in the loop. Because we need the correct sc->nr_reclaimed
value to see if we can break out.

Signed-off-by: Zhou Chengming <zhouchengming1@huawei.com>
---
 mm/vmscan.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index c4a2f45..47133c3 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2405,6 +2405,11 @@ static bool shrink_zone(struct zone *zone, struct scan_control *sc,
 					    memcg, sc->nr_scanned - scanned,
 					    lru_pages);
 
+			if (!global_reclaim(sc) && reclaim_state) {
+				sc->nr_reclaimed += reclaim_state->reclaimed_slab;
+				reclaim_state->reclaimed_slab = 0;
+			}
+
 			/* Record the group's reclaim efficiency */
 			vmpressure(sc->gfp_mask, memcg, false,
 				   sc->nr_scanned - scanned,
-- 
1.7.7

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

* [PATCH] update sc->nr_reclaimed after each shrink_slab
@ 2016-07-22  3:43 ` Zhou Chengming
  0 siblings, 0 replies; 8+ messages in thread
From: Zhou Chengming @ 2016-07-22  3:43 UTC (permalink / raw)
  To: linux-kernel, linux-mm
  Cc: akpm, vdavydov, riel, mhocko, guohanjun, zhouchengming1

In !global_reclaim(sc) case, we should update sc->nr_reclaimed after each
shrink_slab in the loop. Because we need the correct sc->nr_reclaimed
value to see if we can break out.

Signed-off-by: Zhou Chengming <zhouchengming1@huawei.com>
---
 mm/vmscan.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index c4a2f45..47133c3 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2405,6 +2405,11 @@ static bool shrink_zone(struct zone *zone, struct scan_control *sc,
 					    memcg, sc->nr_scanned - scanned,
 					    lru_pages);
 
+			if (!global_reclaim(sc) && reclaim_state) {
+				sc->nr_reclaimed += reclaim_state->reclaimed_slab;
+				reclaim_state->reclaimed_slab = 0;
+			}
+
 			/* Record the group's reclaim efficiency */
 			vmpressure(sc->gfp_mask, memcg, false,
 				   sc->nr_scanned - scanned,
-- 
1.7.7

--
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] 8+ messages in thread

* Re: [PATCH] update sc->nr_reclaimed after each shrink_slab
  2016-07-22  3:43 ` Zhou Chengming
@ 2016-07-22  7:49   ` Michal Hocko
  -1 siblings, 0 replies; 8+ messages in thread
From: Michal Hocko @ 2016-07-22  7:49 UTC (permalink / raw)
  To: Zhou Chengming; +Cc: linux-kernel, linux-mm, akpm, vdavydov, riel, guohanjun

On Fri 22-07-16 11:43:30, Zhou Chengming wrote:
> In !global_reclaim(sc) case, we should update sc->nr_reclaimed after each
> shrink_slab in the loop. Because we need the correct sc->nr_reclaimed
> value to see if we can break out.

Does this actually change anything? Maybe I am missing something but
try_to_free_mem_cgroup_pages which is the main entry for the memcg
reclaim doesn't set reclaim_state. I don't remember why... Vladimir?

Have you observed any issues and this patch fixes it or this is just
motivated by the code inspection?

> Signed-off-by: Zhou Chengming <zhouchengming1@huawei.com>
> ---
>  mm/vmscan.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index c4a2f45..47133c3 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2405,6 +2405,11 @@ static bool shrink_zone(struct zone *zone, struct scan_control *sc,
>  					    memcg, sc->nr_scanned - scanned,
>  					    lru_pages);
>  
> +			if (!global_reclaim(sc) && reclaim_state) {
> +				sc->nr_reclaimed += reclaim_state->reclaimed_slab;
> +				reclaim_state->reclaimed_slab = 0;
> +			}
> +
>  			/* Record the group's reclaim efficiency */
>  			vmpressure(sc->gfp_mask, memcg, false,
>  				   sc->nr_scanned - scanned,
> -- 
> 1.7.7
> 

-- 
Michal Hocko
SUSE Labs

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

* Re: [PATCH] update sc->nr_reclaimed after each shrink_slab
@ 2016-07-22  7:49   ` Michal Hocko
  0 siblings, 0 replies; 8+ messages in thread
From: Michal Hocko @ 2016-07-22  7:49 UTC (permalink / raw)
  To: Zhou Chengming; +Cc: linux-kernel, linux-mm, akpm, vdavydov, riel, guohanjun

On Fri 22-07-16 11:43:30, Zhou Chengming wrote:
> In !global_reclaim(sc) case, we should update sc->nr_reclaimed after each
> shrink_slab in the loop. Because we need the correct sc->nr_reclaimed
> value to see if we can break out.

Does this actually change anything? Maybe I am missing something but
try_to_free_mem_cgroup_pages which is the main entry for the memcg
reclaim doesn't set reclaim_state. I don't remember why... Vladimir?

Have you observed any issues and this patch fixes it or this is just
motivated by the code inspection?

> Signed-off-by: Zhou Chengming <zhouchengming1@huawei.com>
> ---
>  mm/vmscan.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index c4a2f45..47133c3 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2405,6 +2405,11 @@ static bool shrink_zone(struct zone *zone, struct scan_control *sc,
>  					    memcg, sc->nr_scanned - scanned,
>  					    lru_pages);
>  
> +			if (!global_reclaim(sc) && reclaim_state) {
> +				sc->nr_reclaimed += reclaim_state->reclaimed_slab;
> +				reclaim_state->reclaimed_slab = 0;
> +			}
> +
>  			/* Record the group's reclaim efficiency */
>  			vmpressure(sc->gfp_mask, memcg, false,
>  				   sc->nr_scanned - scanned,
> -- 
> 1.7.7
> 

-- 
Michal Hocko
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] 8+ messages in thread

* Re: [PATCH] update sc->nr_reclaimed after each shrink_slab
  2016-07-22  7:49   ` Michal Hocko
@ 2016-07-22  8:12     ` Vladimir Davydov
  -1 siblings, 0 replies; 8+ messages in thread
From: Vladimir Davydov @ 2016-07-22  8:12 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Zhou Chengming, linux-kernel, linux-mm, akpm, riel, guohanjun

On Fri, Jul 22, 2016 at 09:49:13AM +0200, Michal Hocko wrote:
> On Fri 22-07-16 11:43:30, Zhou Chengming wrote:
> > In !global_reclaim(sc) case, we should update sc->nr_reclaimed after each
> > shrink_slab in the loop. Because we need the correct sc->nr_reclaimed
> > value to see if we can break out.
> 
> Does this actually change anything? Maybe I am missing something but
> try_to_free_mem_cgroup_pages which is the main entry for the memcg
> reclaim doesn't set reclaim_state. I don't remember why... Vladimir?

We don't set reclaim_state on memcg reclaim, because there might be a
lot of unrelated slab objects freed from the interrupt context (e.g.
RCU freed) while we're doing memcg reclaim. Obviously, we don't want
them to contribute to nr_reclaimed.

Link to the thread with the problem discussion:

  http://marc.info/?l=linux-kernel&m=142132698209680&w=2

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

* Re: [PATCH] update sc->nr_reclaimed after each shrink_slab
@ 2016-07-22  8:12     ` Vladimir Davydov
  0 siblings, 0 replies; 8+ messages in thread
From: Vladimir Davydov @ 2016-07-22  8:12 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Zhou Chengming, linux-kernel, linux-mm, akpm, riel, guohanjun

On Fri, Jul 22, 2016 at 09:49:13AM +0200, Michal Hocko wrote:
> On Fri 22-07-16 11:43:30, Zhou Chengming wrote:
> > In !global_reclaim(sc) case, we should update sc->nr_reclaimed after each
> > shrink_slab in the loop. Because we need the correct sc->nr_reclaimed
> > value to see if we can break out.
> 
> Does this actually change anything? Maybe I am missing something but
> try_to_free_mem_cgroup_pages which is the main entry for the memcg
> reclaim doesn't set reclaim_state. I don't remember why... Vladimir?

We don't set reclaim_state on memcg reclaim, because there might be a
lot of unrelated slab objects freed from the interrupt context (e.g.
RCU freed) while we're doing memcg reclaim. Obviously, we don't want
them to contribute to nr_reclaimed.

Link to the thread with the problem discussion:

  http://marc.info/?l=linux-kernel&m=142132698209680&w=2

--
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] 8+ messages in thread

* Re: [PATCH] update sc->nr_reclaimed after each shrink_slab
  2016-07-22  8:12     ` Vladimir Davydov
@ 2016-07-22  8:18       ` Michal Hocko
  -1 siblings, 0 replies; 8+ messages in thread
From: Michal Hocko @ 2016-07-22  8:18 UTC (permalink / raw)
  To: Vladimir Davydov
  Cc: Zhou Chengming, linux-kernel, linux-mm, akpm, riel, guohanjun

On Fri 22-07-16 11:12:59, Vladimir Davydov wrote:
> On Fri, Jul 22, 2016 at 09:49:13AM +0200, Michal Hocko wrote:
> > On Fri 22-07-16 11:43:30, Zhou Chengming wrote:
> > > In !global_reclaim(sc) case, we should update sc->nr_reclaimed after each
> > > shrink_slab in the loop. Because we need the correct sc->nr_reclaimed
> > > value to see if we can break out.
> > 
> > Does this actually change anything? Maybe I am missing something but
> > try_to_free_mem_cgroup_pages which is the main entry for the memcg
> > reclaim doesn't set reclaim_state. I don't remember why... Vladimir?
> 
> We don't set reclaim_state on memcg reclaim, because there might be a
> lot of unrelated slab objects freed from the interrupt context (e.g.
> RCU freed) while we're doing memcg reclaim. Obviously, we don't want
> them to contribute to nr_reclaimed.
> 
> Link to the thread with the problem discussion:
> 
>   http://marc.info/?l=linux-kernel&m=142132698209680&w=2

Ohh, now I rememeber again. Thanks for the refresh ;)

So the patch doesn't make any difference in the end.
-- 
Michal Hocko
SUSE Labs

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

* Re: [PATCH] update sc->nr_reclaimed after each shrink_slab
@ 2016-07-22  8:18       ` Michal Hocko
  0 siblings, 0 replies; 8+ messages in thread
From: Michal Hocko @ 2016-07-22  8:18 UTC (permalink / raw)
  To: Vladimir Davydov
  Cc: Zhou Chengming, linux-kernel, linux-mm, akpm, riel, guohanjun

On Fri 22-07-16 11:12:59, Vladimir Davydov wrote:
> On Fri, Jul 22, 2016 at 09:49:13AM +0200, Michal Hocko wrote:
> > On Fri 22-07-16 11:43:30, Zhou Chengming wrote:
> > > In !global_reclaim(sc) case, we should update sc->nr_reclaimed after each
> > > shrink_slab in the loop. Because we need the correct sc->nr_reclaimed
> > > value to see if we can break out.
> > 
> > Does this actually change anything? Maybe I am missing something but
> > try_to_free_mem_cgroup_pages which is the main entry for the memcg
> > reclaim doesn't set reclaim_state. I don't remember why... Vladimir?
> 
> We don't set reclaim_state on memcg reclaim, because there might be a
> lot of unrelated slab objects freed from the interrupt context (e.g.
> RCU freed) while we're doing memcg reclaim. Obviously, we don't want
> them to contribute to nr_reclaimed.
> 
> Link to the thread with the problem discussion:
> 
>   http://marc.info/?l=linux-kernel&m=142132698209680&w=2

Ohh, now I rememeber again. Thanks for the refresh ;)

So the patch doesn't make any difference in the end.
-- 
Michal Hocko
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] 8+ messages in thread

end of thread, other threads:[~2016-07-22  9:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-22  3:43 [PATCH] update sc->nr_reclaimed after each shrink_slab Zhou Chengming
2016-07-22  3:43 ` Zhou Chengming
2016-07-22  7:49 ` Michal Hocko
2016-07-22  7:49   ` Michal Hocko
2016-07-22  8:12   ` Vladimir Davydov
2016-07-22  8:12     ` Vladimir Davydov
2016-07-22  8:18     ` Michal Hocko
2016-07-22  8:18       ` Michal Hocko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.