Re: [PATCH v3 3/7] KVM: pfncache: Us e RCU for readers instead of a rwlock
David Woodhouse <[email protected]>
| Newsgroups | org.kernel.vger.rcu,org.kernel.vger.kvm |
|---|---|
| Message-ID | <[email protected]> |
On 9 August 2026 16:24:14 BST, Uladzislau Rezki <[email protected]> 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.