Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp539220yba; Fri, 12 Apr 2019 08:32:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOkJHfsyh4tb2fzPKgXr42qiwH7nV38Fx5THYAfDmZDN3Wl70kAQC8R5eZOBm0nTEl+9XK X-Received: by 2002:a17:902:4501:: with SMTP id m1mr29560864pld.290.1555083148825; Fri, 12 Apr 2019 08:32:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555083148; cv=none; d=google.com; s=arc-20160816; b=k6Ag70nEemg9Ojnl8E3XfdwNZmwWnZZB8Uc2FrbdRxVyY8WRRYQX2JJ7IkBHqCarn/ YU3zqN9nwKyckzDJCFwBQYVWcO7EiqdE+zeFLsAEga1Bi1s4rgvgDFtQ84K3aj6SF6Vu 31himCdrKwBmZmxKxEoBSsus4VNz9fe0zJzvFRaEUepuWrnQAT/o4T2R6ps/ZB8xxqS+ t53Wm9WmAGr7CRDh72UD12QTjj2pe7YkujJm4/7M1CdQ6VmzUVJV30qs0gtqrp+PBaPP m/ATAQhWdRxIOgM6ioZatkjo/YHY4AFIaVccazY9wV66pKORZU6ng8UMkVVab1LMOAGj MSJQ== 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=WCeVpCJn+/VBqGO7SUvicv745LSiVr8/+6GQ6wCM828=; b=g1dhlJ3PxzYqoP0kWdP80yK7WOZP4M3ltKyOqWk/x5/T/1GWD0VfJHCMrG8LSCUgAz r75nR90aU3xF7OB+YjowxScQl7c/rkRDXvPJKU/CskyKZQZR7GgNJ+xT3AavIU3rVjGf ONX9LMw1f/oGvFKuL4fZH+vrUTbRbtfXE30BSBNmgXG26Ghe8y57FOAMw3mpqlIg6hAC P3FInRqjdFEU1gtSiNoJw3VaPlAKZpQ7Q4upvSiZcdTiOscJNT9JnN46sbI1n27KrKw+ kS0GL32ocn63ljGt4cPxu711DO5ZPaOB11lShfyK5306Er5JkHuJVyVtDcjjf1fjiHSz Gs7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tuVY75I6; 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 i10si38127214plb.384.2019.04.12.08.32.12; Fri, 12 Apr 2019 08:32:28 -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=tuVY75I6; 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 S1727345AbfDLPao (ORCPT + 99 others); Fri, 12 Apr 2019 11:30:44 -0400 Received: from mail-vs1-f66.google.com ([209.85.217.66]:37238 "EHLO mail-vs1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727337AbfDLPan (ORCPT ); Fri, 12 Apr 2019 11:30:43 -0400 Received: by mail-vs1-f66.google.com with SMTP id w13so5778236vsc.4 for ; Fri, 12 Apr 2019 08:30: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=WCeVpCJn+/VBqGO7SUvicv745LSiVr8/+6GQ6wCM828=; b=tuVY75I6tPrTGvJwWKarA/iYaQuwlcLQphJVG6VFjczrbRvlWFKr5CGKYTgboJF5+w LonhQj++DgJzMYXl/hrWXwkUDYM8ZVK69w1B1kHkx1q495XiDKpPZapStMILRzz2iWkQ 54R7AvDr8YJ1uRFdEzWYTFlsb6gfNrynNS2HdabUXQR2BQpccHxZ8wFHwY5p0+Lk3xCF pbNYktnRXpZbLNkEa+WAdTsvsWnq68E1Vn146Sn9zvgb6JlF7ESh8EPRcVnZxSZjPdO6 cNYdVsOYAqKiELuT+QU2qHFODxmHPMKMnAj+0S2Tq13iCgTgOg5FcXfNkb7P38ZhBUd1 ooXg== 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=WCeVpCJn+/VBqGO7SUvicv745LSiVr8/+6GQ6wCM828=; b=LBM7SG/MhqPs8iM+TwqwiX9/JL2bL/eHDqkLdT0/uirie/+6s8669M3F3lAm+e9kYY +ochl/f5x9Jnkf0mM0rlEn0WFc7X8X0/Wa+5RET76qvnJvo4ifGZ4eNp7zJc0tg6HwBp aP1hMWiRoKSEPbbJt+94Yer++2yahlKVv6bl1Pvn3kkBwlyO/RT0BtmR33S4jVSE+d5V 1J2q+B5Ctggw13JpDuxaYUgag+CIUsq9q/sf7CD1usXiMBsMueFgBA2xDCw+FwCVFmFj cO9RcMXnwxRJjYs0kBdQR5V+yyF4WuB7kqg99nej09Nk7GC/Tg/1jh+40im/9Cg39EkG wF3A== X-Gm-Message-State: APjAAAXMNZVAY9jME2bcTbJYhMAvlatOIAcpxEqYUwBb0rcNemx/Llay x2Ij6s+FoJu8/94mlkOC6Fj1yYVsvT44tPlFhAOFPA== X-Received: by 2002:a67:6847:: with SMTP id d68mr31850761vsc.90.1555083042000; Fri, 12 Apr 2019 08:30: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: From: Daniel Colascione Date: Fri, 12 Apr 2019 08:30: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 Fri, Apr 12, 2019 at 7:14 AM Daniel Colascione wrote: > > 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. Just for clarity, checking the code, I think we already do this. zap_other_threads sets SIGKILL pending on every thread in the group, and we'll handle SIGKILL in the process of taking any page fault or doing any system call, so I don't think it's actually possible for a thread in a dying process to observe the SIGBUS that reaping in theory can generate.