Re: [PATCH v2 1/1] psi: stop relying on timer_pending for poll_work rescheduling

From
Suren Baghdasaryan <surenb@google.com>
Date
2021-07-01 16:28:19
Also in
linux-mediatek, lkml
Reply to
Peter Zijlstra, 2021-07-01
On Thu, Jul 1, 2021 at 9:12 AM Peter Zijlstra [off-list ref] wrote:
On Thu, Jul 01, 2021 at 09:09:25AM -0700, Suren Baghdasaryan wrote:
quoted
On Thu, Jul 1, 2021 at 1:59 AM Peter Zijlstra [off-list ref] wrote:
quoted
On Wed, Jun 30, 2021 at 01:51:51PM -0700, Suren Baghdasaryan wrote:
quoted
+     /* cmpxchg should be called even when !force to set poll_scheduled */
+     if (atomic_cmpxchg(&group->poll_scheduled, 0, 1) && !force)
              return;
Why is that a cmpxchg() ?
We want to set poll_scheduled and proceed with rescheduling the timer
unless it's already scheduled, so cmpxchg helps us to make that
decision atomically. Or did I misunderstand your question?
What's wrong with: atomic_xchg(&group->poll_scheduled, 1) ?
Yes, since poll_scheduled can be only 0 or 1 atomic_xchg should work
fine here. Functionally equivalent but I assume atomic_xchg() is more
efficient due to no comparison.
Will respin v3 if the rest looks ok.
--
To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (11 messages) 11 messages, 3 authors, last reply 2021-07-07
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help