From: Joel Fernandes <joel@joelfernandes.org>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Uladzislau Rezki <urezki@gmail.com>,
"Theodore Y. Ts'o" <tytso@mit.edu>,
Ext4 Developers List <linux-ext4@vger.kernel.org>,
Suraj Jitindar Singh <surajjs@amazon.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RFC] ext4: fix potential race between online resizing and write operations
Date: Mon, 24 Feb 2020 21:11:31 -0500 [thread overview]
Message-ID: <20200225021131.GC253171@google.com> (raw)
In-Reply-To: <20200223011018.GB2935@paulmck-ThinkPad-P72>
On Sat, Feb 22, 2020 at 05:10:18PM -0800, Paul E. McKenney wrote:
[...]
> > I was thinking a 2 fold approach (just thinking out loud..):
> >
> > If kfree_call_rcu() is called in atomic context or in any rcu reader, then
> > use GFP_ATOMIC to grow an rcu_head wrapper on the atomic memory pool and
> > queue that.
> >
> > Otherwise, grow an rcu_head on the stack of kfree_call_rcu() and call
> > synchronize_rcu() inline with it.
> >
> > Use preemptible() andr task_struct's rcu_read_lock_nesting to differentiate
> > between the 2 cases.
> >
> > Thoughts?
>
> How much are we really losing by having an rcu_head in the structure,
> either separately or unioned over other fields?
It does seem a convenient API at first glance. Also seems like there are a
number of usecases now (ext4, vfree that Vlad mentioned, and all the other
users he mentioned, etc).
> > > > Also there is one more open question what to do if GFP_ATOMIC
> > > > gets failed in case of having low memory condition. Probably
> > > > we can make use of "mempool interface" that allows to have
> > > > min_nr guaranteed pre-allocated pages.
> > >
> > > But we really do still need to handle the case where everything runs out,
> > > even the pre-allocated pages.
> >
> > If *everything* runs out, you are pretty much going to OOM sooner or later
> > anyway :D. But I see what you mean. But the 'tradeoff' is RCU can free
> > head-less objects where possible.
>
> Would you rather pay an rcu_head tax (in cases where it cannot share
> with other fields), or would you rather have states where you could free
> a lot of memory if only there was some memory to allocate to track the
> memory to be freed?
Depends on the usecase we could use the right API.
> But yes, as you suggested above, there could be an API similar to the
> userspace RCU library's API that usually just queues the callback but
> sometimes sleeps for a full grace period. If enough people want this,
> it should not be hard to set up.
Sounds good!
thanks,
- Joel
next prev parent reply other threads:[~2020-02-25 2:11 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200215233817.GA670792@mit.edu>
[not found] ` <20200216121246.GG2935@paulmck-ThinkPad-P72>
[not found] ` <20200217160827.GA5685@pc636>
[not found] ` <20200217193314.GA12604@mit.edu>
2020-02-18 17:08 ` [PATCH RFC] ext4: fix potential race between online resizing and write operations Uladzislau Rezki
2020-02-20 4:52 ` Theodore Y. Ts'o
2020-02-21 0:30 ` Paul E. McKenney
2020-02-21 13:14 ` Uladzislau Rezki
2020-02-21 20:22 ` Paul E. McKenney
2020-02-22 22:24 ` Joel Fernandes
2020-02-23 1:10 ` Paul E. McKenney
2020-02-24 17:40 ` Uladzislau Rezki
2020-02-25 2:07 ` Joel Fernandes
2020-02-25 3:55 ` Paul E. McKenney
2020-02-25 14:17 ` Joel Fernandes
2020-02-25 16:38 ` Paul E. McKenney
2020-02-25 17:00 ` Joel Fernandes
2020-02-25 18:54 ` Uladzislau Rezki
2020-02-25 22:47 ` Paul E. McKenney
2020-02-26 13:04 ` Uladzislau Rezki
2020-02-26 15:06 ` Paul E. McKenney
2020-02-26 15:53 ` Uladzislau Rezki
2020-02-27 14:08 ` Joel Fernandes
2020-03-01 11:13 ` Uladzislau Rezki
2020-02-27 13:37 ` Joel Fernandes
2020-03-01 11:08 ` Uladzislau Rezki
2020-03-01 12:07 ` Uladzislau Rezki
2020-02-25 2:11 ` Joel Fernandes [this message]
2020-02-21 12:06 ` Joel Fernandes
2020-02-21 13:28 ` Joel Fernandes
2020-02-21 19:21 ` Uladzislau Rezki
2020-02-21 19:25 ` Uladzislau Rezki
2020-02-22 22:12 ` Joel Fernandes
2020-02-24 17:02 ` Uladzislau Rezki
2020-02-24 23:14 ` Paul E. McKenney
2020-02-25 1:48 ` 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=20200225021131.GC253171@google.com \
--to=joel@joelfernandes.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=surajjs@amazon.com \
--cc=tytso@mit.edu \
--cc=urezki@gmail.com \
/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).