Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1896919ybn; Thu, 26 Sep 2019 03:59:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4T+VqzWsf3sqvWRrKSBnjTdLDuj8C9xP7zZWTsBwIFp6/vOSP0AAJeVYsBUP5JYJEyYI9 X-Received: by 2002:a50:8ad1:: with SMTP id k17mr2833951edk.243.1569495588947; Thu, 26 Sep 2019 03:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569495588; cv=none; d=google.com; s=arc-20160816; b=a2aoT0YMn6CMieAnx/ZIRtIuNV4UkYMo3YNESh1RyladYPdHD5NtVSkSM38gx1fXHW hoBXMGwA3mlRRVzs27pzCK5DwwkqWe5cnCgjs58how5PGzWu1CvPJICVGtlOnrRpcsud o5BljgPDgFfQOdCjI3GZGAAYPZ3tXFOpnJuv7NPlqg2AIHjEnXWu0il6Vj/FOnGiIJqh 9/oE1iW+2htr6Nu/dxsGHtHevhIEmQcntIhsdf18U3WVLkai54nEZkiYHTgTzv0Cnfmd QchW5GD/f582+AptsW0WdLShLYQsPv0ImaASdi+qMv06u+xnJacdsKMw5Yw1noS6c+e7 +khQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:subject :from:cc:to; bh=w2WFZ3e5dOIr/sWOTS/hGComwe/BTCo1RZl1Bvleevg=; b=0XhUonzxsLOnipgVy1P2wtHYoYgMzHs7rek88yFM3rG0WBArC0TbZlNprXvuJM9D7O rH1rqjwW6uQn5vw2hjdkw+YZ1h0HiYcy0CnfVgyGl8jfOcJ5GC7ini5+I4QxOZHFeQJx gVMFbGPQGYR/H+CtWF45j5go7Nk71gZWIwdfXJFEYce1ECRDgEVRjDos+/2LTUkF8a8v 0lq0aCScV5a2KjJqtkAPuy05TFbTcETq9AInymJr8PmCKk6KAhnsNlopcemmaKq0HlIL 1nFGyYUYXtD0A6F4z3KFFaPgume674uwAYTjdrj1PxBKQwtb5NS1Gu7rUsuh/Zc8jkc3 n9sg== ARC-Authentication-Results: i=1; mx.google.com; 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 n9si791559ejk.158.2019.09.26.03.59.25; Thu, 26 Sep 2019 03:59:48 -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; 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 S1728982AbfIZIlZ (ORCPT + 99 others); Thu, 26 Sep 2019 04:41:25 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2787 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726925AbfIZIlZ (ORCPT ); Thu, 26 Sep 2019 04:41:25 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 48A8CE50F4E61526E17C; Thu, 26 Sep 2019 16:41:20 +0800 (CST) Received: from [127.0.0.1] (10.177.251.225) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.439.0; Thu, 26 Sep 2019 16:41:18 +0800 To: Alexander Duyck , "gregkh@linuxfoundation.org" , , , , "tglx@linutronix.de" , CC: "linux-kernel@vger.kernel.org" From: Yunfeng Ye Subject: [PATCH] async: Using current_work() to implement current_is_async() Message-ID: <395617ec-ef92-c20f-d5c1-550b47a07f6d@huawei.com> Date: Thu, 26 Sep 2019 16:40:52 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.251.225] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org current_is_async() can be implemented using current_work(), it's better not to be aware of the workqueue's internal information. Signed-off-by: Yunfeng Ye --- kernel/async.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/async.c b/kernel/async.c index 1de270d..a849f98 100644 --- a/kernel/async.c +++ b/kernel/async.c @@ -53,8 +53,6 @@ asynchronous and synchronous parts of the kernel. #include #include -#include "workqueue_internal.h" - static async_cookie_t next_cookie = 1; #define MAX_WORK 32768 @@ -327,8 +325,8 @@ EXPORT_SYMBOL_GPL(async_synchronize_cookie); */ bool current_is_async(void) { - struct worker *worker = current_wq_worker(); + struct work_struct *work = current_work(); - return worker && worker->current_func == async_run_entry_fn; + return work && work->func == async_run_entry_fn; } EXPORT_SYMBOL_GPL(current_is_async); -- 2.7.4