On Sat, Jan 27, 2024 at 08:31:27PM +0100, Oleg Nesterov wrote: > On 01/27, Tycho Andersen wrote: > > > > > > > exit_notify() is called after exit_files(). pidfd_getfd() returns > > > > > ESRCH if the exiting thread completes release_task(), otherwise it > > > > > returns EBADF because ->files == NULL. This too doesn't really > > > > > depend on PIDFD_THREAD. > > > > > > > > Yup, understood. It just seems like an inconsistency we might want to > > > > fix. > > > > > > Not sure this worth "fixing"... > > > > Yep, maybe not. Just wanted to point it out. > > On the second thought I am starting to understand your concern... > > Indeed, in this case -EBADF is technically correct but it can confuse > the user which doesn't or can't know that this task/thread is exiting, > because EBADF looks as if the "int fd" argument was wrong. > > Sorry I missed your point before. No worries. I realized it's not so hard to fix with your new xxx_exited() helper from the PIDFD_THREAD patch, so maybe worth cleaning up after all? Tycho