Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp235260img; Thu, 21 Mar 2019 18:54:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2dW5PIiVYidwBf82chiKlmAHmbwCrPwNzBBBMblkTu9XNe1IChvYMS51UlMHODVhyyauY X-Received: by 2002:a17:902:1008:: with SMTP id b8mr6673549pla.120.1553219648516; Thu, 21 Mar 2019 18:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553219648; cv=none; d=google.com; s=arc-20160816; b=ftVFmTDxG6LIA6prMrBdUfqIwh0HvSxNNmXBFJv7L37mcj/Z3W+g+oKtfCrmsMFr1n mQkwehMmQk9a0LAcPo/yB2fr6ki5wN4Xbz9VTYy8GhesLjhE6Yq1Qr4YbEJrPGXK1/F2 jQ32zLhhA1gemzX1DzFiZx1hdU/qG39hcw3HHIMgndeBQh2Jjw3nWvEh8o95oeMssx6M SH94wLVzx5Gf1YmSChyO3DU58FKUKaXNbyzjOaUSdoogkv4COk8fkQmWUn1Dbhy8WEm+ h9yXjuD6B51WqMGZvNHhyp5Bz8HPtNxbC2xD7kXVCBSjIJmUF99daBcyxQCXWAHU8UAx oOGw== 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=40NWW8wLR1ruw4bwc6cScxdYZkXDr2Pxr9BdklVtdM4=; b=YB6x5IuiSWJmuUIju3psZ4AGhb37+a0EtIQCMLvYZZKXIxIRn4c8zJ/FnrdqAZfbCV gi6++iUczmmr6hDmx0iFJ90QChwr6r2JufbimtJ8HmDcoVtQZ7hOLExIcFfi4DJCeL/R qmpVxzjHrG3Tw4zAGjJEZuZa8FIFUNrNu/dIUWCJu9C3+LONRPm41kllbdLMCylVIqQi U4v0XADxAGTipir6/q1imzv65cnguN9hkRlU0pyfQ33hCGm5mZnMavoO0zA4gNoQk7fo NoNAjC7YhcOHYJ/ydIBjIdKiMJbTUIDvHncQxr5QtQipJk/JeLH9JDCG4MKd51RLuI3N /yDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=JUvjG7dL; 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 134si5591730pfz.274.2019.03.21.18.53.50; Thu, 21 Mar 2019 18:54:08 -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=JUvjG7dL; 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 S1727586AbfCVBw5 (ORCPT + 99 others); Thu, 21 Mar 2019 21:52:57 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:55670 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727484AbfCVBw5 (ORCPT ); Thu, 21 Mar 2019 21:52:57 -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=40NWW8wLR1ruw4bwc6cScxdYZkXDr2Pxr9BdklVtdM4=; b=JUvjG7dL+Zhx0nDTZf6CzESCk +hW90ni/TULy5MPA+m+P9k1P0lD1verHqsYtRH64fANL3gDMoggs0scCQ9XL+RyWZ9s1obr+PzENn qA6Nwqtw3zbfAh+4X1UOQQZh+2XiQhbjDDNesOkrwx0ar8AmidhxBEOpEIIntbmxAFE9RDInqxVal u+U9tQOOWgAizuJmzF2JsVlLzOAmY+kB0McsfWT7AgjGTbf2Udwzoq1sbbM49hO0ywY4FVwoZ2c0f MKPMwdJSLSqttRzikdI4hiJqUD+Tbi7SMwrjYQ8/wc8kPZWxsNyy0ZwH3ZkDDoUB/+ME2jiEVf73Z eis8n0MkQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1h79Lt-0002cG-4i; Fri, 22 Mar 2019 01:52:09 +0000 Date: Thu, 21 Mar 2019 18:52:08 -0700 From: Matthew Wilcox To: Waiman Long Cc: Andrew Morton , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , linux-kernel@vger.kernel.org, linux-mm@kvack.org, selinux@vger.kernel.org, Paul Moore , Stephen Smalley , Eric Paris , "Peter Zijlstra (Intel)" , Oleg Nesterov Subject: Re: [PATCH 2/4] signal: Make flush_sigqueue() use free_q to release memory Message-ID: <20190322015208.GD19508@bombadil.infradead.org> References: <20190321214512.11524-1-longman@redhat.com> <20190321214512.11524-3-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190321214512.11524-3-longman@redhat.com> 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, Mar 21, 2019 at 05:45:10PM -0400, Waiman Long wrote: > It was found that if a process had many pending signals (e.g. millions), > the act of exiting that process might cause its parent to have a hard > lockup especially on a debug kernel with features like KASAN enabled. > It was because the flush_sigqueue() was called in release_task() with > tasklist_lock held and irq disabled. This rather apocalyptic language is a bit uncalled for. I appreciate the warning is scary, but all that's really happening is that the debug code is taking too long to execute. > To avoid this dire condition and reduce lock hold time of tasklist_lock, > flush_sigqueue() is modified to pass in a freeing queue pointer so that > the actual freeing of memory objects can be deferred until after the > tasklist_lock is released and irq re-enabled. I think this is a really bad solution. It looks kind of generic, but isn't. It's terribly inefficient, and all it's really doing is deferring the debugging code until we've re-enabled interrupts. We'd be much better off just having a list_head in the caller and list_splice() the queue->list onto that caller. Then call __sigqueue_free() for each signal on the queue.