From: Michal Hocko <email@example.com> To: Johannes Weiner <firstname.lastname@example.org> Cc: Tejun Heo <email@example.com>, Shakeel Butt <firstname.lastname@example.org>, Jakub Kicinski <email@example.com>, Andrew Morton <firstname.lastname@example.org>, Linux MM <email@example.com>, Kernel Team <firstname.lastname@example.org>, Chris Down <email@example.com>, Cgroups <firstname.lastname@example.org> Subject: Re: [PATCH 0/3] memcg: Slow down swap allocation as the available space gets depleted Date: Fri, 24 Apr 2020 17:05:10 +0200 [thread overview] Message-ID: <20200424150510.GH11591@dhcp22.suse.cz> (raw) In-Reply-To: <20200423150015.GE362484@cmpxchg.org> On Thu 23-04-20 11:00:15, Johannes Weiner wrote: > On Wed, Apr 22, 2020 at 08:49:21PM +0200, Michal Hocko wrote: > > On Wed 22-04-20 13:13:28, Johannes Weiner wrote: > > > On Wed, Apr 22, 2020 at 05:43:18PM +0200, Michal Hocko wrote: > > > > On Wed 22-04-20 10:15:14, Johannes Weiner wrote: > > > > I am also missing some information about what the user can actually do > > > > about this situation and call out explicitly that the throttling is > > > > not going away until the swap usage is shrunk and the kernel is not > > > > capable of doing that on its own without a help from the userspace. This > > > > is really different from memory.high which has means to deal with the > > > > excess and shrink it down in most cases. The following would clarify it > > > > > > I think we may be talking past each other. The user can do the same > > > thing as in any OOM situation: wait for the kill. > > > > That assumes that reaching swap.high is going to converge to the OOM > > eventually. And that is far from the general case. There might be a > > lot of other reclaimable memory to reclaim and stay in the current > > state. > > No, that's really the general case. And that's based on what users > widely experience, including us at FB. When swap is full, it's over. > Multiple parties have independently reached this conclusion. But we are talking about two things. You seem to be focusing on the full swap (quota) while I am talking about swap.high which doesn't imply that the quota/full swap is going to be reached soon. [...] > The assymetry you see between memory.high and swap.high comes from the > page cache. memory.high can set a stop to the mindless expansion of > the file cache and remove *unused* cache pages from the application's > workingset. It cannot permanently remove used cache pages, they'll > just refault. So unused cache is where reclaim is useful. Exactly! And I have seen memory.high being used to throttle huge page cache producers to not disrupt other workloads. > Once the workload expands its set of *used* pages past memory.high, we > are talking about indefinite slowdowns / OOM situations. Because at > that point, reclaim cannot push the workload back and everything will > be okay: the pages it takes off mean refaults and continued reclaim, > i.e. throttling. You get slowed down either way, and whether you > reclaim or sleep() is - to the workload - an accounting difference. > > Reclaim does NOT have the power to help the workload get better. It > can only do amputations to protect the rest of the system, but it > cannot reduce the number of pages the workload is trying to access. Yes I do agree with you here and I believe this scenario wasn't really what the dispute is about. As soon as the real working set doesn't fit into the high limit and still growing then you are effectively OOM and either you do handle that from the userspace or you have to waaaaaaaaait for the kernel oom killer to trigger. But I believe this scenario is much easier to understand because the memory consumption is growing. What I find largely unintuitive from the user POV is that the throttling will remain in place without a userspace intervention even when there is no runaway. Let me give you an example. Say you have a peak load which pushes out a large part of an idle memory to swap. So much it fills up the swap.high. The peak eventually finishes freeing up its resources. The swap situation remains the same because that memory is not refaulted and we do not pro-actively swap in memory (aka reclaim the swap space). You are left with throttling even though the overall memcg consumption is really low. Kernel is currently not able to do anything about that and the userspace would need to be aware of the situation to fault in swapped out memory back to get a normal behavior. Do you think this is something so obvious that people would keep it in mind when using swap.high? Anyway, it seems that we are not making progress here. As I've said I believe that swap.high might lead to a surprising behavior and therefore I would appreciate more clarity in the documentation. If you see a problem with that for some reason then I can live with that. This is not a reason to nack. -- Michal Hocko SUSE Labs
next prev parent reply other threads:[~2020-04-24 15:05 UTC|newest] Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-17 1:06 Jakub Kicinski 2020-04-17 1:06 ` [PATCH 1/3] mm: prepare for swap over-high accounting and penalty calculation Jakub Kicinski 2020-04-17 1:06 ` [PATCH 2/3] mm: move penalty delay clamping out of calculate_high_delay() Jakub Kicinski 2020-04-17 1:06 ` [PATCH 3/3] mm: automatically penalize tasks with high swap use Jakub Kicinski 2020-04-17 7:37 ` Michal Hocko 2020-04-17 23:22 ` Jakub Kicinski 2020-04-17 16:11 ` [PATCH 0/3] memcg: Slow down swap allocation as the available space gets depleted Shakeel Butt 2020-04-17 16:23 ` Tejun Heo 2020-04-17 17:18 ` Shakeel Butt 2020-04-17 17:36 ` Tejun Heo 2020-04-17 17:51 ` Shakeel Butt 2020-04-17 19:35 ` Tejun Heo 2020-04-17 21:51 ` Shakeel Butt 2020-04-17 22:59 ` Tejun Heo 2020-04-20 16:12 ` Shakeel Butt 2020-04-20 16:47 ` Tejun Heo 2020-04-20 17:03 ` Michal Hocko 2020-04-20 17:06 ` Tejun Heo 2020-04-21 11:06 ` Michal Hocko 2020-04-21 14:27 ` Johannes Weiner 2020-04-21 16:11 ` Michal Hocko 2020-04-21 16:56 ` Johannes Weiner 2020-04-22 13:26 ` Michal Hocko 2020-04-22 14:15 ` Johannes Weiner 2020-04-22 15:43 ` Michal Hocko 2020-04-22 17:13 ` Johannes Weiner 2020-04-22 18:49 ` Michal Hocko 2020-04-23 15:00 ` Johannes Weiner 2020-04-24 15:05 ` Michal Hocko [this message] 2020-04-28 14:24 ` Johannes Weiner 2020-04-29 9:55 ` Michal Hocko 2020-04-21 19:09 ` Shakeel Butt 2020-04-21 21:59 ` Johannes Weiner 2020-04-21 22:39 ` Shakeel Butt 2020-04-21 15:20 ` Tejun Heo
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=20200424150510.GH11591@dhcp22.suse.cz \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: [PATCH 0/3] memcg: Slow down swap allocation as the available space gets depleted' \ /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
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).