Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3812310imd; Mon, 29 Oct 2018 12:46:25 -0700 (PDT) X-Google-Smtp-Source: AJdET5fYUJh2oq5VC58bqQw00HgcVC/rbZpYZt4y9cUfRWriwm+aaboEcBy5Z2rfXfdd9KV8Nna6 X-Received: by 2002:a63:82c6:: with SMTP id w189mr15249660pgd.344.1540842385787; Mon, 29 Oct 2018 12:46:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540842385; cv=none; d=google.com; s=arc-20160816; b=CxC5y4y9yBQqNKZz86xconjHfZxn/bIoz2dC61Fnp2QqIZvQw8huJ6DDB1TDE9J5zA d+arzpfP9q6OOqCSGZHqo/bX9wMT0gZEl3jcUfa7AfskuzwLiRZSeHwbl1XTxz5fBXw5 gX/O7PNqoDpiKIow08QFbPtZdBorJwoERO91bZ0W+p1XTjJL0Jt7zi1J01IiyvBH4IZN 1DbjUOUaGG48HZaDwx4S1eyzw2569WOcXygZH+oxxbTZ//33D97rYbIZvzwdvjGqNH2c 8nAYSdx/jak4p6U/1Et90rd+81ZSrBGiryAQhOU6SMehNHR3jFByH0ML3VvLnlM/oze0 AR3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=tJfEqvXjSJFZIKPMb7koFbsr5lcSz/UqGK41kz6HJuw=; b=QR9n39DfvFFQJ+x3RGy/KZXM6RIkzmqf+HGx7mWzfhf1z1BRVHCvBm/rgFfTDJkYMp qcKKJEQYL6+MO7NlsEnNk5WlAcUKYNjCcKEbHo+ehFtoWD0F03wj3caJpUQnICbstzr5 rvgXZPsT8BgzhTxyfxzlkksB2iue7c1rN1HVFMD6MWJOmPsdv3LXp9v7QhBvtaPIvCn4 9yWoWmxT2ZlxK5U6nF1RZ796dgec8SOZCKtWJ1kSE8FCY7gg0jTZg43KeuWm4VBmQNfr 3ZoyXhmUiHwY6WXhVwxPY+I+Hb5GbwB7HHGOfD6LW6l/244CEK+7v0ZAl9c8nreCY05O NzMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vwbJlGvK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15-v6si20953310pgl.117.2018.10.29.12.46.09; Mon, 29 Oct 2018 12:46:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vwbJlGvK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726788AbeJ3Efr (ORCPT + 99 others); Tue, 30 Oct 2018 00:35:47 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:39155 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725911AbeJ3Efr (ORCPT ); Tue, 30 Oct 2018 00:35:47 -0400 Received: by mail-qt1-f196.google.com with SMTP id g10-v6so10742738qtq.6 for ; Mon, 29 Oct 2018 12:45:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tJfEqvXjSJFZIKPMb7koFbsr5lcSz/UqGK41kz6HJuw=; b=vwbJlGvKbhgGN4q3jCJCl/ZtI7GlE8sZ+f/JXUs6/miQoGCj7VkwjCSSR+slF+cG/l 5F9zXSkU/c2F7+vOibpZmDG8Jf60FVCORuYPCnK53oVdg5wMwuBQlywIlFAj+rU8mWYp yTt+wMR8lsfYOLpIZTSy4zwy6WTDK/d74s1uifZ87xdjLMCUptE/YXKgkAK+hpVvyYUx XLL+TYcFDHyyBoICf6Kbdo8/cOA3nPm0IzSyJO6/uTkFAXLk62HQcre6tNX07yXLfKul BQ2PjJe6+SXcdG57qQGZDUkZcoUkhznAipj9MVBLwTBVItKbqKsKRu1jik0F3Cfoveqa 8Lpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tJfEqvXjSJFZIKPMb7koFbsr5lcSz/UqGK41kz6HJuw=; b=Od0t8DRFNSYYbPWSyVAkN5WYzznt+4UK9Krg+t9i59oBjoJWvt5NBJrN/I+nI0cY1b nKSyoHmwmNxn4aNVqWAcgE8UV2bG5az3hfM6vrhUrPG4wWOrTaSUN90xCznPJsbruSuJ DE1TcvEJo5C1gAsFC7Aa9ReDUOqObDWpQOE5lIANoZ6jxughdHbUwQhY8vAjUwLb8H0+ cZ7UiOaKCPGNZJcbbjwA7FW0+e059sKvGeMIp7aQfsCGvKtHI22b0N3rg1+Z3eJZM5q5 gJDKv04GajfiyU4YS8nHhQren3ut36BAOt5nI5n2qMvDEfMf+1li+pYNPbaAWHsmnr7I ZBzQ== X-Gm-Message-State: AGRZ1gJK7V4r1ikfwKShIBI+1rL9AMbjLqxZHbpwyeZ1sE0ersLvp5u2 awvoMWcN3SzbrVZ/cpCuNCsNLtsiycQZXD7RG9n3EQ== X-Received: by 2002:a0c:b137:: with SMTP id q52mr14200970qvc.58.1540842338982; Mon, 29 Oct 2018 12:45:38 -0700 (PDT) MIME-Version: 1.0 References: <20181029175322.189042-1-dancol@google.com> In-Reply-To: <20181029175322.189042-1-dancol@google.com> From: Joel Fernandes Date: Mon, 29 Oct 2018 12:45:25 -0700 Message-ID: Subject: Re: [RFC PATCH] Minimal non-child process exit notification support To: Daniel Colascione Cc: LKML , Tim Murray Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 29, 2018 at 10:53 AM Daniel Colascione 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