On Thu, Mar 20, 2025 at 12:21:26PM +0100, Oleg Nesterov wrote: > And just for the record... > > Consider the simplest case: a single-threaded not-ptraced process > exits. In this case do_notify_pidfd() will be called twice, from > exit_notify() and right after that from do_notify_parent(). Yes. > > We can cleanup this logic, but I don't think this is important and > this needs a separate patch. I would actually clean this up. > > (With or without this change: if the exiting task is ptraced or its > parent exits without wait(), do_notify_pidfd() will be called even > more times, but I think we do not care at all). Yes, though the ptrace codeflow is even more cursed so I'm not too worried about making that clean (I wouldn't know how.).