From: Joel Fernandes <joel@joelfernandes.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jonathan Corbet <corbet@lwn.net>,
Josh Triplett <josh@joshtriplett.org>,
Lai Jiangshan <jiangshanlai@gmail.com>,
linux-doc@vger.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
"Paul E. McKenney" <paulmck@linux.ibm.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
rcu@vger.kernel.org, Steven Rostedt <rostedt@goodmis.org>,
Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH v3 -rcu] workqueue: Convert for_each_wq to use built-in list check
Date: Thu, 15 Aug 2019 11:24:42 -0400 [thread overview]
Message-ID: <20190815152442.GB12078@google.com> (raw)
In-Reply-To: <20190815145749.GA18474@bombadil.infradead.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
>
next prev parent reply other threads:[~2019-08-15 15:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-15 14:18 [PATCH v3 -rcu] workqueue: Convert for_each_wq to use built-in list check Joel Fernandes (Google)
2019-08-15 14:57 ` Matthew Wilcox
2019-08-15 15:24 ` Joel Fernandes [this message]
2019-08-16 16:45 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190815152442.GB12078@google.com \
--to=joel@joelfernandes.org \
--cc=corbet@lwn.net \
--cc=gregkh@linuxfoundation.org \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@linux.ibm.com \
--cc=rafael@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tj@kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).