Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2239533ybl; Thu, 15 Aug 2019 08:39:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+y/xoWEFSSYJOtc/CdJKxvYm6d7yzTP4gIrmaqg0Eu7/nst8Asd5NPRLyeVg2Sba4XOTb X-Received: by 2002:a17:90a:3ad0:: with SMTP id b74mr2739559pjc.79.1565883571410; Thu, 15 Aug 2019 08:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565883571; cv=none; d=google.com; s=arc-20160816; b=cONu/1ISWdhB884I3Cv8PUCr0iOeFcPWx+KS2zDDPifTRH4sJCk5rj4IUGaO3tjRS9 4mYgU1vS7jEOWBA3i8YKYLtpbDtpIi5KHd/6Hc+1CJauL/7kqJRh3QVrO/DA0cL/SIZO j1CGn7Dszh3wkHt1pT7VE6WYzTxf42vqgmipTs0+SYt3cIx9Yyz+jkb6fDTU7VG3BTW3 xxMeYJRoD53tPEio3jZiK3goFAn2ZlCZtstvkDvbAJH5XFlaB3Mp5TffeNA0Q7R4Ais3 khpfriyKuc0fKLDQM8O66qwXUWzSqwpvLjuwW7bnWAlT+2kN7eZcUK/J/5ZHXQZivjQw 7NiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=UtWqCtB9PpyWQIYQ9Bi5TbzICHIqvshf8py52+rLl2U=; b=I4xtGkts+bS4Sf02ln87GqffzO+qVByRJEWO5d7LuCA2itGMFPzxBOkAH+y82wjKFO djupeKX/Y1DR3z3PSxvls3ASCkK/cxqM8fm/E662ZR/EUtYX8YaZO4rL/TFhfL9CavXG jd2lU5/gAcRETKHeVGf0T2MxV6TYPksLV1STELdW7cQPchPvNzMTkH1+CEsbV1XDyodq kzvkZEWfexV73hAlTvcVs8qATZfi7yUDGENAg9PPBFkPFOLRQ3mDzKqyBuLloeMSqDYR w6mxPC08ea7CTVsoBDxgic/3KpIsws/A0nFRawFZeZHBLSShwmbzLuZIxG4NWGcfoiup EC3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="G4SzC/FI"; 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 t16si2368717pfq.88.2019.08.15.08.39.16; Thu, 15 Aug 2019 08:39:31 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="G4SzC/FI"; 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 S1732019AbfHOO5w (ORCPT + 99 others); Thu, 15 Aug 2019 10:57:52 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:53404 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728500AbfHOO5w (ORCPT ); Thu, 15 Aug 2019 10:57:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=UtWqCtB9PpyWQIYQ9Bi5TbzICHIqvshf8py52+rLl2U=; b=G4SzC/FI8VrUVgg7x5ogth9Nh eAj/6iV92t37KP0hcby0OvU4pn8r6qqwRQ+mDiAPDs4lpknfHrfHkvHqI9TSiRXds5/waTwwDGfHF meMxFAZEAl7Cf8B3VueEMtJ03PDeZzImMALQq+XqBrXv2Wh3O5SAROxdfXpLFnbEdDqoghvy+AKzz Aslj1+3wskB0Si6q83aZmd0wXVIj68QrgyZ0M7NabLUSPJ5Jun8mYQIMZueZUzaBuMtHc/Fm3Iw4v fgF6wXhvCpPTQdQMHPWud1FNTNvrq5cCkHtEImFxPIsqrSSwAHNS9ER9O9pSyPHqq6VmpUQ4hUGZ8 KPH0cs0qg==; Received: from willy by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hyHCH-0003uM-LN; Thu, 15 Aug 2019 14:57:49 +0000 Date: Thu, 15 Aug 2019 07:57:49 -0700 From: Matthew Wilcox To: "Joel Fernandes (Google)" Cc: linux-kernel@vger.kernel.org, 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: Re: [PATCH v3 -rcu] workqueue: Convert for_each_wq to use built-in list check Message-ID: <20190815145749.GA18474@bombadil.infradead.org> References: <20190815141842.GB20599@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190815141842.GB20599@google.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 15, 2019 at 10:18:42AM -0400, Joel Fernandes (Google) wrote: > 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. ... > #define assert_rcu_or_wq_mutex_or_pool_mutex(wq) \ > RCU_LOCKDEP_WARN(!rcu_read_lock_held() && \ > !lockdep_is_held(&wq->mutex) && \ Can't you also get rid of this macro? It's used in one place: static struct pool_workqueue *unbound_pwq_by_node(struct workqueue_struct *wq, int node) { assert_rcu_or_wq_mutex_or_pool_mutex(wq); /* * XXX: @node can be NUMA_NO_NODE if CPU goes offline while a * delayed item is pending. The plan is to keep CPU -> NODE * mapping valid and stable across CPU on/offlines. Once that * happens, this workaround can be removed. */ if (unlikely(node == NUMA_NO_NODE)) return wq->dfl_pwq; return rcu_dereference_raw(wq->numa_pwq_tbl[node]); } Shouldn't we delete that assert and use + return rcu_dereference_check(wq->numa_pwq_tbl[node], + lockdep_is_held(&wq->mutex) || + lockdep_is_held(&wq_pool_mutex));