From patchwork Thu Dec 12 09:15:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hillf Danton X-Patchwork-Id: 11287671 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 03432930 for ; Thu, 12 Dec 2019 09:16:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DB8E22465A for ; Thu, 12 Dec 2019 09:16:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB8E22465A 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 285386B36BD; Thu, 12 Dec 2019 04:16:03 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 235F16B36BE; Thu, 12 Dec 2019 04:16:03 -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 1731D6B36BF; Thu, 12 Dec 2019 04:16:03 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0096.hostedemail.com [216.40.44.96]) by kanga.kvack.org (Postfix) with ESMTP id 00A076B36BD for ; Thu, 12 Dec 2019 04:16:02 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id A217F5DD4 for ; Thu, 12 Dec 2019 09:16:02 +0000 (UTC) X-FDA: 76255932564.02.blood17_177921a90ca14 X-Spam-Summary: 2,0,0,743e2a8f7f17ceb6,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:1437:1515:1534:1540:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2903:3138:3139:3140:3141:3142:3352:3865:3867:3868:3871:3872:3874:4321:5007:6119:6261:9707:10004:11026:11334:11473:11537:11658:11914:12043:12297:12438:12555:12679:13069:13161:13229:13311:13357:13894:14096:14181:14384:14721:21080:21324:21451:21627:21740:30054,0,RBL:202.108.3.18:@sina.com:.lbl8.mailshell.net-62.18.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:24,LUA_SUMMARY:none X-HE-Tag: blood17_177921a90ca14 X-Filterd-Recvd-Size: 1628 Received: from r3-18.sinamail.sina.com.cn (r3-18.sinamail.sina.com.cn [202.108.3.18]) by imf04.hostedemail.com (Postfix) with SMTP for ; Thu, 12 Dec 2019 09:16:00 +0000 (UTC) Received: from unknown (HELO localhost.localdomain)([221.219.0.244]) by sina.com with ESMTP id 5DF2054C00017008; Thu, 12 Dec 2019 17:15:58 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com X-SMAIL-MID: 31530815073449 From: Hillf Danton To: linux-kernel Cc: linux-mm , Hillf Danton Subject: [RFC] workqueue: fix detecting reentrance Date: Thu, 12 Dec 2019 17:15:48 +0800 Message-Id: <20191212091548.21668-1-hdanton@sina.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.416943, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: If we can find a valid worker that is serving the specified work at the moment then the worker itself is enough to ensure reentrance and workqueue doesn't matter here because it is permitted for a work to requeue itself either on different cpu or numa node or even on another workqueue. Fixes: c9178087acd7 ("workqueue: perform non-reentrancy test when queueing to unbound workqueues too") Fixes: 18aa9effad4a ("workqueue: implement WQ_NON_REENTRANT") Signed-off-by: Hillf Danton --- f/kernel/workqueue.c +++ g/kernel/workqueue.c @@ -1433,7 +1433,7 @@ retry: worker = find_worker_executing_work(last_pool, work); - if (worker && worker->current_pwq->wq == wq) { + if (worker) { pwq = worker->current_pwq; } else { /* meh... not running there, queue here */