From: Michal Hocko <mhocko@suse.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Richard Chang <richardycc@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Kairui Song <kasong@tencent.com>, Qi Zheng <qi.zheng@linux.dev>,
Shakeel Butt <shakeel.butt@linux.dev>,
Barry Song <baohua@kernel.org>,
Axel Rasmussen <axelrasmussen@google.com>,
Yuanchu Xie <yuanchu@google.com>, Wei Xu <weixugc@google.com>,
Johannes Weiner <hannes@cmpxchg.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
"T . J . Mercier" <tjmercier@google.com>,
Martin Liu <liumartin@google.com>,
Minchan Kim <minchan@kernel.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm: vmscan: abort proactive reclaim early when freezing for suspend
Date: Wed, 15 Jul 2026 21:58:24 +0200 [thread overview]
Message-ID: <alfmYBUxZOhFY30r@tiehlicka> (raw)
In-Reply-To: <alfHuSTW8sPAl9l3@redhat.com>
On Wed 15-07-26 19:47:37, Oleg Nesterov wrote:
> Hi Michal,
>
> On 07/15, Michal Hocko wrote:
> >
> > Oleg you haven't been CCed from the top of the thread but TL;DR is that
> > we need to freeze a user task performing pro-active memory reclaim that
> > might take long. Currently we are calling signal_pending to bail out
> > but that leaks EINTR which is bad as freezing task has a side effect of
> > terminating it.
>
> Sorry, I guess I don't understand the problem...
the problem is that `echo $AMOUNT > $CGROUP/memory.reclaim' can take
quite some time and therefore block freezer. Appart from Richard's fix
to bail out on pending_signal deep in the MGLRU reclaim we have this
signal_pending in user_proactive_reclaim which would leak EINTR if the
source of the signal was freezer. This is IMHO undesirable. The proposed
change below tries to address that problem.
Makes more sense now?
>
> Yes, unlike EINTR, ERESTARTSYS should not leak to the caller (just in case,
> debugger can see this error code).
Yes, I guess this is a general constrain to any signal_pending() caller.
> But I am sure you know this. And the patch looks fine to me.
>
> Oleg.
Thanks!
>
> >
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index 35c3bb15ae96..336af76d2a28 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -7909,8 +7909,13 @@ int user_proactive_reclaim(char *buf,
> > unsigned long batch_size = (nr_to_reclaim - nr_reclaimed) / 4;
> > unsigned long reclaimed;
> >
> > + /*
> > + * Make sure that we enter freezer without delaying much and
> > + * leaking EINTR when that happens but also take care of
> > + * fatal signals to terminate.
> > + */
> > if (signal_pending(current))
> > - return -EINTR;
> > + return -ERESTARTSYS;
> >
> > /*
> > * This is the final attempt, drain percpu lru caches in the
> > --
> > Michal Hocko
> > SUSE Labs
> >
--
Michal Hocko
SUSE Labs
prev parent reply other threads:[~2026-07-15 19:58 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 8:12 [PATCH] mm: vmscan: abort proactive reclaim early when freezing Richard Chang
2026-07-06 12:54 ` Barry Song
2026-07-07 8:00 ` Richard Chang
2026-07-06 23:38 ` Andrew Morton
2026-07-07 10:13 ` Richard Chang
2026-07-07 2:20 ` Yosry Ahmed
2026-07-07 8:04 ` Richard Chang
2026-07-07 18:28 ` Yosry Ahmed
2026-07-07 19:48 ` Shakeel Butt
2026-07-08 4:14 ` Richard Chang
2026-07-08 4:54 ` Shakeel Butt
2026-07-08 7:24 ` Richard Chang
2026-07-08 15:47 ` Shakeel Butt
2026-07-08 16:03 ` T.J. Mercier
2026-07-08 16:51 ` Shakeel Butt
2026-07-09 7:22 ` [PATCH v2] mm: vmscan: abort proactive reclaim early when freezing for suspend Richard Chang
2026-07-09 12:06 ` Michal Hocko
2026-07-10 3:29 ` Richard Chang
2026-07-10 6:27 ` Michal Hocko
[not found] ` <CALC_0q93iheF=Y36SSTg-XCoKgHrhxk88LqcQkDd-O3ymMVmxw@mail.gmail.com>
2026-07-14 12:23 ` Michal Hocko
2026-07-14 12:40 ` Michal Hocko
[not found] ` <CALC_0q_9DamACOEyXeevWvq-6D9dQZ6NNt=iBN7gkOQRM9xqfw@mail.gmail.com>
[not found] ` <aldJnz0u1YyoCyGr@tiehlicka>
2026-07-15 17:47 ` Oleg Nesterov
2026-07-15 19:58 ` Michal Hocko [this message]
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=alfmYBUxZOhFY30r@tiehlicka \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liumartin@google.com \
--cc=ljs@kernel.org \
--cc=minchan@kernel.org \
--cc=oleg@redhat.com \
--cc=qi.zheng@linux.dev \
--cc=richardycc@google.com \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=tjmercier@google.com \
--cc=weixugc@google.com \
--cc=yuanchu@google.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