* [PATCH] mm, memcg: Bypass high reclaim iteration for cgroup hierarchy root
@ 2020-03-12 16:41 Chris Down
[not found] ` <20200312164137.GA1753625-6Bi1550iOqEnzZ6mRAm98g@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Chris Down @ 2020-03-12 16:41 UTC (permalink / raw)
To: Andrew Morton
Cc: Johannes Weiner, Tejun Heo, linux-mm-Bw31MaZKKs3YtjvyW6yDsg,
cgroups-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, kernel-team-b10kYP2dOMg
The root of the hierarchy cannot have high set, so we will never reclaim
based on it. This makes that clearer and avoids another entry.
Signed-off-by: Chris Down <chris-6Bi1550iOqEnzZ6mRAm98g@public.gmane.org>
Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Cc: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: kernel-team-b10kYP2dOMg@public.gmane.org
---
mm/memcontrol.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 63bb6a2aab81..ab9d24a657b9 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2232,7 +2232,8 @@ static void reclaim_high(struct mem_cgroup *memcg,
continue;
memcg_memory_event(memcg, MEMCG_HIGH);
try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask, true);
- } while ((memcg = parent_mem_cgroup(memcg)));
+ } while ((memcg = parent_mem_cgroup(memcg)) &&
+ !mem_cgroup_is_root(memcg));
}
static void high_work_func(struct work_struct *work)
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm, memcg: Bypass high reclaim iteration for cgroup hierarchy root
[not found] ` <20200312164137.GA1753625-6Bi1550iOqEnzZ6mRAm98g@public.gmane.org>
@ 2020-04-02 1:23 ` Andrew Morton
2020-04-02 15:18 ` Johannes Weiner
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2020-04-02 1:23 UTC (permalink / raw)
To: Chris Down
Cc: Johannes Weiner, Tejun Heo, linux-mm-Bw31MaZKKs3YtjvyW6yDsg,
cgroups-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, kernel-team-b10kYP2dOMg,
Michal Hocko
On Thu, 12 Mar 2020 16:41:37 +0000 Chris Down <chris-6Bi1550iOqEnzZ6mRAm98g@public.gmane.org> wrote:
> The root of the hierarchy cannot have high set, so we will never reclaim
> based on it. This makes that clearer and avoids another entry.
>
> ...
>
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2232,7 +2232,8 @@ static void reclaim_high(struct mem_cgroup *memcg,
> continue;
> memcg_memory_event(memcg, MEMCG_HIGH);
> try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask, true);
> - } while ((memcg = parent_mem_cgroup(memcg)));
> + } while ((memcg = parent_mem_cgroup(memcg)) &&
> + !mem_cgroup_is_root(memcg));
> }
>
> static void high_work_func(struct work_struct *work)
Does someone have time to review this one?
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm, memcg: Bypass high reclaim iteration for cgroup hierarchy root
[not found] ` <20200312164137.GA1753625-6Bi1550iOqEnzZ6mRAm98g@public.gmane.org>
2020-04-02 1:23 ` Andrew Morton
@ 2020-04-02 15:18 ` Johannes Weiner
1 sibling, 0 replies; 3+ messages in thread
From: Johannes Weiner @ 2020-04-02 15:18 UTC (permalink / raw)
To: Chris Down
Cc: Andrew Morton, Tejun Heo, linux-mm-Bw31MaZKKs3YtjvyW6yDsg,
cgroups-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, kernel-team-b10kYP2dOMg
On Thu, Mar 12, 2020 at 04:41:37PM +0000, Chris Down wrote:
> The root of the hierarchy cannot have high set, so we will never reclaim
> based on it. This makes that clearer and avoids another entry.
>
> Signed-off-by: Chris Down <chris-6Bi1550iOqEnzZ6mRAm98g@public.gmane.org>
> Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> Cc: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
> Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org
> Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: kernel-team-b10kYP2dOMg@public.gmane.org
This makes sense, memory.high doesn't exist on the root.
And the mem_cgroup_is_root() check, a simple pointer comparison, is
cheaper than reading the page_counter atomic and memcg->high (which we
already know to be PAGE_COUNTER_MAX).
Acked-by: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-02 15:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-12 16:41 [PATCH] mm, memcg: Bypass high reclaim iteration for cgroup hierarchy root Chris Down
[not found] ` <20200312164137.GA1753625-6Bi1550iOqEnzZ6mRAm98g@public.gmane.org>
2020-04-02 1:23 ` Andrew Morton
2020-04-02 15:18 ` 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).