From: Chris Down <chris@chrisdown.name>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: akpm@linux-foundation.org, mhocko@kernel.org, hannes@cmpxchg.org,
guro@fb.com, linux-mm@kvack.org
Subject: Re: [PATCH v2 1/2] mm, memcg: Avoid stale protection values when cgroup is above protection
Date: Sat, 2 May 2020 15:12:24 +0100 [thread overview]
Message-ID: <20200502141224.GA1973@chrisdown.name> (raw)
In-Reply-To: <20200502135910.7255-2-laoar.shao@gmail.com>
Yafang Shao writes:
>A cgroup can have both memory protection and a memory limit to isolate
>it from its siblings in both directions - for example, to prevent it
>from being shrunk below 2G under high pressure from outside, but also
>from growing beyond 4G under low pressure.
>
>Commit 9783aa9917f8 ("mm, memcg: proportional memory.{low,min} reclaim")
>implemented proportional scan pressure so that multiple siblings in
>excess of their protection settings don't get reclaimed equally but
>instead in accordance to their unprotected portion.
>
>During limit reclaim, this proportionality shouldn't apply of course:
>there is no competition, all pressure is from within the cgroup and
>should be applied as such. Reclaim should operate at full efficiency.
>
>However, mem_cgroup_protected() never expected anybody to look at the
>effective protection values when it indicated that the cgroup is above
>its protection. As a result, a query during limit reclaim may return
>stale protection values that were calculated by a previous reclaim cycle
>in which the cgroup did have siblings.
>
>When this happens, reclaim is unnecessarily hesitant and potentially
>slow to meet the desired limit. In theory this could lead to premature
>OOM kills, although it's not obvious this has occurred in practice.
>
>[hannes@cmpxchg.org: changelog]
>[mhocko@kernel.org: rework code comment]
>[chris@chrisdown.name: retitle]
>Fixes: 9783aa9917f8 ("mm, memcg: proportional memory.{low,min} reclaim")
>Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
>Acked-by: Roman Gushchin <guro@fb.com>
>Cc: Michal Hocko <mhocko@kernel.org>
>Cc: Johannes Weiner <hannes@cmpxchg.org>
>Cc: Chris Down <chris@chrisdown.name>
Thanks!
Acked-by: Chris Down <chris@chrisdown.name>
next prev parent reply other threads:[~2020-05-02 14:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-02 13:59 [PATCH v2 0/2] mm: memcontrol: memory.{low,min} reclaim fix & cleanup Yafang Shao
2020-05-02 13:59 ` [PATCH v2 1/2] mm, memcg: Avoid stale protection values when cgroup is above protection Yafang Shao
2020-05-02 14:12 ` Chris Down [this message]
2020-05-02 14:44 ` Johannes Weiner
2020-05-04 7:52 ` Michal Hocko
2020-05-02 13:59 ` [PATCH v2 2/2] mm, memcg: Decouple e{low,min} state mutations from protection checks Yafang Shao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200502141224.GA1973@chrisdown.name \
--to=chris@chrisdown.name \
--cc=akpm@linux-foundation.org \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=laoar.shao@gmail.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox