From: "Paul E. McKenney" <paulmck@linux.ibm.com>
To: "Theodore Y. Ts'o" <tytso@mit.edu>,
"Joel Fernandes (Google)" <joel@joelfernandes.org>,
linux-kernel@vger.kernel.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>,
Steven Rostedt <rostedt@goodmis.org>,
pantin@google.com
Subject: Re: [PATCH RFC 0/5] rcu doc updates for whatisRCU and checklist
Date: Fri, 5 Oct 2018 20:45:40 -0700 [thread overview]
Message-ID: <20181006034540.GM2674@linux.ibm.com> (raw)
In-Reply-To: <20181005234628.GB2548@thunk.org>
On Fri, Oct 05, 2018 at 07:46:28PM -0400, Theodore Y. Ts'o wrote:
> On Fri, Oct 05, 2018 at 04:18:09PM -0700, Joel Fernandes (Google) wrote:
> >
> > Here are this week's rcu doc updates based on combing through whatisRCU and
> > checklists. Hopefully you agree with them. I left several old _bh and _sched
> > API references as is, since I don't think its a good idea to remove them till
> > the APIs themselves are removed, however I did remove several of them as well
> > (like in the first patch in this series) since I feel its better to "encourage"
> > new users not to use the old API.
>
> Hi Joel,
>
> As it so happens, I just recently wrote my first RCU patch[1] (file
> systems, especially on-disk data structures, generally tend not to be
> good candidates for RCU semantics).
>
> [1] http://patchwork.ozlabs.org/patch/979779/
Very cool!
One question... In the following hunk:
------------------------------------------------------------------------
@@ -5353,9 +5362,13 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
#ifdef CONFIG_QUOTA
sbi->s_jquota_fmt = old_opts.s_jquota_fmt;
for (i = 0; i < EXT4_MAXQUOTAS; i++) {
- kfree(sbi->s_qf_names[i]);
- sbi->s_qf_names[i] = old_opts.s_qf_names[i];
+ to_free[i] = rcu_dereference_protected(sbi->s_qf_names[i],
+ &sb->s_umount);
+ rcu_assign_pointer(sbi->s_qf_names[i], old_opts.s_qf_names[i]);
}
+ for (i = 0; i < EXT4_MAXQUOTAS; i++)
+ kfree(to_free[i]);
+ synchronize_rcu();
#endif
kfree(orig_data);
return err;
------------------------------------------------------------------------
Shouldn't the synchronize_rcu() precede the loop doing the kfree()
calls? Or am I missing something subtle?
Otherwise, looks good! I was worried that seq_show_option() might
sleep, but it looks like it is just putting characters into an
array. If there is lingering concern, CONFIG_PROVE_LOCKING will
usually catch that sort of thing.
Thanx, Paul
> So if you are working on improving RCU documentation, I thought I
> would give two comments on the RCU docs from the perspective of a
> developer trying to use RCU for the first time.
>
> * whatisRCU is great, but one the example in Section 3 uses
> rcu_dereference_protected() without explaining it. Given that using
> that function seems to be considered best practice, maybe a few more
> words there would be in order? That function isn't mentioned in
> rcu.txt either, BTW.
>
> * lockdep.txt *does* explain what rcu_dereference_protected() does,
> but it doesn't really describe lockdep_is_held(). You can mostly
> figure it out from context, but it wasn't obvious to me what locks
> it could be used against, and in the case of a rw_semaphore, whether
> it applied to shared as well as exclusive locks. That's a lockdep
> abstraction, and not a RCU abstraction, but lockdep isn't
> particularly well documented, so I ended up spending 20-30 minutes
> or so looking at the lockdep implementation before I was sure it
> actually worked the way I thought it was going to.
>
> Anyway, I was going to put submitting a patch to improve whatisRCU on
> my (vastly over-long) TODO list, but when I saw your patch set, I
> couldn't resist trying to see if I could fob it off on you. If you
> don't think that's fair (and it probably isn't really), just let me
> know, and I'll put it back on my todo list. :-)
>
> Cheers,
>
> - Ted
>
next prev parent reply other threads:[~2018-10-06 3:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-05 23:18 [PATCH RFC 0/5] rcu doc updates for whatisRCU and checklist Joel Fernandes (Google)
2018-10-05 23:18 ` [PATCH RFC 1/5] doc: rcu: Update core and full API in whatisRCU Joel Fernandes (Google)
2018-10-05 23:18 ` [PATCH RFC 2/5] doc: rcu: Add more rationale for using rcu_read_lock_sched in checklist Joel Fernandes (Google)
2018-10-05 23:18 ` [PATCH RFC 3/5] doc: rcu: Remove obsolete suggestion from checklist Joel Fernandes (Google)
2018-10-05 23:18 ` [PATCH RFC 4/5] doc: rcu: Remove obsolete checklist item about synchronize_rcu usage Joel Fernandes (Google)
2018-10-05 23:18 ` [PATCH RFC 5/5] doc: rcu: Encourage use of rcu_barrier in checklist Joel Fernandes (Google)
2018-10-05 23:46 ` [PATCH RFC 0/5] rcu doc updates for whatisRCU and checklist Theodore Y. Ts'o
2018-10-06 1:59 ` Joel Fernandes
2018-10-06 3:45 ` Paul E. McKenney [this message]
2018-10-06 4:40 ` Joel Fernandes
2018-10-06 22:47 ` Theodore Y. Ts'o
2018-10-06 4:50 ` Joel Fernandes
2018-10-06 5:34 ` Theodore Y. Ts'o
2018-10-06 16:49 ` Paul E. McKenney
2018-10-06 0:13 ` Paul E. McKenney
2018-10-06 2:10 ` Joel Fernandes
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=20181006034540.GM2674@linux.ibm.com \
--to=paulmck@linux.ibm.com \
--cc=corbet@lwn.net \
--cc=jiangshanlai@gmail.com \
--cc=joel@joelfernandes.org \
--cc=josh@joshtriplett.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=pantin@google.com \
--cc=rostedt@goodmis.org \
--cc=tytso@mit.edu \
/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).