Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp796011yba; Fri, 12 Apr 2019 14:05:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqysUJ1DfsHJaJ5Ut4crwZhGTEFhD/fzzilx4b9v9PvDbJ3ONMhd1zzvlaP5PuBU7ZCQyxKB X-Received: by 2002:a62:6fc6:: with SMTP id k189mr41073254pfc.154.1555103114165; Fri, 12 Apr 2019 14:05:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555103114; cv=none; d=google.com; s=arc-20160816; b=CwKzTaftvPcnMkbDU9zJMkq7i6gNwUoThOhCGohI84JqyhwgnpFCVLRk8lt3/2MDtk Mufk0ew0aIiMHPZcE8PNrdAX3J1vwjA9jG/CaYcDbSG7k7Lym/wZH/NumC29yteuuZ01 hPkCJN1+wTwzXQ5DY1EcKGn1Qkmhnl0PDqD/HwK/lgWcMBFu8jEAfaIo0WrPBCH7gRNg 9all+eJzC2jnxZfefU2ydQi7MqBTL0zhtfpJkeZE8k0PqMCKUhw3ob+zieebPf8MIvAi 6xeNdzsXPf1m4t7x5RhNAxvvEoYhFkRNOyOHt6ml+syWPkKuavClEK+D8M5EAvXju5tl HTrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=47f99Mo+hydUFa/g/RdJ33gOWoAsO4NFmnQJgCAGVXk=; b=ISGTUFVFwVu0wLzehSEgpyH2fDubmI6UZyRX2Zwn819wysUl3lXSIuibLB3K/pchiN YfbOVzWr9oDCI6/MC2jOsxASQLDTBHqXOFA/E6f5NPXvhi+dD41AE65yrJl+uhWzQws/ EVI0g9I2P7ijPP0feIJcbOU1bYXIbI9ka2finGRSpo6YLDWKhsu8xzJPCI7cmCX5Ic3c cg14yJOyKXBE22L3W75syUr8bfhUT8QJJB5+FpCkL18nXwVvf6ZdKgFUdl9wkt944/eK EGgoUD/2jA+fBBuooDkOIAxJS5KQu4aqosqRwZeXhMbyFUZH9P5fl2BeBj9yl80wJPUj HYnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=hNryO1YE; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k15si4511008pfg.202.2019.04.12.14.04.55; Fri, 12 Apr 2019 14:05:14 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=hNryO1YE; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726974AbfDLVEO (ORCPT + 99 others); Fri, 12 Apr 2019 17:04:14 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:40124 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726905AbfDLVEO (ORCPT ); Fri, 12 Apr 2019 17:04:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=47f99Mo+hydUFa/g/RdJ33gOWoAsO4NFmnQJgCAGVXk=; b=hNryO1YEnoE8oEpdDtnRTm8cf JQ8mTLNe6qyVi3NbhxLCX4hE+lVbiJMP8XxnqGIS/wy4lodGJ2uSCJOLKMN2YHDKO91vuKZWTqu/7 jAUw3bgOhP8ucd+59v2q08TyCmpbK3hoQu7Ma9sb9owgfQHqDycjvAJuyzGkR1gLoRfb+ozgtYE/S knL+iMLMxk+X79PVU1BCkGVacxHq1o1iyHAdYaGbDrI7BxLgxN5Zygn/+RH4yxLRBIuuZIjJLdObd SjlkiVbsVlWMecRw3ZfbM64obc731htiPKdvWq2HUCiEmix3qnPZzmUnlNCl1+mNjYo7MyJInnBNE QE151ghYw==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1hF3L1-0004EH-RX; Fri, 12 Apr 2019 21:03:55 +0000 Date: Fri, 12 Apr 2019 14:03:55 -0700 From: Matthew Wilcox To: Daniel Colascione Cc: Suren Baghdasaryan , Andrew Morton , Michal Hocko , 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, LKML , kernel-team Subject: Re: [RFC 2/2] signal: extend pidfd_send_signal() to allow expedited process killing Message-ID: <20190412210355.GC899@bombadil.infradead.org> References: <20190411014353.113252-1-surenb@google.com> <20190411014353.113252-3-surenb@google.com> <20190411153313.GE22763@bombadil.infradead.org> <20190411173649.GF22763@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) 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 10:47:50AM -0700, Daniel Colascione wrote: > On Thu, Apr 11, 2019 at 10:36 AM Matthew Wilcox wrote: > > It's not a question of the kernel deciding what the right signal is. > > The kernel knows whether a signal is fatal to a particular process or not. > > The question is whether the killing process should do the work of reaping > > the dying process's resources sometimes, always or never. Currently, > > that is never (the process reaps its own resources); Suren is suggesting > > sometimes, and I'm asking "Why not always?" > > FWIW, Suren's initial proposal is that the oom_reaper kthread do the > reaping, not the process sending the kill. Are you suggesting that > sending SIGKILL should spend a while in signal delivery reaping pages > before returning? I thought about just doing it this way, but I didn't > like the idea: it'd slow down mass-killing programs like killall(1). > Programs expect sending SIGKILL to be a fast operation that returns > immediately. Suren said that the implementation in this proposal wasn't to be taken literally. You've raised some good points here though. Do mass-killing programs like kill with a pgid or killall expect the signal-sending process to be fast, or do they not really care? From the kernel's point of view, the same work has to be done, no matter whether the killer or the victim does it. Should the work be accounted to the killer or the victim? It probably doesn't matter. The victim doing the work allows for parallelisation, but I'm not convinced that's important either. I see another advantage for the killer doing the work -- if the task is currently blocking on I/O (eg to an NFS mount that has gone away), the killer can get rid of the task's page tables. If we have to wait for the I/O to complete before the victim reaps its own page tables, we may be waiting forever.