rcu: Fix missing TICK_DEP_MASK_RCU_EXP dependency check
Subsystems (4)
PATCH 1/1 rcu: Fix missing TICK_DEP_MASK_RCU_EXP dependency check
This commit add TICK_DEP_MASK_RCU_EXP dependency check in check_tick_dependency(), fix commit df1e849ae4559 ("rcu: Enable tick for nohz_full CPUs slow to provide expedited QS").
--- include/trace/events/timer.h | 3 ++- kernel/time/tick-sched.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-)
include/trace/events/timer.h +2 -1
@@ -371,7 +371,8 @@ TRACE_EVENT(itimer_expire, tick_dep_name(PERF_EVENTS) \ tick_dep_name(SCHED) \ tick_dep_name(CLOCK_UNSTABLE) \ - tick_dep_name_end(RCU) + tick_dep_name(RCU) \ + tick_dep_name_end(RCU_EXP) #undef tick_dep_name#undef tick_dep_mask_name
kernel/time/tick-sched.c +5 -0
@@ -281,6 +281,11 @@ static bool check_tick_dependency(atomic_t *dep)return true; } +if (val &TICK_DEP_MASK_RCU_EXP ) { +trace_tick_stop (0 ,TICK_DEP_MASK_RCU_EXP ); +return true; + } +return false; }
Signature · 1 line
2.25.1
Quoted 5 lines · Zqiang
This commit add
TICK_DEP_MASK_RCU_EXPdependency check incheck_tick_dependency(), fix commitdf1e849ae4559("rcu: Enable tick fornohz_fullCPUs slow to provide expedited QS").Signed-off-by Zqiang <[email protected]>
Again, good eyes, thank you!!!
I have queued this for further review and testing, given that it affects pretty much only RCU. However, if someone else would rather take it:
Thanx, Paul
------------------------------------------------------------------------
commit f22caef6cda5ed19a55ec2e703f60f1fa85e52bc
Author: Zqiang <[email protected]> Date: Tue Dec 20 22:16:25 2022 +0800
rcu: Fix missing TICK_DEP_MASK_RCU_EXP dependency check
This commit adds checks for the TICK_DEP_MASK_RCU_EXP bit, thus enabling RCU expedited grace periods to actually force-enable scheduling-clock interrupts on holdout CPUs.
include/trace/events/timer.h +2 -1
@@ -371,7 +371,8 @@ TRACE_EVENT(itimer_expire, tick_dep_name(PERF_EVENTS) \ tick_dep_name(SCHED) \ tick_dep_name(CLOCK_UNSTABLE) \ - tick_dep_name_end(RCU) + tick_dep_name(RCU) \ + tick_dep_name_end(RCU_EXP) #undef tick_dep_name#undef tick_dep_mask_name
kernel/time/tick-sched.c +5 -0
@@ -281,6 +281,11 @@ static bool check_tick_dependency(atomic_t *dep)return true; } +if (val &TICK_DEP_MASK_RCU_EXP ) { +trace_tick_stop (0 ,TICK_DEP_MASK_RCU_EXP ); +return true; + } +return false; }
Quoted 5 lines · Paul E. McKenney
Quoted 4 lines · Zqiang
This commit add
TICK_DEP_MASK_RCU_EXPdependency check incheck_tick_dependency(), fix commitdf1e849ae4559("rcu: Enable tick fornohz_fullCPUs slow to provide expedited QS").
Quoted 8 lines
Quoted 1 line
Signed-off-by Zqiang <[email protected]>Again, good eyes, thank you!!!
I have queued this for further review and testing, given that it affects pretty much only RCU. However, if someone else would rather take it:
Acked-by Paul E. McKenney <[email protected]>
Thanks for picking it up! Please also add the following tags:
Thanks!
Paul E. McKenney
maintainerQuoted 13 lines · Frederic Weisbecker
Quoted 12 lines · Paul E. McKenney
Quoted 5 lines · Zqiang
This commit add
TICK_DEP_MASK_RCU_EXPdependency check incheck_tick_dependency(), fix commitdf1e849ae4559("rcu: Enable tick fornohz_fullCPUs slow to provide expedited QS").Signed-off-by Zqiang <[email protected]>Again, good eyes, thank you!!!
I have queued this for further review and testing, given that it affects pretty much only RCU. However, if someone else would rather take it:
Quoted 6 lines
Quoted 1 line
Acked-by Paul E. McKenney <[email protected]>Thanks for picking it up! Please also add the following tags:
Fixes df1e849ae455 ("rcu: Enable tick for nohz_full CPUs slow to provide expedited QS")
Thank you for looking it over! I will apply these on my next rebase.
Thanx, Paul
A message that is not in the archive (sent off-list or not yet received): [email protected]
Frederic Weisbecker
maintainerQuoted 1 line · Joel Fernandes
(lost html content)
I can't find a place where the exp grace period sends an IPI to CPUs slow to report a QS. But anyway you really need the tick to poll periodically on the CPU to chase a quiescent state.
Now arguably it's probably only useful when CONFIG_PREEMPT_COUNT=y and rcu_exp_handler() has interrupted a preempt-disabled or bh-disabled section. Although rcu_exp_handler() sets TIF_RESCHED, which is handled by preempt_enable() and local_bh_enable() when CONFIG_PREEMPT=y. So probably it's only useful when CONFIG_PREEMPT_COUNT=y and CONFIG_PREEMPT=n (and there is also PREEMPT_DYNAMIC to consider).
If CONFIG_PREEMPT_COUNT=n, the tick can only report idle and user as QS, but those are already reported explicitly on ct_kernel_exit() -> rcu_preempt_deferred_qs().
Thanks.
Quoted 5 lines · Frederic Weisbecker
Quoted 1 line · Joel Fernandes
(lost html content)
My problem is the iPhone wises up when I put a web link in an email. I want to look into smtp relays but then if I spent time on fixing that, I might not get time to learn from emails like these...
Quoted 3 lines
I can't find a place where the exp grace period sends an IPI to CPUs slow to report a QS. But anyway you really need the tick to poll periodically on the CPU to chase a quiescent state.
Ok.
Quoted 6 lines
Now arguably it's probably only useful when
CONFIG_PREEMPT_COUNT=yandrcu_exp_handler()has interrupted a preempt-disabled or bh-disabled section. Althoughrcu_exp_handler()setsTIF_RESCHED, which is handled bypreempt_enable()andlocal_bh_enable()whenCONFIG_PREEMPT=y. So probably it's only useful whenCONFIG_PREEMPT_COUNT=yandCONFIG_PREEMPT=n(and there is alsoPREEMPT_DYNAMICto consider).
Makes sense. I think I was missing this use case and was going by the general design of exp grace periods. I was incorrectly assuming the IPIs were being sent repeatedly for hold out CPUs, which is not the case I think. But that would another way to fix it?
But yeah I get your point, the first set of IPIs missed it, so we need the rescue-tick for long non-rcu_read_lock() implicit critical sections..
Quoted 3 lines
If
CONFIG_PREEMPT_COUNT=n, the tick can only report idle and user as QS, but those are already reported explicitly onct_kernel_exit()->rcu_preempt_deferred_qs().
Oh hmm, because that function is a NOOP for PREEMPT_COUNT=y and PREEMPT=n and will not report the deferred QS? Maybe it should then. However I think the tick is still useful if after the preempt disabled section, will still did not exit the kernel.
We ought to start another Google doc on all of this if we have not yet…
Thanks!
- Joel
Quoted 4 lines
Thanks.
Quoted 27 lines · Joel Fernandes
Quoted 4 lines
Quoted 4 lines · Frederic Weisbecker
On Fri, Jan 06, 2023 at 07:01:28PM -0500, Joel Fernandes wrote:
(lost html content)My problem is the iPhone wises up when I put a web link in an email. I want to look into smtp relays but then if I spent time on fixing that, I might not get time to learn from emails like these...
Quoted 3 lines
I can't find a place where the exp grace period sends an IPI to CPUs slow to report a QS. But anyway you really need the tick to poll periodically on the CPU to chase a quiescent state.
Ok.
Quoted 6 lines
Now arguably it's probably only useful when
CONFIG_PREEMPT_COUNT=yandrcu_exp_handler()has interrupted a preempt-disabled or bh-disabled section. Althoughrcu_exp_handler()setsTIF_RESCHED, which is handled bypreempt_enable()andlocal_bh_enable()whenCONFIG_PREEMPT=y. So probably it's only useful whenCONFIG_PREEMPT_COUNT=yandCONFIG_PREEMPT=n(and there is alsoPREEMPT_DYNAMICto consider).Makes sense. I think I was missing this use case and was going by the general design of exp grace periods. I was incorrectly assuming the IPIs were being sent repeatedly for hold out CPUs, which is not the case I think. But that would another way to fix it?
Quoted 7 lines
But yeah I get your point, the first set of IPIs missed it, so we need the rescue-tick for long non-rcu_read_lock() implicit critical sections..
Quoted 3 lines
If
CONFIG_PREEMPT_COUNT=n, the tick can only report idle and user as QS, but those are already reported explicitly onct_kernel_exit()->rcu_preempt_deferred_qs().Oh hmm, because that function is a NOOP for PREEMPT_COUNT=y and PREEMPT=n and will not report the deferred QS? Maybe it should then. However I think the tick is still useful if after the preempt disabled section, will still did not exit the kernel.
I think meant I here, an atomic section (like bh or Irq disabled). There is no such thing as disabling preemption for CONFIG_PREEMPT=n. Or maybe I am confused again. This RCU thing…
Thanks.
Quoted 11 lines
We ought to start another Google doc on all of this if we have not yet…
Thanks!
- Joel
Quoted 4 lines
Thanks.
Frederic Weisbecker
maintainerQuoted 29 lines · Joel Fernandes
Quoted 29 lines · Joel Fernandes
Quoted 4 lines
Quoted 4 lines · Frederic Weisbecker
On Fri, Jan 06, 2023 at 07:01:28PM -0500, Joel Fernandes wrote:
(lost html content)My problem is the iPhone wises up when I put a web link in an email. I want to look into smtp relays but then if I spent time on fixing that, I might not get time to learn from emails like these...
Quoted 3 lines
I can't find a place where the exp grace period sends an IPI to CPUs slow to report a QS. But anyway you really need the tick to poll periodically on the CPU to chase a quiescent state.
Ok.
Quoted 6 lines
Now arguably it's probably only useful when
CONFIG_PREEMPT_COUNT=yandrcu_exp_handler()has interrupted a preempt-disabled or bh-disabled section. Althoughrcu_exp_handler()setsTIF_RESCHED, which is handled bypreempt_enable()andlocal_bh_enable()whenCONFIG_PREEMPT=y. So probably it's only useful whenCONFIG_PREEMPT_COUNT=yandCONFIG_PREEMPT=n(and there is alsoPREEMPT_DYNAMICto consider).Makes sense. I think I was missing this use case and was going by the general design of exp grace periods. I was incorrectly assuming the IPIs were being sent repeatedly for hold out CPUs, which is not the case I think. But that would another way to fix it?
But yeah I get your point, the first set of IPIs missed it, so we need the rescue-tick for long non-rcu_read_lock() implicit critical sections..
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
If
CONFIG_PREEMPT_COUNT=n, the tick can only report idle and user as QS, but those are already reported explicitly onct_kernel_exit()->rcu_preempt_deferred_qs().Oh hmm, because that function is a NOOP for PREEMPT_COUNT=y and PREEMPT=n and will not report the deferred QS? Maybe it should then. However I think the tick is still useful if after the preempt disabled section, will still did not exit the kernel.
I think meant I here, an atomic section (like bh or Irq disabled). There is no such thing as disabling preemption for
CONFIG_PREEMPT=n. Or maybe I am confused again. This RCU thing…
Right, so when CONFIG_PREEMPT_COUNT=n, there is no way for a tick to tell if the the interrupted code is safely considered as a QS. That's because preempt_disable() <-> preempt_enable() are no-ops so the whole kernel is assumed non-preemptible, and therefore the whole kernel is a READ side critical section, except for the explicit points reporting a QS.
The only exception is when the tick interrupts idle (or user with nohz_full). But we already have an exp QS reported on idle (and user with nohz_full) entry through ct_kernel_exit(), and that happens on all RCU_TREE configs (PREEMPT or not). Therefore the tick doesn't appear to be helpful at all on a nohz_full CPU with CONFIG_PREEMPT_COUNT=n.
I suggest we don't bother optimizing that case though...
To summarize:
1) nohz_full && !CONFIG_PREEMPT_COUNT && !CONFIG_PREEMPT_RCU:
Tick isn't helpful. It can only report idle/user QS, but that is already reported explicitly.
2) nohz_full && CONFIG_PREEMPT_COUNT && !CONFIG_PREEMPT_RCU:
Tick is very helpful because it can tell if the kernel is in a QS state.
3) nohz_full && CONFIG_PREEMPT_RCU:
Tick doesn't appear to be helpful because:
- If the rcu_exp_handler() fires in an rcu_read_lock'ed section, then the exp QS is reported on rcu_read_unlock()
- If the rcu_exp_handler() fires in a preempt/bh disabled section, TIF_RESCHED is forced which is handled on preempt/bh re-enablement, reporting a QS.
The case 2) is a niche, only useful for debugging. But anyway I'm not sure it's worth changing/optimizing the current state. Might be worth add a comment though.
Thanks.
Paul E. McKenney
maintainerQuoted 71 lines · Frederic Weisbecker
Quoted 29 lines · Joel Fernandes
Quoted 29 lines · Joel Fernandes
Quoted 4 lines
Quoted 4 lines · Frederic Weisbecker
On Fri, Jan 06, 2023 at 07:01:28PM -0500, Joel Fernandes wrote:
(lost html content)My problem is the iPhone wises up when I put a web link in an email. I want to look into smtp relays but then if I spent time on fixing that, I might not get time to learn from emails like these...
Quoted 3 lines
I can't find a place where the exp grace period sends an IPI to CPUs slow to report a QS. But anyway you really need the tick to poll periodically on the CPU to chase a quiescent state.
Ok.
Quoted 6 lines
Now arguably it's probably only useful when
CONFIG_PREEMPT_COUNT=yandrcu_exp_handler()has interrupted a preempt-disabled or bh-disabled section. Althoughrcu_exp_handler()setsTIF_RESCHED, which is handled bypreempt_enable()andlocal_bh_enable()whenCONFIG_PREEMPT=y. So probably it's only useful whenCONFIG_PREEMPT_COUNT=yandCONFIG_PREEMPT=n(and there is alsoPREEMPT_DYNAMICto consider).Makes sense. I think I was missing this use case and was going by the general design of exp grace periods. I was incorrectly assuming the IPIs were being sent repeatedly for hold out CPUs, which is not the case I think. But that would another way to fix it?
But yeah I get your point, the first set of IPIs missed it, so we need the rescue-tick for long non-rcu_read_lock() implicit critical sections..
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
If
CONFIG_PREEMPT_COUNT=n, the tick can only report idle and user as QS, but those are already reported explicitly onct_kernel_exit()->rcu_preempt_deferred_qs().Oh hmm, because that function is a NOOP for PREEMPT_COUNT=y and PREEMPT=n and will not report the deferred QS? Maybe it should then. However I think the tick is still useful if after the preempt disabled section, will still did not exit the kernel.
I think meant I here, an atomic section (like bh or Irq disabled). There is no such thing as disabling preemption for
CONFIG_PREEMPT=n. Or maybe I am confused again. This RCU thing…Right, so when
CONFIG_PREEMPT_COUNT=n, there is no way for a tick to tell if the the interrupted code is safely considered as a QS. That's becausepreempt_disable()<->preempt_enable()are no-ops so the whole kernel is assumed non-preemptible, and therefore the whole kernel is a READ side critical section, except for the explicit points reporting a QS.The only exception is when the tick interrupts idle (or user with
nohz_full). But we already have an exp QS reported on idle (and user withnohz_full) entry throughct_kernel_exit(), and that happens on allRCU_TREEconfigs (PREEMPT or not). Therefore the tick doesn't appear to be helpful at all on anohz_fullCPU withCONFIG_PREEMPT_COUNT=n.I suggest we don't bother optimizing that case though...
To summarize:
1)
nohz_full&& !CONFIG_PREEMPT_COUNT && !CONFIG_PREEMPT_RCU:
Tick isn't helpful. It can only report idle/user QS, but that is already reported explicitly.2)
nohz_full&&CONFIG_PREEMPT_COUNT&& !CONFIG_PREEMPT_RCU:
Tick is very helpful because it can tell if the kernel is in a QS state.3)
nohz_full&&CONFIG_PREEMPT_RCU:
Tick doesn't appear to be helpful because:
- If thercu_exp_handler()fires in an rcu_read_lock'ed section, then the exp QS is reported onrcu_read_unlock()
- If thercu_exp_handler()fires in a preempt/bh disabled section,TIF_RESCHEDis forced which is handled on preempt/bh re-enablement, reporting a QS.
Quoted 3 lines
The case 2) is a niche, only useful for debugging. But anyway I'm not sure it's worth changing/optimizing the current state. Might be worth add a comment though.
Thank you both for the analysis! I would welcome a comment.
One could argue that we should increase the delay before turning the tick on, but my experience is that expedited grace periods almost always complete in less than a jiffy, so there would almost never be any benefit in doing so. But if some large NO_HZ_FULL system with long RCU readers starts having trouble with too-frequent tick enablement, that is one possible fix.
Thanx, Paul
Frederic Weisbecker
maintainerQuoted 72 lines · Paul E. McKenney
Quoted 71 lines · Frederic Weisbecker
Quoted 29 lines · Joel Fernandes
Quoted 29 lines · Joel Fernandes
Quoted 4 lines
Quoted 4 lines · Frederic Weisbecker
On Fri, Jan 06, 2023 at 07:01:28PM -0500, Joel Fernandes wrote:
(lost html content)My problem is the iPhone wises up when I put a web link in an email. I want to look into smtp relays but then if I spent time on fixing that, I might not get time to learn from emails like these...
Quoted 3 lines
I can't find a place where the exp grace period sends an IPI to CPUs slow to report a QS. But anyway you really need the tick to poll periodically on the CPU to chase a quiescent state.
Ok.
Quoted 6 lines
Now arguably it's probably only useful when
CONFIG_PREEMPT_COUNT=yandrcu_exp_handler()has interrupted a preempt-disabled or bh-disabled section. Althoughrcu_exp_handler()setsTIF_RESCHED, which is handled bypreempt_enable()andlocal_bh_enable()whenCONFIG_PREEMPT=y. So probably it's only useful whenCONFIG_PREEMPT_COUNT=yandCONFIG_PREEMPT=n(and there is alsoPREEMPT_DYNAMICto consider).Makes sense. I think I was missing this use case and was going by the general design of exp grace periods. I was incorrectly assuming the IPIs were being sent repeatedly for hold out CPUs, which is not the case I think. But that would another way to fix it?
But yeah I get your point, the first set of IPIs missed it, so we need the rescue-tick for long non-rcu_read_lock() implicit critical sections..
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
If
CONFIG_PREEMPT_COUNT=n, the tick can only report idle and user as QS, but those are already reported explicitly onct_kernel_exit()->rcu_preempt_deferred_qs().Oh hmm, because that function is a NOOP for PREEMPT_COUNT=y and PREEMPT=n and will not report the deferred QS? Maybe it should then. However I think the tick is still useful if after the preempt disabled section, will still did not exit the kernel.
I think meant I here, an atomic section (like bh or Irq disabled). There is no such thing as disabling preemption for
CONFIG_PREEMPT=n. Or maybe I am confused again. This RCU thing…Right, so when
CONFIG_PREEMPT_COUNT=n, there is no way for a tick to tell if the the interrupted code is safely considered as a QS. That's becausepreempt_disable()<->preempt_enable()are no-ops so the whole kernel is assumed non-preemptible, and therefore the whole kernel is a READ side critical section, except for the explicit points reporting a QS.The only exception is when the tick interrupts idle (or user with
nohz_full). But we already have an exp QS reported on idle (and user withnohz_full) entry throughct_kernel_exit(), and that happens on allRCU_TREEconfigs (PREEMPT or not). Therefore the tick doesn't appear to be helpful at all on anohz_fullCPU withCONFIG_PREEMPT_COUNT=n.I suggest we don't bother optimizing that case though...
To summarize:
1)
nohz_full&& !CONFIG_PREEMPT_COUNT && !CONFIG_PREEMPT_RCU:
Tick isn't helpful. It can only report idle/user QS, but that is already reported explicitly.2)
nohz_full&&CONFIG_PREEMPT_COUNT&& !CONFIG_PREEMPT_RCU:
Tick is very helpful because it can tell if the kernel is in a QS state.3)
nohz_full&&CONFIG_PREEMPT_RCU:
Tick doesn't appear to be helpful because:
- If thercu_exp_handler()fires in an rcu_read_lock'ed section, then the exp QS is reported onrcu_read_unlock()
- If thercu_exp_handler()fires in a preempt/bh disabled section,TIF_RESCHEDis forced which is handled on preempt/bh re-enablement, reporting a QS.
Quoted 5 lines
Quoted 3 lines
The case 2) is a niche, only useful for debugging. But anyway I'm not sure it's worth changing/optimizing the current state. Might be worth add a comment though.
Thank you both for the analysis! I would welcome a comment.
I'm preparing that.
Quoted 6 lines
One could argue that we should increase the delay before turning the tick on, but my experience is that expedited grace periods almost always complete in less than a jiffy, so there would almost never be any benefit in doing so. But if some large
NO_HZ_FULLsystem with long RCU readers starts having trouble with too-frequent tick enablement, that is one possible fix.
And last but not least: wait for anybody to complain before changing anything ;-))
Thanks.
Paul E. McKenney
maintainerQuoted 86 lines · Frederic Weisbecker
Quoted 70 lines · Paul E. McKenney
Quoted 69 lines · Frederic Weisbecker
Quoted 27 lines · Joel Fernandes
Quoted 27 lines · Joel Fernandes
Quoted 4 lines
Quoted 4 lines · Frederic Weisbecker
On Fri, Jan 06, 2023 at 07:01:28PM -0500, Joel Fernandes wrote:
(lost html content)My problem is the iPhone wises up when I put a web link in an email. I want to look into smtp relays but then if I spent time on fixing that, I might not get time to learn from emails like these...
Quoted 3 lines
I can't find a place where the exp grace period sends an IPI to CPUs slow to report a QS. But anyway you really need the tick to poll periodically on the CPU to chase a quiescent state.
Ok.
Quoted 6 lines
Now arguably it's probably only useful when
CONFIG_PREEMPT_COUNT=yandrcu_exp_handler()has interrupted a preempt-disabled or bh-disabled section. Althoughrcu_exp_handler()setsTIF_RESCHED, which is handled bypreempt_enable()andlocal_bh_enable()whenCONFIG_PREEMPT=y. So probably it's only useful whenCONFIG_PREEMPT_COUNT=yandCONFIG_PREEMPT=n(and there is alsoPREEMPT_DYNAMICto consider).Makes sense. I think I was missing this use case and was going by the general design of exp grace periods. I was incorrectly assuming the IPIs were being sent repeatedly for hold out CPUs, which is not the case I think. But that would another way to fix it?
But yeah I get your point, the first set of IPIs missed it, so we need the rescue-tick for long non-rcu_read_lock() implicit critical sections..
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
If
CONFIG_PREEMPT_COUNT=n, the tick can only report idle and user as QS, but those are already reported explicitly onct_kernel_exit()->rcu_preempt_deferred_qs().Oh hmm, because that function is a NOOP for PREEMPT_COUNT=y and PREEMPT=n and will not report the deferred QS? Maybe it should then. However I think the tick is still useful if after the preempt disabled section, will still did not exit the kernel.
I think meant I here, an atomic section (like bh or Irq disabled). There is no such thing as disabling preemption for
CONFIG_PREEMPT=n. Or maybe I am confused again. This RCU thing…Right, so when
CONFIG_PREEMPT_COUNT=n, there is no way for a tick to tell if the the interrupted code is safely considered as a QS. That's becausepreempt_disable()<->preempt_enable()are no-ops so the whole kernel is assumed non-preemptible, and therefore the whole kernel is a READ side critical section, except for the explicit points reporting a QS.The only exception is when the tick interrupts idle (or user with
nohz_full). But we already have an exp QS reported on idle (and user withnohz_full) entry throughct_kernel_exit(), and that happens on allRCU_TREEconfigs (PREEMPT or not). Therefore the tick doesn't appear to be helpful at all on anohz_fullCPU withCONFIG_PREEMPT_COUNT=n.I suggest we don't bother optimizing that case though...
To summarize:
1)
nohz_full&& !CONFIG_PREEMPT_COUNT && !CONFIG_PREEMPT_RCU:
Tick isn't helpful. It can only report idle/user QS, but that is already reported explicitly.2)
nohz_full&&CONFIG_PREEMPT_COUNT&& !CONFIG_PREEMPT_RCU:
Tick is very helpful because it can tell if the kernel is in a QS state.3)
nohz_full&&CONFIG_PREEMPT_RCU:
Tick doesn't appear to be helpful because:
- If thercu_exp_handler()fires in an rcu_read_lock'ed section, then the exp QS is reported onrcu_read_unlock()
- If thercu_exp_handler()fires in a preempt/bh disabled section,TIF_RESCHEDis forced which is handled on preempt/bh re-enablement, reporting a QS.Quoted 5 lines
Quoted 3 lines
The case 2) is a niche, only useful for debugging. But anyway I'm not sure it's worth changing/optimizing the current state. Might be worth add a comment though.
Thank you both for the analysis! I would welcome a comment.
I'm preparing that.
Quoted 6 lines
One could argue that we should increase the delay before turning the tick on, but my experience is that expedited grace periods almost always complete in less than a jiffy, so there would almost never be any benefit in doing so. But if some large
NO_HZ_FULLsystem with long RCU readers starts having trouble with too-frequent tick enablement, that is one possible fix.
Quoted 2 lines
And last but not least: wait for anybody to complain before changing anything ;-))
Well said! Up to a point, anyway. ;-)
Thanx, Paul