From: Uladzislau Rezki <urezki@gmail.com>
To: Joel Fernandes <joel@joelfernandes.org>
Cc: Uladzislau Rezki <urezki@gmail.com>,
paulmck@kernel.org, linux-kernel@vger.kernel.org,
rcu@vger.kernel.org
Subject: Re: [PATCH v2] rcu/kfree: Do not request RCU when not needed
Date: Thu, 17 Nov 2022 14:43:53 +0100 [thread overview]
Message-ID: <Y3Y6mU5WUqbxfunf@pc636> (raw)
In-Reply-To: <938BD0DD-9F91-44E6-BCBA-3DA3FA6779C0@joelfernandes.org>
On Thu, Nov 17, 2022 at 08:23:30AM -0500, Joel Fernandes wrote:
>
>
> > On Nov 17, 2022, at 8:11 AM, Uladzislau Rezki <urezki@gmail.com> wrote:
> >
> > On Thu, Nov 17, 2022 at 08:06:21AM -0500, Joel Fernandes wrote:
> >>
> >>
> >>>> On Nov 17, 2022, at 7:58 AM, Uladzislau Rezki <urezki@gmail.com> wrote:
> >>>
> >>> On Wed, Nov 16, 2022 at 10:05:46PM +0000, Joel Fernandes wrote:
> >>>>> On Wed, Nov 16, 2022 at 7:19 PM Uladzislau Rezki <urezki@gmail.com> wrote:
> >>>>>
> >>>>> Hello, Paul, Joel.
> >>>>>
> >>>>>>>
> >>>>>>> Yes sure, I am doing a run now with my patch. However, I have a
> >>>>>>> question -- why do you feel blocking in the kworker is not an issue?
> >>>>>>> You are taking a snapshot before queuing the normal kwork and then
> >>>>>>> reading the snapshot when the normal kwork runs. Considering it is a
> >>>>>>> high priority queue, the delay between when you are taking the
> >>>>>>> snapshot, and reading it is likely small so there is a bigger chance
> >>>>>>> of blocking in cond_synchronize_rcu(). Did I miss something?
> >>>>>>>
> >>>>>> We can wait indeed in the reclaim worker. But the worker does not do any
> >>>>>> nasty or extra work here. If there is a need we block and wait. After a
> >>>>>> grace period, we are awoken and proceed.
> >>>>>>
> >>>>>> Therefore i do not see the reason in handling two cases:
> >>>>>>
> >>>>>> if (gp_done)
> >>>>>> queue_work();
> >>>>>> else
> >>>>>> queue_rcu_work();
> >>>>>>
> >>>>>> it is the same if we just queue the work and check on entry. The current
> >>>>>> scenario is: queue the work after a grace period. This is the difference.
> >>>>>>
> >>>>>> Right if the reclaimer was a high prio kthread a time would be shorter.
> >>>>>>
> >>>>>> In your scenario the time seems even shorter(i have not checked) because
> >>>>>> you update a snapshot of krcp each time a kvfree_rcu() is invoked. So
> >>>>>> basically even though you have objects whose grace period is passed you
> >>>>>> do not separate it anyhow. Because you update the:
> >>>>>>
> >>>>>> krcp->gp_snap = get_state_synchronize_rcu();
> >>>>>>
> >>>>>> too often.
> >>>>>>
> >>>>> Once upon a time we discussed that it is worth to keep track of GP
> >>>>> per-a-page in order to reduce a memory footprint. Below patch addresses
> >>>>> it:
> >>>>
> >>>> In the patch below, it appears you are tracking the GP per krwp, and
> >>>> not per page. But I could be missing something - could you split it
> >>>> into separate patches for easier review?
> >>>>
> >>> I will split. I was thinking about it. The GP is tracked per-a-page. As for
> >>> krwp it is only for channel_3. Everything goes there if no-page or no cache.
> >>>
> >> Ah, ok.
> >>
> >>>>
> >>>> Also it still does cond_synchronize_rcu() :-(
> >>>>
> >>> Sometimes we need to wait for a GP we can not just release :)
> >>
> >> You know that is not what I meant ;) I was concerned about the blocking.
> >>
> > Let me split. After that we/you can test and check if there is any issue
> > with sleeping on entry for waiting a GP if needed.
>
> Ack. What I’ll also do is, whenever you split it, I’ll put it on ChromeOS and see in real world, how many times we block. It could be I’m missing something of how polled GP works.
>
Good!
--
Uladzislau Rezki
next prev parent reply other threads:[~2022-11-17 13:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-09 2:47 [PATCH v2] rcu/kfree: Do not request RCU when not needed Joel Fernandes (Google)
2022-11-10 13:05 ` Uladzislau Rezki
[not found] ` <CAEXW_YSq89xzgyQ9Tdt1tCqz8VAfzb7kSXVZmnxDuJ65U0UZ3w@mail.gmail.com>
2022-11-10 14:01 ` Uladzislau Rezki
2022-11-11 1:56 ` Joel Fernandes
2022-11-14 12:20 ` Uladzislau Rezki
2022-11-14 16:17 ` Paul E. McKenney
2022-11-14 20:54 ` Joel Fernandes
2022-11-14 21:26 ` Paul E. McKenney
2022-11-15 12:05 ` Uladzislau Rezki
2022-11-14 20:49 ` Joel Fernandes
2022-11-15 13:07 ` Uladzislau Rezki
2022-11-16 19:19 ` Uladzislau Rezki
2022-11-16 22:05 ` Joel Fernandes
2022-11-17 12:58 ` Uladzislau Rezki
2022-11-17 13:06 ` Joel Fernandes
2022-11-17 13:11 ` Uladzislau Rezki
2022-11-17 13:23 ` Joel Fernandes
2022-11-17 13:43 ` Uladzislau Rezki [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-11-04 14:21 Joel Fernandes (Google)
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=Y3Y6mU5WUqbxfunf@pc636 \
--to=urezki@gmail.com \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.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