[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJWu+oro6rxxCdU7s00ZBhV0UZi6s8Cmupr1U9njo4cvhaqk9g@mail.gmail.com>
Date: Mon, 29 Oct 2018 12:47:57 -0700
From: Joel Fernandes <joelaf@...gle.com>
To: Daniel Colascione <dancol@...gle.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Tim Murray <timmurray@...gle.com>
Subject: Re: [RFC PATCH] Minimal non-child process exit notification support
On Mon, Oct 29, 2018 at 12:45 PM Joel Fernandes <joelaf@...gle.com> wrote:
>
> On Mon, Oct 29, 2018 at 10:53 AM Daniel Colascione <dancol@...gle.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.
>
Sorry I take that back, I see it needs to wait after sending the kill,
not before (duh). Anyway if the polling is ever rewritten, another way
could be to do kill(pid, 0) and then check for return of -1 and errno
== ESRCH; instead of looking at /proc/
Powered by blists - more mailing lists