Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3088061ybl; Sun, 11 Aug 2019 15:14:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhDu0kiQZv9MPn5yHDe3VMMb/9OLJdW7suwTSycu2b2jb6mUXHaV8HOOHUWE++ocT1YZfo X-Received: by 2002:a17:90a:b30f:: with SMTP id d15mr13017839pjr.19.1565561642555; Sun, 11 Aug 2019 15:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565561642; cv=none; d=google.com; s=arc-20160816; b=F2D5FRx49RoM0l3k7dnWShaH0sPQx23DKCUSXE0t6HznfQsPT8MyoQ+knSBkQZhqpS ULl0RVYlq7qH9LTcDovdSm+e0XNRyF1Qb3C3Qy2SeufF9jp1ICnzhn/1nN3OcDGF71XE TJB8cIy947EcJTirdLx5jwwsq0wPKwhYcGxNPpBNIScaqEhwpi/RxF0sWwaFMAFOv4Ka IFZQ3JAYglLI4+tPvy4K6krOoGlzH80k7LAbp0HGZ+5iSAKoNG5M22FkZ71AGJZAQVra TEe9kr49ywNJNTSHvDM9rcogTw03+iOA/g5YUOGicAnB4UG/Pil0qM/dCHEjiJiO7dUE ywug== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Jg1q7sKCNt8sI7DQNayH9inWmrGqOZwwN13K5ONIY4Q=; b=ZrLt1Le6/Sktyo7Svih1fxo1OKxzA669roUPbCE/V3/VkxP8ejC212xHvKkXCq6Xkn 436y9+zglQ20mMmAaxilcWrCDUTQ/IBfxGU1Cs4xHyqUyaCkO8gC2wDIxtjXxyI0SHGH Ro/48Hx3LpYV8HxnwFAdxKn1RV4K8fvb2T9ciLYR/9ei18r1bI9+k6m5dhqjiSeJPXtk 9uYvFqpF1ELZHtgGKb879RCA/wSnFXR9cUm7AC/8ajx+0wBeBySAGK9zheR2DW7sbdNi 5eIP0hRHPnZ90oItB3yxpFUrzlsBxNIIuCU8M8hk47D0QLX7rDfrwdHPUYnIHplQigcF 317g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=RNMJIQZo; 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 t17si27864348pgu.48.2019.08.11.15.13.14; Sun, 11 Aug 2019 15:14:02 -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; dkim=pass header.i=@joelfernandes.org header.s=google header.b=RNMJIQZo; 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 S1726566AbfHKWLa (ORCPT + 99 others); Sun, 11 Aug 2019 18:11:30 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:41762 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726500AbfHKWLa (ORCPT ); Sun, 11 Aug 2019 18:11:30 -0400 Received: by mail-pg1-f195.google.com with SMTP id x15so38158864pgg.8 for ; Sun, 11 Aug 2019 15:11:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Jg1q7sKCNt8sI7DQNayH9inWmrGqOZwwN13K5ONIY4Q=; b=RNMJIQZoGD+AKdhoRPPti5I51AMHvV5mYDXKAJvWLLTIXhov2hAB/mlubzCGJZZvqN jdFGMPAG0ui/vmgBiTmzrK1TSmtU4Ff8BsjO/AOMv/ogYfOTU7XEwv4oYwpoynaUuXlz FB+/0/PFQfK8A6SidEG+2RrPrN0tWz6fx7rwE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Jg1q7sKCNt8sI7DQNayH9inWmrGqOZwwN13K5ONIY4Q=; b=SBOpQCZdBRjISY5OI4aNrm5QO4bOpwb9eTveq957LfpiTSRPgrjS1Jzk3UwtRgzbnn bkLuTFnH4DiHlOSRGnKzL8d04zB+Ab6PWbRtLVRrwIsxBFrUDt4tQltFr9FEqHdcsod3 LmHUorZrScq1AglZ7+ub1Hr8MvZgxlR+oGyDCqQy4PjQbiSQ9ampjLF6ShNofLS+cfX/ gIUMQQNPCVaYBK+koKPE5pzhojQZmH6qz49cFxJYl9P/vyH8A8Hd8VQjXWNODTyI3Bm9 c06EP6dJcAMMhb6Eabg9nsq2vfNzXmCmLmBM6p9SLox2vAdumv1+bK1/fxd0symLjXRl czhw== X-Gm-Message-State: APjAAAUk7wjgjSpjvhGBx6zipxZKolV33tVRMDiYVyTUYUejBH+S+eCX TEZ8BIHq4w1Dx5cjV73bi0uBKq7t9E0= X-Received: by 2002:a62:e901:: with SMTP id j1mr33444864pfh.189.1565561489050; Sun, 11 Aug 2019 15:11:29 -0700 (PDT) Received: from joelaf.cam.corp.google.com ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id n10sm31376428pgv.67.2019.08.11.15.11.25 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 11 Aug 2019 15:11:27 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , Greg Kroah-Hartman , Jonathan Corbet , Josh Triplett , Lai Jiangshan , linux-doc@vger.kernel.org, Mathieu Desnoyers , "Paul E. McKenney" , "Rafael J. Wysocki" , rcu@vger.kernel.org, Steven Rostedt , Tejun Heo Subject: [PATCH 1/3] workqueue: Convert for_each_wq to use built-in list check (v2) Date: Sun, 11 Aug 2019 18:11:09 -0400 Message-Id: <20190811221111.99401-1-joel@joelfernandes.org> X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org list_for_each_entry_rcu now has support to check for RCU reader sections as well as lock. Just use the support in it, instead of explicitly checking in the caller. Signed-off-by: Joel Fernandes (Google) --- kernel/workqueue.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 601d61150b65..e882477ebf6e 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -364,11 +364,6 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq); !lockdep_is_held(&wq_pool_mutex), \ "RCU or wq_pool_mutex should be held") -#define assert_rcu_or_wq_mutex(wq) \ - RCU_LOCKDEP_WARN(!rcu_read_lock_held() && \ - !lockdep_is_held(&wq->mutex), \ - "RCU or wq->mutex should be held") - #define assert_rcu_or_wq_mutex_or_pool_mutex(wq) \ RCU_LOCKDEP_WARN(!rcu_read_lock_held() && \ !lockdep_is_held(&wq->mutex) && \ @@ -425,9 +420,8 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq); * ignored. */ #define for_each_pwq(pwq, wq) \ - list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node) \ - if (({ assert_rcu_or_wq_mutex(wq); false; })) { } \ - else + list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node, \ + lock_is_held(&(wq->mutex).dep_map)) #ifdef CONFIG_DEBUG_OBJECTS_WORK -- 2.23.0.rc1.153.gdeed80330f-goog