public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chandan Babu R <chandan.babu@oracle.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: linux-xfs@vger.kernel.org, Dave Chinner <dchinner@redhat.com>,
	david@fromorbit.com, djwong@kernel.org
Subject: Re: [PATCH V2 1/5] xfsprogs: introduce liburcu support
Date: Sat, 25 Sep 2021 15:54:07 +0530	[thread overview]
Message-ID: <87a6k12bso.fsf@debian-BULLSEYE-live-builder-AMD64> (raw)
In-Reply-To: <41a4a5e6-c58e-97e7-666b-d1205ed0604f@sandeen.net>

On 25 Sep 2021 at 03:21, Eric Sandeen wrote:
> On 9/24/21 9:09 AM, Chandan Babu R wrote:
>> From: Dave Chinner <dchinner@redhat.com>
>> The upcoming buffer cache rework/kerenl sync-up requires atomic
>> variables. I could use C++11 atomics build into GCC, but they are a
>> pain to work with and shoe-horn into the kernel atomic variable API.
>> Much easier is to introduce a dependency on liburcu - the userspace
>> RCU library. This provides atomic variables that very closely match
>> the kernel atomic variable API, and it provides a very similar
>> memory model and memory barrier support to the kernel. And we get
>> RCU support that has an identical interface to the kernel and works
>> the same way.
>> Hence kernel code written with RCU algorithms and atomic variables
>> will just slot straight into the userspace xfsprogs code without us
>> having to think about whether the lockless algorithms will work in
>> userspace or not. This reduces glue and hoop jumping, and gets us
>> a step closer to having the entire userspace libxfs code MT safe.
>> Signed-off-by: Dave Chinner <dchinner@redhat.com>
>> [chandan.babu@oracle.com: Add m4 macros to detect availability of liburcu]
>
> Thanks for fixing that up. I had tried to use rcu_init like Dave originally
> had, and I like that better in general, but I had trouble with it - I guess
> maybe it gets redefined based on memory model magic and the actual symbol
> "rcu_init" maybe isn't available? I didn't dig very much.

Yes, rcu_init() gets defined to one of the variants of userspace rcu. Hence
there is no function named rcu_init().

>
> Also, dumb question from me - how do we know where we need the
> rcu_[un]register_thread() calls? Will it be obvious if we miss it
> in the future?  "each thread must invoke this function before its
> first call to rcu_read_lock() or call_rcu()."

Unfortunately, I don't think there is an obvious method to detect if calls to
rcu_[un]register_thread() is missing from any code changes implemented in the
future.

PS: I am no expert at RCU. My knowledge about RCU is limited to what I could
learn by reading articles on the world wide web.

-- 
chandan

  reply	other threads:[~2021-09-25 10:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-24 14:09 [PATCH V2 0/5] xfsprogs: generic serialisation primitives Chandan Babu R
2021-09-24 14:09 ` [PATCH V2 1/5] xfsprogs: introduce liburcu support Chandan Babu R
2021-09-24 21:51   ` Eric Sandeen
2021-09-25 10:24     ` Chandan Babu R [this message]
2021-09-25 23:05     ` Dave Chinner
2021-09-27 18:48       ` Eric Sandeen
2021-09-29 20:46   ` Eric Sandeen
2021-09-24 14:09 ` [PATCH V2 2/5] libxfs: add spinlock_t wrapper Chandan Babu R
2021-09-24 22:06   ` Eric Sandeen
2021-09-24 14:09 ` [PATCH V2 3/5] atomic: convert to uatomic Chandan Babu R
2021-09-24 22:13   ` Eric Sandeen
2021-09-25 10:26     ` Chandan Babu R
2021-09-25 23:15     ` Dave Chinner
2021-09-25 23:18       ` Eric Sandeen
2021-09-25 23:49         ` Dave Chinner
2021-09-24 14:09 ` [PATCH V2 4/5] libxfs: add kernel-compatible completion API Chandan Babu R
2021-09-24 23:02   ` Eric Sandeen
2021-09-25 10:29     ` Chandan Babu R
2021-09-27 20:33       ` Darrick J. Wong
2021-09-27 20:55       ` Dave Chinner
2021-09-24 14:09 ` [PATCH V2 5/5] libxfs: add wrappers for kernel semaphores Chandan Babu R

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=87a6k12bso.fsf@debian-BULLSEYE-live-builder-AMD64 \
    --to=chandan.babu@oracle.com \
    --cc=david@fromorbit.com \
    --cc=dchinner@redhat.com \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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