Re: [PATCH v2] mm: vmscan: abort proactive reclaim early when freezing for suspend
From: Oleg Nesterov
Date: Wed Jul 15 2026 - 13:48:03 EST
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...
Yes, unlike EINTR, ERESTARTSYS should not leak to the caller (just in case,
debugger can see this error code).
But I am sure you know this. And the patch looks fine to me.
Oleg.
>
> 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
>