* [Question] atomic_fetch_andnot() in nohz_idle_balance() @ 2018-11-21 22:34 Andrea Parri 2018-11-26 9:30 ` Peter Zijlstra 0 siblings, 1 reply; 6+ messages in thread From: Andrea Parri @ 2018-11-21 22:34 UTC (permalink / raw) To: Peter Zijlstra, Ingo Molnar, Vincent Guittot; +Cc: linux-kernel Hi, The comment for the atomic_fetch_andnot() in nohz_idle_balance() says: "barrier, pairs with nohz_balance_enter_idle(), ensures ..." which, well, does sound a note of warning... ;-) I see that nohz_balance_enter_idle() has an smp_mb__after_atomic() but the comment for the latter suggests that this barrier is pairing with the smp_mb() in _nohz_idle_balance(). So, what is the intended pairing barrier for the atomic_fetch_andnot()? what (which memory accesses) do you want "to order" here? Thanks, Andrea ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Question] atomic_fetch_andnot() in nohz_idle_balance() 2018-11-21 22:34 [Question] atomic_fetch_andnot() in nohz_idle_balance() Andrea Parri @ 2018-11-26 9:30 ` Peter Zijlstra 2018-11-26 11:37 ` Vincent Guittot 0 siblings, 1 reply; 6+ messages in thread From: Peter Zijlstra @ 2018-11-26 9:30 UTC (permalink / raw) To: Andrea Parri; +Cc: Ingo Molnar, Vincent Guittot, linux-kernel On Wed, Nov 21, 2018 at 11:34:53PM +0100, Andrea Parri wrote: > Hi, > > The comment for the atomic_fetch_andnot() in nohz_idle_balance() says: > > "barrier, pairs with nohz_balance_enter_idle(), ensures ..." > > which, well, does sound a note of warning... ;-) > > I see that nohz_balance_enter_idle() has an smp_mb__after_atomic() but > the comment for the latter suggests that this barrier is pairing with > the smp_mb() in _nohz_idle_balance(). > > So, what is the intended pairing barrier for the atomic_fetch_andnot()? > what (which memory accesses) do you want "to order" here? I can't seem to make sense of that comment either; the best I can come up with is that it would order the prior NOHZ_KICK_MASK load vs us then changing it. But that would order against kick_ilb(), not enter_idle. Vincent? ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Question] atomic_fetch_andnot() in nohz_idle_balance() 2018-11-26 9:30 ` Peter Zijlstra @ 2018-11-26 11:37 ` Vincent Guittot 2018-11-26 20:44 ` Andrea Parri 0 siblings, 1 reply; 6+ messages in thread From: Vincent Guittot @ 2018-11-26 11:37 UTC (permalink / raw) To: Peter Zijlstra; +Cc: andrea.parri, Ingo Molnar, linux-kernel On Mon, 26 Nov 2018 at 10:30, Peter Zijlstra <peterz@infradead.org> wrote: > > On Wed, Nov 21, 2018 at 11:34:53PM +0100, Andrea Parri wrote: > > Hi, > > > > The comment for the atomic_fetch_andnot() in nohz_idle_balance() says: > > > > "barrier, pairs with nohz_balance_enter_idle(), ensures ..." > > > > which, well, does sound a note of warning... ;-) > > > > I see that nohz_balance_enter_idle() has an smp_mb__after_atomic() but > > the comment for the latter suggests that this barrier is pairing with > > the smp_mb() in _nohz_idle_balance(). > > > > So, what is the intended pairing barrier for the atomic_fetch_andnot()? > > what (which memory accesses) do you want "to order" here? > > I can't seem to make sense of that comment either; the best I can come > up with is that it would order the prior NOHZ_KICK_MASK load vs us then > changing it. > > But that would order against kick_ilb(), not enter_idle. > > Vincent? I can't come with a good explanation. After looking into my email archive, the only explanation that i have is that the comments remains from a previous iteration of the feature that was based on a nohz.stats_state mechanism ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Question] atomic_fetch_andnot() in nohz_idle_balance() 2018-11-26 11:37 ` Vincent Guittot @ 2018-11-26 20:44 ` Andrea Parri 2018-11-27 9:01 ` Vincent Guittot 0 siblings, 1 reply; 6+ messages in thread From: Andrea Parri @ 2018-11-26 20:44 UTC (permalink / raw) To: Vincent Guittot; +Cc: Peter Zijlstra, Ingo Molnar, linux-kernel On Mon, Nov 26, 2018 at 12:37:00PM +0100, Vincent Guittot wrote: > On Mon, 26 Nov 2018 at 10:30, Peter Zijlstra <peterz@infradead.org> wrote: > > > > On Wed, Nov 21, 2018 at 11:34:53PM +0100, Andrea Parri wrote: > > > Hi, > > > > > > The comment for the atomic_fetch_andnot() in nohz_idle_balance() says: > > > > > > "barrier, pairs with nohz_balance_enter_idle(), ensures ..." > > > > > > which, well, does sound a note of warning... ;-) > > > > > > I see that nohz_balance_enter_idle() has an smp_mb__after_atomic() but > > > the comment for the latter suggests that this barrier is pairing with > > > the smp_mb() in _nohz_idle_balance(). > > > > > > So, what is the intended pairing barrier for the atomic_fetch_andnot()? > > > what (which memory accesses) do you want "to order" here? > > > > I can't seem to make sense of that comment either; the best I can come > > up with is that it would order the prior NOHZ_KICK_MASK load vs us then > > changing it. > > > > But that would order against kick_ilb(), not enter_idle. > > > > Vincent? > > I can't come with a good explanation. > After looking into my email archive, the only explanation that i have > is that the comments remains from a previous iteration of the feature > that was based on a nohz.stats_state mechanism I'm afraid I still can't help your comment... put in other terms, would you feel "unconfortable" with _relax()ing the andnot()? (and if so ...) Andrea ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Question] atomic_fetch_andnot() in nohz_idle_balance() 2018-11-26 20:44 ` Andrea Parri @ 2018-11-27 9:01 ` Vincent Guittot 2018-11-27 10:59 ` Andrea Parri 0 siblings, 1 reply; 6+ messages in thread From: Vincent Guittot @ 2018-11-27 9:01 UTC (permalink / raw) To: andrea.parri; +Cc: Peter Zijlstra, Ingo Molnar, linux-kernel On Mon, 26 Nov 2018 at 21:44, Andrea Parri <andrea.parri@amarulasolutions.com> wrote: > > On Mon, Nov 26, 2018 at 12:37:00PM +0100, Vincent Guittot wrote: > > On Mon, 26 Nov 2018 at 10:30, Peter Zijlstra <peterz@infradead.org> wrote: > > > > > > On Wed, Nov 21, 2018 at 11:34:53PM +0100, Andrea Parri wrote: > > > > Hi, > > > > > > > > The comment for the atomic_fetch_andnot() in nohz_idle_balance() says: > > > > > > > > "barrier, pairs with nohz_balance_enter_idle(), ensures ..." > > > > > > > > which, well, does sound a note of warning... ;-) > > > > > > > > I see that nohz_balance_enter_idle() has an smp_mb__after_atomic() but > > > > the comment for the latter suggests that this barrier is pairing with > > > > the smp_mb() in _nohz_idle_balance(). > > > > > > > > So, what is the intended pairing barrier for the atomic_fetch_andnot()? > > > > what (which memory accesses) do you want "to order" here? > > > > > > I can't seem to make sense of that comment either; the best I can come > > > up with is that it would order the prior NOHZ_KICK_MASK load vs us then > > > changing it. > > > > > > But that would order against kick_ilb(), not enter_idle. > > > > > > Vincent? > > > > I can't come with a good explanation. > > After looking into my email archive, the only explanation that i have > > is that the comments remains from a previous iteration of the feature > > that was based on a nohz.stats_state mechanism > > I'm afraid I still can't help your comment... put in other terms, would > you feel "unconfortable" with _relax()ing the andnot()? (and if so ...) so I think that the comment is useless and can be removed because it was referring to a line code above the comment that was present in a previous iteration of the patchset. This line disappeared in final version but the comment has stayed. If your question is: can we use atomic_fetch_andnot_relaxed() instead of atomic_fetch_andnot() in nohz_idle_balance() ? I think that it's possible > > Andrea ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Question] atomic_fetch_andnot() in nohz_idle_balance() 2018-11-27 9:01 ` Vincent Guittot @ 2018-11-27 10:59 ` Andrea Parri 0 siblings, 0 replies; 6+ messages in thread From: Andrea Parri @ 2018-11-27 10:59 UTC (permalink / raw) To: Vincent Guittot; +Cc: Peter Zijlstra, Ingo Molnar, linux-kernel On Tue, Nov 27, 2018 at 10:01:24AM +0100, Vincent Guittot wrote: > On Mon, 26 Nov 2018 at 21:44, Andrea Parri > <andrea.parri@amarulasolutions.com> wrote: > > > > On Mon, Nov 26, 2018 at 12:37:00PM +0100, Vincent Guittot wrote: > > > On Mon, 26 Nov 2018 at 10:30, Peter Zijlstra <peterz@infradead.org> wrote: > > > > > > > > On Wed, Nov 21, 2018 at 11:34:53PM +0100, Andrea Parri wrote: > > > > > Hi, > > > > > > > > > > The comment for the atomic_fetch_andnot() in nohz_idle_balance() says: > > > > > > > > > > "barrier, pairs with nohz_balance_enter_idle(), ensures ..." > > > > > > > > > > which, well, does sound a note of warning... ;-) > > > > > > > > > > I see that nohz_balance_enter_idle() has an smp_mb__after_atomic() but > > > > > the comment for the latter suggests that this barrier is pairing with > > > > > the smp_mb() in _nohz_idle_balance(). > > > > > > > > > > So, what is the intended pairing barrier for the atomic_fetch_andnot()? > > > > > what (which memory accesses) do you want "to order" here? > > > > > > > > I can't seem to make sense of that comment either; the best I can come > > > > up with is that it would order the prior NOHZ_KICK_MASK load vs us then > > > > changing it. > > > > > > > > But that would order against kick_ilb(), not enter_idle. > > > > > > > > Vincent? > > > > > > I can't come with a good explanation. > > > After looking into my email archive, the only explanation that i have > > > is that the comments remains from a previous iteration of the feature > > > that was based on a nohz.stats_state mechanism > > > > I'm afraid I still can't help your comment... put in other terms, would > > you feel "unconfortable" with _relax()ing the andnot()? (and if so ...) > > so I think that the comment is useless and can be removed because it > was referring to a line code above the comment that was present in a > previous iteration of the patchset. This line disappeared in final > version but the comment has stayed. > > If your question is: can we use atomic_fetch_andnot_relaxed() instead > of atomic_fetch_andnot() in nohz_idle_balance() ? > I think that it's possible Ah!, thank you for the clarification. Just sent a clean-up patch for the comment (but deferring for the _relaxed() change...). Andrea > > > > > Andrea ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-11-27 11:00 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-11-21 22:34 [Question] atomic_fetch_andnot() in nohz_idle_balance() Andrea Parri 2018-11-26 9:30 ` Peter Zijlstra 2018-11-26 11:37 ` Vincent Guittot 2018-11-26 20:44 ` Andrea Parri 2018-11-27 9:01 ` Vincent Guittot 2018-11-27 10:59 ` Andrea Parri
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox