Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2252282ybl; Thu, 15 Aug 2019 08:52:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVtly2LYcToJmHMiPVErithVyaLPg7aWcECWmstLGOXyzQE96B6d2R1m48AiHjLS+sy9td X-Received: by 2002:a17:902:28c9:: with SMTP id f67mr4974646plb.19.1565884322128; Thu, 15 Aug 2019 08:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565884322; cv=none; d=google.com; s=arc-20160816; b=mTqqqaLlPbJlLM/bnbAg8UDPGLd0HUdj0FFBc1oKuiPEcaZUJe/nrf4dYvqM5s9UE3 dcDVLGGuMmWRIcOBaDQkua9C0mibRx0EgeZENgYHlqWiS/1uPHVwgZqWa9rArtvl1YLa N6QQlATq0yoWRe1GQYnoS3PM++rDtu48FcsKbHEZFV547vbFRHL4St0gwhi0MwGi5Br+ 5PhMOzZ2PijhhsQ+IKD9/btDKguiNw95lREV0IPEkL0whjPmt4uiT2Vt6cY61BRYSnF4 QujmGNOCe9YJncNj1gHHU0LqAY3inoOfkTMfLdXB1AxaTz5ABQqdWQJ6SdQRUzzHOCtA xJcQ== 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=/HAVtRJ1PsEuTkAUc5sMbDf7NKx2+25/4sGFjK/yLmI=; b=GKoRLg/g4niAXSrWgZb6nEO1/qENUamgfYQpsZDde8PMkbwWQ/1Symw93aGd79ketJ G0sZWeOUb5zImXSE7qxeTLcGzeglsGJYq9ib9SniOPpE38IYfXYc03sG1QXCT0toVA8a VSnJ1J0jksD6LtMwKFe9LoeEAW4Bi2zSngKaBFLIf9AGvN5z9b1u/WRJZGbygMPrOE+9 kYRc0Om27IBS+ZPoktfcnJa/6rDoySPK3uZkTczfS7sFk6n25bjBuC4DfqdVQVPcQRt5 u4sxxj2nCLtCXXppduy+spTPoatlRnDc5taBypwIA8ncTInYJLV2ZstLxj8ifYodhy8E qm3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b="p/rcF9HU"; 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 a22si1188863pjv.56.2019.08.15.08.51.47; Thu, 15 Aug 2019 08:52: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="p/rcF9HU"; 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 S1729273AbfHOPZB (ORCPT + 99 others); Thu, 15 Aug 2019 11:25:01 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:35547 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729151AbfHOPZB (ORCPT ); Thu, 15 Aug 2019 11:25:01 -0400 Received: by mail-pg1-f193.google.com with SMTP id n4so1447479pgv.2 for ; Thu, 15 Aug 2019 08:25:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/HAVtRJ1PsEuTkAUc5sMbDf7NKx2+25/4sGFjK/yLmI=; b=p/rcF9HUaxokqqtlBD6cRzMqVS5aMb26xsT8XFZesE6GelXE2agrxezh39Oeg+hfGB xAvaausfSkZJetZST//O1oxgq4aGZkjqemfeRnMo4W7+ZZ/erzX1F6adVqpbB+c90m3Q V99zTMJqa9vfT5ucEAHWnJZ1WQ+Mn9yRvzAIw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=/HAVtRJ1PsEuTkAUc5sMbDf7NKx2+25/4sGFjK/yLmI=; b=cwGvKg+dQ75AUq78A8SjgQbH9J/DiVDc9XDU4g6HmIhgLhfxegnnNT+K9pQaWfJjEu 8Za71edrDRTqvQeLnpCLFwfiDU/y4wpD9tlYqw8ceKOZ4vJuX2QP1IB1n0T+EqefkzPH GkiTC+hrgJMPo0MBTMsF69v4FJF6YflJhP/6tdqyC9rN0omLwUIkpmkzHYIH91ymg02M kuqt8jfVw8FkNxtuh/VaO1JrKRu/Nab/CFngP7ZSDFN9/keeOuCzNPOIBVRpcaWOSSip Oe/s6y16u1VHvSRDgm9c6MTQsJs1adi/xBbfzKIbgQNW2IK9ATyR+Ovdu4En7z1XfWpw s0hg== X-Gm-Message-State: APjAAAX7h0h5J/2VSwo9NACqCNklkF5abBqAvy5JZZ/QoZzHIx864s5h AeQZAjiHCoCRMJ01UgJwDiwaWA== X-Received: by 2002:a17:90a:a489:: with SMTP id z9mr2679120pjp.24.1565882700049; Thu, 15 Aug 2019 08:25:00 -0700 (PDT) Received: from localhost ([172.19.216.18]) by smtp.gmail.com with ESMTPSA id k6sm3082851pfi.12.2019.08.15.08.24.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2019 08:24:59 -0700 (PDT) Date: Thu, 15 Aug 2019 11:24:42 -0400 From: Joel Fernandes To: Matthew Wilcox 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: <20190815152442.GB12078@google.com> References: <20190815141842.GB20599@google.com> <20190815145749.GA18474@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190815145749.GA18474@bombadil.infradead.org> User-Agent: Mutt/1.10.1 (2018-07-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 07:57:49AM -0700, Matthew Wilcox wrote: > 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? Could be. But that should be a different patch. I am only cleaning up the RCU list lockdep checking in this series since the series introduces that concept). Please feel free to send a patch for the same. Arguably, keeping the macro around also can be beneficial in the future. > 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)); Makes sense. This API also does sparse checking. Also hopefully no sparse issues show up because rcu_dereference_check() but anyone such issues should be fixed as well. thanks, - Joel >