Re: [RFC PATCH] PM: Optionally block user fork during freeze to improve performance

From: David Hildenbrand
Date: Tue Jun 10 2025 - 06:50:21 EST


On 09.06.25 06:05, zhangzihuan wrote:
Hi Peter,
Thanks a lot for the feedback!

在 2025/6/6 16:22, Peter Zijlstra 写道:
This isn't blocking fork(), this is failing fork(). Huge difference.
Also problematic, because -EBUSY is not a recognised return value of
fork(). As such, no existing software will adequately handle it.
 I completely agree there's a significant difference between failing
and blocking fork().
The intent was to prevent late-created user tasks from interfering with
the freezing process, but you're right: returning -EBUSY is not valid
for fork(), and existing user-space programs wouldn't expect or handle
that properly.
As a next step, I'm considering switching to a blocking mechanism
instead — that is, have user fork() temporarily sleep if it's attempted
during the freeze window. That should avoid breaking user-space
expectations while still helping maintain freeze stability.
Would that be more acceptable?

Can't this problem be mitigated by simply not scheduling the new fork'ed process while the system is frozen?

Or what exact scenario are you worried about?

--
Cheers,

David / dhildenb