From patchwork Wed Dec 11 11:22:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hillf Danton X-Patchwork-Id: 11284759 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C79614E3 for ; Wed, 11 Dec 2019 11:22:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 805B2214AF for ; Wed, 11 Dec 2019 11:22:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 805B2214AF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C2A7A6B31A7; Wed, 11 Dec 2019 06:22:45 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BDAC46B31A8; Wed, 11 Dec 2019 06:22:45 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AF0B46B31A9; Wed, 11 Dec 2019 06:22:45 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0055.hostedemail.com [216.40.44.55]) by kanga.kvack.org (Postfix) with ESMTP id 96BAE6B31A7 for ; Wed, 11 Dec 2019 06:22:45 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 460C7181AEF15 for ; Wed, 11 Dec 2019 11:22:45 +0000 (UTC) X-FDA: 76252623090.13.tail08_34f33c30e454f X-Spam-Summary: 2,0,0,c8999a335f6cc0f5,d41d8cd98f00b204,hdanton@sina.com,:linux-kernel@vger.kernel.org::hdanton@sina.com,RULES_HIT:41:355:379:800:960:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1539:1568:1711:1714:1730:1747:1777:1792:2393:2559:2562:2693:3138:3139:3140:3141:3142:3867:3871:5007:6119:6120:6261:7903:9592:9707:10004:11026:11334:11473:11537:11658:11914:12043:12297:13069:13211:13229:13311:13357:13894:14181:14384:14721:21080:21627:21740:21987:21990:30054,0,RBL:202.108.3.166:@sina.com:.lbl8.mailshell.net-62.50.2.100 64.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: tail08_34f33c30e454f X-Filterd-Recvd-Size: 1615 Received: from mail3-166.sinamail.sina.com.cn (mail3-166.sinamail.sina.com.cn [202.108.3.166]) by imf14.hostedemail.com (Postfix) with SMTP for ; Wed, 11 Dec 2019 11:22:43 +0000 (UTC) Received: from unknown (HELO localhost.localdomain)([221.219.0.244]) by sina.com with ESMTP id 5DF0D17F000117A3; Wed, 11 Dec 2019 19:22:41 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com X-SMAIL-MID: 19633554920004 From: Hillf Danton To: linux-kernel Cc: linux-mm , Hillf Danton Subject: [RFC 3/4] workqueue: reap dead pool workqueue on queuing work Date: Wed, 11 Dec 2019 19:22:29 +0800 Message-Id: <20191211112229.22652-1-hdanton@sina.com> In-Reply-To: <20191211104601.16468-1-hdanton@sina.com> References: MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.266419, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Release rcu lock to reap dead pool workqueue. Signed-off-by: Hillf Danton --- d/kernel/workqueue.c +++ e/kernel/workqueue.c @@ -1409,9 +1409,9 @@ static void __queue_work(int cpu, struct if (unlikely(wq->flags & __WQ_DRAINING) && WARN_ON_ONCE(!is_chained_work(wq))) return; - - rcu_read_lock(); retry: + rcu_read_lock(); + /* pwq which will be used unless @work is executing elsewhere */ if (wq->flags & WQ_UNBOUND) { if (req_cpu == WORK_CPU_UNBOUND) @@ -1458,6 +1458,7 @@ retry: if (unlikely(!pwq->refcnt)) { if (wq->flags & WQ_UNBOUND) { spin_unlock(&pwq->pool->lock); + rcu_read_unlock(); cpu_relax(); goto retry; }