From: Vlastimil Babka <vbabka@suse.cz>
To: Michal Hocko <mhocko@suse.com>, Chris Down <chris@chrisdown.name>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>,
linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
Muchun Song <songmuchun@bytedance.com>,
Matthew Wilcox <willy@infradead.org>,
Chunxin Zang <zangchunxin@bytedance.com>
Subject: Re: [PATCH] mm, vmscan: guarantee drop_slab_node() termination
Date: Tue, 24 Aug 2021 11:33:13 +0200 [thread overview]
Message-ID: <1dfa1b2b-9add-38cc-43cd-8b4b071a4d55@suse.cz> (raw)
In-Reply-To: <YR5no647LSfnT6AP@dhcp22.suse.cz>
On 8/19/21 16:16, Michal Hocko wrote:
> On Thu 19-08-21 14:21:08, Chris Down wrote:
>>
>> Yeah, but we already draw the line at 10 right now. `freed > 10 && retries <
>> MAX_RECLAIM_RETRIES` seems easier to reason about, at least to me, and stays
>> closer to the current behaviour while providing a definitive point of loop
>> termination.
The doubling threshold is also definitive :) 64 iterations on 64-bit systems, 32
on 32 bit. In practice it will be much less.
> I have to say that I am not really a fan of MAX_RECLAIM_RETRIES approach
> especially for user interfaces. Any limit on retries has kicked us back
> (e.g. offlining for the memory hotplug just to mention one of those).
> drop_caches can take a long time on its own even without retrying. We
> should teach people to interrupt those operations if they should really
> finish early (e.g. timeout $TIMEOUT echo > /proc/sys/vm/drop_caches)
> rather than trying to be extra clever here.
I'm afraid the retries vs threshold has more potential for bikeshedding than
actual difference in practice. I can change it if more people prefer that way.
> I am not against the patch Vlastimil is proposing because it replaces an
> ad-hoc limit on the reclaimed objects threshold with something that is
> less "random" - sort of a backoff instead seems like an improvement to
> me. But I would still be worried that this could regress for some users
> so in an ideal world the existing bail on signal should be enough.
My point of view on this is:
- first let's not forget this is an interface intended for debugging, that we
generally discourage to use in a regular manner. Yet it exists, so people will
inevitably use it from automated scripts and cron and whatnot.
- as such there are no guarantees how much it reclaims, it's a best effort
really. If a user thinks it hasn't reclaimed enough, they can always implement
own userspace loop that checks e.g. meminfo or slabinfo to decide whether to do
another iteration of drop_caches.
- while the userspace loop might be convoluted, the idea of running with timeout
is not obvious. One might see the operation finishes fine in initial testing,
put it in cron etc. without timeout, and one day the infinite loop kicks in and
there's trouble.
So I think the safer default that avoids suprises is to guarantee termination
rather than aggressive reclaim.
next prev parent reply other threads:[~2021-08-24 9:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-18 15:22 Vlastimil Babka
2021-08-18 21:48 ` Chris Down
2021-08-19 2:55 ` Kefeng Wang
2021-08-19 7:01 ` Vlastimil Babka
2021-08-19 9:38 ` Kefeng Wang
2021-08-19 13:21 ` Chris Down
2021-08-19 14:16 ` Michal Hocko
2021-08-24 9:33 ` Vlastimil Babka [this message]
2021-08-24 10:02 ` Matthew Wilcox
2021-08-24 14:04 ` Vlastimil Babka
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=1dfa1b2b-9add-38cc-43cd-8b4b071a4d55@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=chris@chrisdown.name \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=songmuchun@bytedance.com \
--cc=wangkefeng.wang@huawei.com \
--cc=willy@infradead.org \
--cc=zangchunxin@bytedance.com \
/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