* [patch] mm: memcontrol: default hierarchy interface for memory fix - high reclaim
@ 2015-01-17 15:21 Johannes Weiner
2015-01-20 13:25 ` Michal Hocko
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Weiner @ 2015-01-17 15:21 UTC (permalink / raw)
To: Andrew Morton
Cc: Michal Hocko, Vladimir Davydov, Greg Thelen, linux-mm, cgroups,
linux-kernel
High limit reclaim can currently overscan in proportion to how many
charges are happening concurrently. Tone it down such that charges
don't target the entire high-boundary excess, but instead only the
pages they charged themselves when excess is detected.
Reported-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
mm/memcontrol.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 323a01fa1833..7adccee9fecb 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2348,19 +2348,13 @@ done_restock:
refill_stock(memcg, batch - nr_pages);
/*
* If the hierarchy is above the normal consumption range,
- * make the charging task trim the excess.
+ * make the charging task trim their excess contribution.
*/
do {
- unsigned long nr_pages = page_counter_read(&memcg->memory);
- unsigned long high = ACCESS_ONCE(memcg->high);
-
- if (nr_pages > high) {
- mem_cgroup_events(memcg, MEMCG_HIGH, 1);
-
- try_to_free_mem_cgroup_pages(memcg, nr_pages - high,
- gfp_mask, true);
- }
-
+ if (page_counter_read(&memcg->memory) <= memcg->high)
+ continue;
+ mem_cgroup_events(memcg, MEMCG_HIGH, 1);
+ try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask, true);
} while ((memcg = parent_mem_cgroup(memcg)));
done:
return ret;
--
2.2.0
--
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] 5+ messages in thread
* Re: [patch] mm: memcontrol: default hierarchy interface for memory fix - high reclaim
2015-01-17 15:21 [patch] mm: memcontrol: default hierarchy interface for memory fix - high reclaim Johannes Weiner
@ 2015-01-20 13:25 ` Michal Hocko
2015-01-20 14:16 ` Johannes Weiner
0 siblings, 1 reply; 5+ messages in thread
From: Michal Hocko @ 2015-01-20 13:25 UTC (permalink / raw)
To: Johannes Weiner
Cc: Andrew Morton, Vladimir Davydov, Greg Thelen, linux-mm, cgroups,
linux-kernel
On Sat 17-01-15 10:21:19, Johannes Weiner wrote:
> High limit reclaim can currently overscan in proportion to how many
> charges are happening concurrently. Tone it down such that charges
> don't target the entire high-boundary excess, but instead only the
> pages they charged themselves when excess is detected.
>
> Reported-by: Michal Hocko <mhocko@suse.cz>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
I certainly agree with this approach.
Acked-by: Michal Hocko <mhocko@suse.cz>
Is this planned to be folded into the original patch or go on its own. I
am OK with both ways, maybe having it separate would be better from
documentation POV.
> ---
> mm/memcontrol.c | 16 +++++-----------
> 1 file changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 323a01fa1833..7adccee9fecb 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2348,19 +2348,13 @@ done_restock:
> refill_stock(memcg, batch - nr_pages);
> /*
> * If the hierarchy is above the normal consumption range,
> - * make the charging task trim the excess.
> + * make the charging task trim their excess contribution.
> */
> do {
> - unsigned long nr_pages = page_counter_read(&memcg->memory);
> - unsigned long high = ACCESS_ONCE(memcg->high);
> -
> - if (nr_pages > high) {
> - mem_cgroup_events(memcg, MEMCG_HIGH, 1);
> -
> - try_to_free_mem_cgroup_pages(memcg, nr_pages - high,
> - gfp_mask, true);
> - }
> -
> + if (page_counter_read(&memcg->memory) <= memcg->high)
> + continue;
> + mem_cgroup_events(memcg, MEMCG_HIGH, 1);
> + try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask, true);
> } while ((memcg = parent_mem_cgroup(memcg)));
> done:
> return ret;
> --
> 2.2.0
>
--
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] 5+ messages in thread
* Re: [patch] mm: memcontrol: default hierarchy interface for memory fix - high reclaim
2015-01-20 13:25 ` Michal Hocko
@ 2015-01-20 14:16 ` Johannes Weiner
[not found] ` <20150120141628.GA11181-HTCKtW7iVlxqnrmGgq4/JMIURNUf+fel@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Weiner @ 2015-01-20 14:16 UTC (permalink / raw)
To: Michal Hocko
Cc: Andrew Morton, Vladimir Davydov, Greg Thelen, linux-mm, cgroups,
linux-kernel
On Tue, Jan 20, 2015 at 02:25:19PM +0100, Michal Hocko wrote:
> On Sat 17-01-15 10:21:19, Johannes Weiner wrote:
> > High limit reclaim can currently overscan in proportion to how many
> > charges are happening concurrently. Tone it down such that charges
> > don't target the entire high-boundary excess, but instead only the
> > pages they charged themselves when excess is detected.
> >
> > Reported-by: Michal Hocko <mhocko@suse.cz>
> > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
>
> I certainly agree with this approach.
> Acked-by: Michal Hocko <mhocko@suse.cz>
Thanks!
> Is this planned to be folded into the original patch or go on its own. I
> am OK with both ways, maybe having it separate would be better from
> documentation POV.
I submitted them to be folded in. Which aspect would you like to see
documented?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-01-20 15:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-17 15:21 [patch] mm: memcontrol: default hierarchy interface for memory fix - high reclaim Johannes Weiner
2015-01-20 13:25 ` Michal Hocko
2015-01-20 14:16 ` Johannes Weiner
[not found] ` <20150120141628.GA11181-HTCKtW7iVlxqnrmGgq4/JMIURNUf+fel@public.gmane.org>
2015-01-20 14:31 ` Michal Hocko
[not found] ` <20150120143119.GK25342-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2015-01-20 15:44 ` Johannes Weiner
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).