Thread (138 messages) 138 messages, 17 authors, 2022-09-08

Re: [RFC PATCH 03/30] Lazy percpu counters

From: Kent Overstreet <kent.overstreet@linux.dev>
Date: 2022-09-01 15:43:47
Also in: io-uring, linux-arch, linux-bcache, linux-iommu, linux-mm, lkml, xen-devel

On Thu, Sep 01, 2022 at 10:48:39AM -0400, Steven Rostedt wrote:
On Thu, 1 Sep 2022 10:32:19 -0400
Kent Overstreet [off-list ref] wrote:
quoted
On Thu, Sep 01, 2022 at 08:51:31AM +0200, Peter Zijlstra wrote:
quoted
On Tue, Aug 30, 2022 at 02:48:52PM -0700, Suren Baghdasaryan wrote:  
quoted
+static void lazy_percpu_counter_switch_to_pcpu(struct raw_lazy_percpu_counter *c)
+{
+	u64 __percpu *pcpu_v = alloc_percpu_gfp(u64, GFP_ATOMIC|__GFP_NOWARN);  
Realize that this is incorrect when used under a raw_spinlock_t.  
Can you elaborate?
All allocations (including GFP_ATOMIC) grab normal spin_locks. When
PREEMPT_RT is configured, normal spin_locks turn into a mutex, where as
raw_spinlock's do not.

Thus, if this is done within a raw_spinlock with PREEMPT_RT configured, it
can cause a schedule while holding a spinlock.
Thanks, I think we should be good here but I'll document it anyways.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help