Messages in this thread | | | From | Joel Fernandes <> | Date | Mon, 29 Oct 2018 12:45:25 -0700 | Subject | Re: [RFC PATCH] Minimal non-child process exit notification support |
| |
On Mon, Oct 29, 2018 at 10:53 AM Daniel Colascione <dancol@google.com> wrote: > > This patch adds a new file under /proc/pid, /proc/pid/exithand. > Attempting to read from an exithand file will block until the > corresponding process exits, at which point the read will successfully > complete with EOF. The file descriptor supports both blocking > operations and poll(2). It's intended to be a minimal interface for > allowing a program to wait for the exit of a process that is not one > of its children. > > Why might we want this interface? Android's lmkd kills processes in > order to free memory in response to various memory pressure > signals. It's desirable to wait until a killed process actually exits > before moving on (if needed) to killing the next process. Since the > processes that lmkd kills are not lmkd's children, lmkd currently > lacks a way to wait for a proces to actually die after being sent > SIGKILL; today, lmkd resorts to polling the proc filesystem pid
Any idea why it needs to wait and then send SIGKILL? Why not do SIGKILL and look for errno == ESRCH in a loop with a delay.
> entry. This interface allow lmkd to give up polling and instead block > and wait for process death.
Can we use ptrace(2) for the exit notifications? I am assuming you already though about it but I'm curious what is the reason this is better.
thanks,
-Joel
| |