From patchwork Wed Dec 18 03:59:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hillf Danton X-Patchwork-Id: 11299463 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 BA6B713B6 for ; Wed, 18 Dec 2019 04:00:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6E62A20715 for ; Wed, 18 Dec 2019 04:00:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6E62A20715 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 0B7A68E00C9; Tue, 17 Dec 2019 23:00:01 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 067618E0079; Tue, 17 Dec 2019 23:00:01 -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 EE6618E00C9; Tue, 17 Dec 2019 23:00:00 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0192.hostedemail.com [216.40.44.192]) by kanga.kvack.org (Postfix) with ESMTP id DB1B88E0079 for ; Tue, 17 Dec 2019 23:00:00 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 7993E824999B for ; Wed, 18 Dec 2019 04:00:00 +0000 (UTC) X-FDA: 76276908960.07.sun00_5729f8c456e57 X-Spam-Summary: 2,0,0,3c88e824433296df,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:1541:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3867:3868:3872:5007:6261:9592:9707:10004:11026:11334:11473:11537:11658:11914:12043:12297:12438:13069:13138:13231:13311:13357:13894:14096:14181:14384:14721:21080:21627:21740:21990:30054,0,RBL:202.108.3.19:@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: sun00_5729f8c456e57 X-Filterd-Recvd-Size: 1832 Received: from r3-19.sinamail.sina.com.cn (r3-19.sinamail.sina.com.cn [202.108.3.19]) by imf18.hostedemail.com (Postfix) with SMTP for ; Wed, 18 Dec 2019 03:59:58 +0000 (UTC) Received: from unknown (HELO localhost.localdomain)([221.219.0.244]) by sina.com with ESMTP id 5DF9A43A000285BA; Wed, 18 Dec 2019 11:59:56 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com X-SMAIL-MID: 44216315073454 From: Hillf Danton To: linux-kernel Cc: linux-mm , Hillf Danton Subject: [RFC] workqueue: dexpose worker Date: Wed, 18 Dec 2019 11:59:45 +0800 Message-Id: <20191218035945.16180-1-hdanton@sina.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.322132, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: It does not make much sense to expose worker, workqueue's internal object, to outsiders, and whatever field inside worker as well. Nor does worker pool rather than workqueue and work. Signed-off-by: Hillf Danton --- a/kernel/workqueue_internal.h +++ b/kernel/workqueue_internal.h @@ -69,6 +69,13 @@ static inline struct worker *current_wq_ return NULL; } +static inline bool current_is_executing(work_func_t func) +{ + struct worker *worker = current_wq_worker(); + + return worker && worker->current_func == func; +} + /* * Scheduler hooks for concurrency managed workqueue. Only to be used from * sched/ and workqueue.c. --- a/kernel/async.c +++ b/kernel/async.c @@ -327,8 +327,6 @@ EXPORT_SYMBOL_GPL(async_synchronize_cook */ bool current_is_async(void) { - struct worker *worker = current_wq_worker(); - - return worker && worker->current_func == async_run_entry_fn; + return current_is_executing(async_run_entry_fn); } EXPORT_SYMBOL_GPL(current_is_async);