Skip to contentSkip to conversation

memcg: fix direct softlimit reclaim to be called in limit path

PATCH Michal Hocko 2 participants 3 messages Jun 28, 2011 1 message not in the archive Memory management

lore
Share & tools
lore

Michal Hocko

author Reviewed-by
#1 lore raw
In reply to a message not in the archive

I am sorry, that I am answering that late but I didn't get to this sooner.

Quoted 13 lines · Andrew Morton

From: KAMEZAWA Hiroyuki <[email protected]>

commit d149e3b ("memcg: add the soft_limit reclaim in global direct reclaim") adds a softlimit hook to shrink_zones(). By this, soft limit is called as

   try_to_free_pages()
       do_try_to_free_pages()
           shrink_zones()
               mem_cgroup_soft_limit_reclaim()

Then, direct reclaim is memcg softlimit hint aware, now.

Quoted 8 lines

But, the memory cgroup's "limit" path can call softlimit shrinker.

   try_to_free_mem_cgroup_pages()
       do_try_to_free_pages()
           shrink_zones()
               mem_cgroup_soft_limit_reclaim()

This will cause a global reclaim when a memcg hits limit.

Sorry, I do not get it. How does it cause the global reclaim? Did you mean soft reclaim?

Quoted 3 lines

This is bug. soft_limit_reclaim() should be called when scanning_global_lru(sc) == true.

Agreed

Quoted 6 lines

And the commit adds a variable "total_scanned" for counting softlimit scanned pages....it's not "total". This patch removes the variable and update sc->nr_scanned instead of it. This will affect shrink_slab()'s scan condition but, global LRU is scanned by softlimit and I think this change makes sense.

Yes, the previous semantic was really confusing (part of the scanned accounting is returned by shrink_zones and the other part in sc). This could be ideally a separate change because it fixes a different bug (softlimit is not considered for slab srhinking)

Quoted 8 lines

TODO: avoid too much scanning of a zone when softlimit did enough work.

Just in case it is not late yet.

Signature · 13 lines
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#2 lore raw
Quoted 24 lines · On Tue, 28 Jun 2011 10:08:47 +0200 Michal Hocko <[email protected]> wrote:

I am sorry, that I am answering that late but I didn't get to this sooner.

Quoted 20 lines · Andrew Morton

From: KAMEZAWA Hiroyuki <[email protected]>

commit d149e3b ("memcg: add the soft_limit reclaim in global direct reclaim") adds a softlimit hook to shrink_zones(). By this, soft limit is called as

   try_to_free_pages()
       do_try_to_free_pages()
           shrink_zones()
               mem_cgroup_soft_limit_reclaim()

Then, direct reclaim is memcg softlimit hint aware, now.

But, the memory cgroup's "limit" path can call softlimit shrinker.

   try_to_free_mem_cgroup_pages()
       do_try_to_free_pages()
           shrink_zones()
               mem_cgroup_soft_limit_reclaim()
Quoted 5 lines
Quoted 1 line

This will cause a global reclaim when a memcg hits limit.

Sorry, I do not get it. How does it cause the global reclaim? Did you mean soft reclaim?

yes. soft reclaim does global reclaim (in some means).

Thanks,
-Kame

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
Quoted 27 lines · KAMEZAWA Hiroyuki
Quoted 24 lines · On Tue, 28 Jun 2011 10:08:47 +0200 Michal Hocko <[email protected]> wrote:

I am sorry, that I am answering that late but I didn't get to this sooner.

Quoted 20 lines · Andrew Morton

From: KAMEZAWA Hiroyuki <[email protected]>

commit d149e3b ("memcg: add the soft_limit reclaim in global direct reclaim") adds a softlimit hook to shrink_zones(). By this, soft limit is called as

   try_to_free_pages()
       do_try_to_free_pages()
           shrink_zones()
               mem_cgroup_soft_limit_reclaim()

Then, direct reclaim is memcg softlimit hint aware, now.

But, the memory cgroup's "limit" path can call softlimit shrinker.

   try_to_free_mem_cgroup_pages()
       do_try_to_free_pages()
           shrink_zones()
               mem_cgroup_soft_limit_reclaim()
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

This will cause a global reclaim when a memcg hits limit.

Sorry, I do not get it. How does it cause the global reclaim? Did you mean soft reclaim?

yes. soft reclaim does global reclaim (in some means).

But calling it global reclaim is rather confusing because in both paths we have sc.mem_cgroup set to non-NULL which is evaluated as !scanning_global_lru(sc). Anyway, this is not that important, I just wanted to be sure what you meant by that comment.

Signature · 13 lines
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>