Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp471280yba; Fri, 12 Apr 2019 07:15:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWzYWw96jEeIPqNDks41LIYvaZQoCNJ+EzqZc0Gy+y2j8JzgA5gAop/IL7L7bl4aDdr8EC X-Received: by 2002:a17:902:8d89:: with SMTP id v9mr57462085plo.230.1555078543681; Fri, 12 Apr 2019 07:15:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555078543; cv=none; d=google.com; s=arc-20160816; b=iY51lF/rC6Ako8/Y10yPyS9pQkjr+ny2YbQkvuyXBW68nNqN1VUMAA+1apHDL2e7Vw ZZdG919xPjYDxajo7g7tgQ/uZXEqilonkTwLKiik2rpbcjsh2AcH2qJ3xrEX6/hiWgnb YDOIUkJmGtKXgAwNpFbG7V6r2MSo7zRzQjnoJQkxpvbUeIE7pU+cK/VcuTEUg8+1XzF9 +Ejlo6WY4WTFJ7vZTIjDDeLraAevai1ORE+nxq30MjF0jn2OKCft4hgjUglo+H6sX6xr fqbWuMvAf0lpdfRoYPir/3JJCH+IBvTKRxWkY0tqyJBLoxNQr/2a6BgcbHqN/ODzHldp J1Eg== 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=pRoGxbJdzk5VSz+J5WZP/kt+pljWluiqtLQrAx6TCuI=; b=tJd86EaFfgFp8sCS7IoLaoj/L/D05hIEPcez0aNDmzXkgJbz8mOG/5Bp3AACQRLFfp ZkrmK5PbQl+xq0LbSIHbe/u8dNDi3f7fgF3OLD19HJ0k7CI5cGDYe5ZB/ORkf80hohcV Zm1VW9oO/0tRxKx3byHXTqUda5gqcCqAKPmY8sgSEmV9LY2mz0fyQt/WRCiDx3DDuZ+J mjHirJr3kmTVOKzmh5HxiLE3Q8wEAlwqE6ZzvxqGvLaeI79oLnm5qg38dZqIAQ6atHbP rY0gkIRwMSye36Tu/nwEr817C3urbs2klTAq2uCDR3E6qnyv0yc7NAG8aQ7jlfFeNhcB Dlww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=I2y8SRdd; 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 r39si38841348pld.10.2019.04.12.07.15.27; Fri, 12 Apr 2019 07:15:43 -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=I2y8SRdd; 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 S1727042AbfDLOOo (ORCPT + 99 others); Fri, 12 Apr 2019 10:14:44 -0400 Received: from mail-vs1-f67.google.com ([209.85.217.67]:46674 "EHLO mail-vs1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726711AbfDLOOn (ORCPT ); Fri, 12 Apr 2019 10:14:43 -0400 Received: by mail-vs1-f67.google.com with SMTP id e2so5594862vsc.13 for ; Fri, 12 Apr 2019 07:14:43 -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=pRoGxbJdzk5VSz+J5WZP/kt+pljWluiqtLQrAx6TCuI=; b=I2y8SRddDRNqAugRlPVyKaj1bSoHn3ghQl8DCaK1P1dXAsIS/lng2hR+VeAdB8hLex tb6tZ3i7e6rvBriPoLAs4UCeEHrYLuX17Op3KMmub0c6rb3hrU4KwK/oVCPDCJTqaJU3 08DVZHhKgWljH8seJAKg9vLBdNH9RWvwil0OKY8Zkp/jyHmCeNEZ690BPyl+Obg56vbL M17lF+LdnoDqy8nXNH78D8o7OPJnodT+tCOv02Y7hhfmZ2zaggvO4EZD7Q2D1xyWn/kN PdjWyQajqDa6Gy4M+89LjMYNqhqMaMihQlTT/QoE/i2MA4eoYHJugVFqrj8UuW5csK3C hf2A== 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=pRoGxbJdzk5VSz+J5WZP/kt+pljWluiqtLQrAx6TCuI=; b=I0R/YiiNOUDTI7M88IRAO81r2Gm07pXBKLsBFAZvWbgclQJN5eFETMNHfVjIikl6sY ZL7cllkVVUGQmsUH2NyFKR37kEAzYSOx+45SKikBgmJ0BgHShiFStBF0gngn/df207ei wltM3J0rLPuAl/F/4c4qMMbtbpll+F9czXlhg413uWE3KFQSYq0L3tIYtPMZrDRFwF0x +hQz8iDu456wiNBdERffgIBlu58YRRK9CinakGfj5CkPjwLgogNZstHTjPeKrOPuu4o3 fajxD0L3LW4yk38VNM7rF8y7/gN3j2xeBRdzVUer/Mt6wcaLmXu+neckrB5/SyF38Fpq 41VQ== X-Gm-Message-State: APjAAAVULYL+l6PvN/WzzYP13YB0I1rY07tWSPwkFzfTx9g6VoRDT/7X m8zz8m6D39BHzyYXvLTAnj1GY3qkZlhTgTCkYY5eIQ== X-Received: by 2002:a67:6847:: with SMTP id d68mr31562611vsc.90.1555078482224; Fri, 12 Apr 2019 07:14:42 -0700 (PDT) MIME-Version: 1.0 References: <20190411014353.113252-1-surenb@google.com> <20190411014353.113252-3-surenb@google.com> <20190411153313.GE22763@bombadil.infradead.org> <20190412065314.GC13373@dhcp22.suse.cz> In-Reply-To: <20190412065314.GC13373@dhcp22.suse.cz> From: Daniel Colascione Date: Fri, 12 Apr 2019 07:14:30 -0700 Message-ID: Subject: Re: [RFC 2/2] signal: extend pidfd_send_signal() to allow expedited process killing To: Michal Hocko Cc: Matthew Wilcox , Suren Baghdasaryan , Andrew Morton , David Rientjes , yuzhoujian@didichuxing.com, Souptick Joarder , Roman Gushchin , Johannes Weiner , Tetsuo Handa , "Eric W. Biederman" , Shakeel Butt , Christian Brauner , Minchan Kim , Tim Murray , Joel Fernandes , Jann Horn , linux-mm , lsf-pc@lists.linux-foundation.org, linux-kernel , Android Kernel Team 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 Thu, Apr 11, 2019 at 11:53 PM Michal Hocko wrote: > > On Thu 11-04-19 08:33:13, Matthew Wilcox wrote: > > On Wed, Apr 10, 2019 at 06:43:53PM -0700, Suren Baghdasaryan wrote: > > > Add new SS_EXPEDITE flag to be used when sending SIGKILL via > > > pidfd_send_signal() syscall to allow expedited memory reclaim of the > > > victim process. The usage of this flag is currently limited to SIGKILL > > > signal and only to privileged users. > > > > What is the downside of doing expedited memory reclaim? ie why not do it > > every time a process is going to die? > > Well, you are tearing down an address space which might be still in use > because the task not fully dead yeat. So there are two downsides AFAICS. > Core dumping which will not see the reaped memory so the resulting Test for SIGNAL_GROUP_COREDUMP before doing any of this then. If you try to start a core dump after reaping begins, too bad: you could have raced with process death anyway. > coredump might be incomplete. And unexpected #PF/gup on the reaped > memory will result in SIGBUS. It's a dying process. Why even bother returning from the fault handler? Just treat that situation as a thread exit. There's no need to make this observable to userspace at all.