From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9F4DC43603 for ; Thu, 12 Dec 2019 09:16:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8CB24214D8 for ; Thu, 12 Dec 2019 09:16:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8CB24214D8 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) Received: by kanga.kvack.org (Postfix, from userid 40) id 235F16B36BE; Thu, 12 Dec 2019 04:16:03 -0500 (EST) 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-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-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 Content-Transfer-Encoding: quoted-printable 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 queuein= g 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: =20 worker =3D find_worker_executing_work(last_pool, work); =20 - if (worker && worker->current_pwq->wq =3D=3D wq) { + if (worker) { pwq =3D worker->current_pwq; } else { /* meh... not running there, queue here */