From: Uladzislau Rezki <urezki@gmail.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Uladzislau Rezki <urezki@gmail.com>,
paulmck@kernel.org, Sean Christopherson <seanjc@google.com>,
Boqun Feng <boqun@kernel.org>,
kvm@vger.kernel.org, rcu@vger.kernel.org
Subject: Re: [PATCH v3 3/7] KVM: pfncache: Use RCU for readers instead of a rwlock
Date: Mon, 10 Aug 2026 12:22:36 +0200 [thread overview]
Message-ID: <anmmbDqk5rfi_Gsx@milan> (raw)
In-Reply-To: <54244653-0825-4F1C-8852-003762176FE3@infradead.org>
On Sun, Aug 09, 2026 at 06:44:55PM +0100, David Woodhouse wrote:
> On 9 August 2026 16:24:14 BST, Uladzislau Rezki <urezki@gmail.com> wrote:
> >On Sun, Aug 09, 2026 at 10:59:59AM +0100, David Woodhouse wrote:
> >> + /*
> >> + * Try a non-blocking allocation first, leaving the spare untouched
> >> + * in the common no-pressure case so that it is still there when
> >> + * there really is pressure.
> >> + */
> >> + node = kzalloc_objs(*node, rcu_num_nodes, GFP_NOWAIT | __GFP_NOWARN);
> >>
> >GFP_NOWAIT already contains __GFP_NOWARN. It is odd.
>
> Ack, thanks. Will fix in my tree.
>
> >> + if (node)
> >> + return node;
> >> +
> >> + node = xchg(&srcu_spare_nodes, NULL);
> >> + if (node) {
> >> + schedule_work(&srcu_spare_replenish_work);
> >>
> >I am not sure but if there is a need in doing progress forward, probably
> >separate wq with WQ_MEM_RECLAIM | WQ_UNBOUND flags is better. It has an
> >extra rescue kthread to do the progress if no memory or high mem-pressure.
>
> I don't think there is a *need* per se, as all that happens is a few more less efficient grace periods before the allocation finally succeeds. And frankly, if memory pressure is that bad the efficiency of the grace periods is probably the least of your worries.
Probably. I was thinking about something like(example taken from driver.c):
<snip>
synchronize_srcu(&encl->srcu);
mmu_notifier_unregister(&encl_mm->mmu_notifier, encl_mm->mm);
kfree(encl_mm);
<snip>
i.e. when we need to free memory. We want a faster reclaim especially
when low memory conditions. From the other hand it looks like we do not
call quite often init_srcu_struct_nodes() from srcu_gp_end(), so no
strong opinion here.
--
Uladzislau Rezki
next prev parent reply other threads:[~2026-08-10 10:22 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 19:55 [PATCH v3 0/7] KVM: x86/xen: Fix Xen/GPC/PREEMPT_RT issues with rwlock_t Woodhouse, David
2026-08-05 19:55 ` [PATCH v3 1/7] KVM: pfncache: use a dedicated invalidation sequence for cache refresh Woodhouse, David
2026-08-05 19:55 ` [PATCH v3 2/7] mm/mmu_notifier: Remove non_block_start/end() from notifier invocation Woodhouse, David
2026-08-05 19:55 ` [PATCH v3 3/7] KVM: pfncache: Use RCU for readers instead of a rwlock Woodhouse, David
2026-08-05 20:36 ` sashiko-bot
2026-08-06 16:53 ` Sean Christopherson
2026-08-06 17:58 ` Woodhouse, David
2026-08-06 18:11 ` Sean Christopherson
2026-08-06 18:23 ` Woodhouse, David
2026-08-07 8:56 ` Woodhouse, David
2026-08-07 10:48 ` David Woodhouse
2026-08-06 20:38 ` David Woodhouse
2026-08-06 21:52 ` Paul E. McKenney
2026-08-06 22:02 ` David Woodhouse
2026-08-07 21:55 ` Paul E. McKenney
2026-08-08 7:09 ` David Woodhouse
2026-08-08 10:09 ` David Woodhouse
2026-08-08 17:58 ` Paul E. McKenney
2026-08-09 9:59 ` David Woodhouse
2026-08-09 15:24 ` Uladzislau Rezki
2026-08-09 17:44 ` David Woodhouse
2026-08-10 10:22 ` Uladzislau Rezki [this message]
2026-08-10 20:00 ` David Woodhouse
2026-08-05 19:55 ` [PATCH v3 4/7] KVM: x86/xen: Extract delivery of event to vCPU into a separate helper Woodhouse, David
2026-08-05 20:47 ` sashiko-bot
2026-08-05 22:35 ` David Woodhouse
2026-08-06 10:00 ` David Woodhouse
2026-08-06 14:32 ` David Woodhouse
2026-08-05 19:56 ` [PATCH v3 5/7] KVM: x86/xen: Explicitly tag "shared info" page as never being dirty tracked Woodhouse, David
2026-08-05 19:56 ` [PATCH v3 6/7] KVM: x86/xen: Don't dirty track "vCPU info" page Woodhouse, David
2026-08-05 19:56 ` [PATCH v3 7/7] KVM: x86: Use gfn_to_pfn_cache for steal time / preempted status Woodhouse, David
2026-08-05 21:15 ` sashiko-bot
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=anmmbDqk5rfi_Gsx@milan \
--to=urezki@gmail.com \
--cc=boqun@kernel.org \
--cc=dwmw2@infradead.org \
--cc=kvm@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=seanjc@google.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