linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/nohz: add debugfs control over sched_tick_max_deferment
@ 2014-09-26 19:45 Kevin Hilman
  2014-09-26 20:03 ` Kevin Hilman
  2014-09-27 16:59 ` Frederic Weisbecker
  0 siblings, 2 replies; 4+ messages in thread
From: Kevin Hilman @ 2014-09-26 19:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Kevin Hilman <khilman@linaro.org>

Allow debugfs override of sched_tick_max_deferment in order to ease
finding/fixing the remaining issues with full nohz.

The value to be written is in jiffies, and -1 means the max deferment
is disabled (scheduler_tick_max_deferment() returns KTIME_MAX.)

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>
---
 kernel/sched/core.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index bc1638b33449..dee044a5d447 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2514,6 +2514,8 @@ void scheduler_tick(void)
 }
 
 #ifdef CONFIG_NO_HZ_FULL
+static u32 sched_tick_max_deferment = HZ;
+
 /**
  * scheduler_tick_max_deferment
  *
@@ -2532,13 +2534,25 @@ u64 scheduler_tick_max_deferment(void)
 	struct rq *rq = this_rq();
 	unsigned long next, now = ACCESS_ONCE(jiffies);
 
-	next = rq->last_sched_tick + HZ;
+	if (sched_tick_max_deferment == -1)
+		return KTIME_MAX;
+
+	next = rq->last_sched_tick + sched_tick_max_deferment;
 
 	if (time_before_eq(next, now))
 		return 0;
 
 	return jiffies_to_nsecs(next - now);
 }
+
+static __init int sched_nohz_full_init_debug(void)
+{
+	debugfs_create_u32("sched_tick_max_deferment", 0644, NULL,
+			   &sched_tick_max_deferment);
+
+	return 0;
+}
+late_initcall(sched_nohz_full_init_debug);
 #endif
 
 notrace unsigned long get_parent_ip(unsigned long addr)
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] sched/nohz: add debugfs control over sched_tick_max_deferment
  2014-09-26 19:45 [PATCH] sched/nohz: add debugfs control over sched_tick_max_deferment Kevin Hilman
@ 2014-09-26 20:03 ` Kevin Hilman
  2014-09-27 16:59 ` Frederic Weisbecker
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2014-09-26 20:03 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Frederic,

On Fri, Sep 26, 2014 at 12:45 PM, Kevin Hilman <khilman@kernel.org> wrote:
> From: Kevin Hilman <khilman@linaro.org>
>
> Allow debugfs override of sched_tick_max_deferment in order to ease
> finding/fixing the remaining issues with full nohz.
>
> The value to be written is in jiffies, and -1 means the max deferment
> is disabled (scheduler_tick_max_deferment() returns KTIME_MAX.)
>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Signed-off-by: Kevin Hilman <khilman@linaro.org>

This is just an attempt to revive and hopefully finalize the
discussion started a while back[1].

Kevin

[1] https://lkml.org/lkml/2014/1/14/914

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] sched/nohz: add debugfs control over sched_tick_max_deferment
  2014-09-26 19:45 [PATCH] sched/nohz: add debugfs control over sched_tick_max_deferment Kevin Hilman
  2014-09-26 20:03 ` Kevin Hilman
@ 2014-09-27 16:59 ` Frederic Weisbecker
  2014-09-29 15:11   ` Kevin Hilman
  1 sibling, 1 reply; 4+ messages in thread
From: Frederic Weisbecker @ 2014-09-27 16:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Sep 26, 2014 at 12:45:32PM -0700, Kevin Hilman wrote:
> From: Kevin Hilman <khilman@linaro.org>
> 
> Allow debugfs override of sched_tick_max_deferment in order to ease
> finding/fixing the remaining issues with full nohz.
> 
> The value to be written is in jiffies, and -1 means the max deferment
> is disabled (scheduler_tick_max_deferment() returns KTIME_MAX.)
> 
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Signed-off-by: Kevin Hilman <khilman@linaro.org>

So, I'm worried that it becomes a hack that everybody uses to shutdown
the tick completely then nobody will come and fix the issue that prevents
from doing it properly.

I seriously doubt this will be used for development purpose to help
fixing the real problem. Quite the opposite. If developers want to do
testing, they can as well comment out the call to scheduler_max_tick_deferment().


> ---
>  kernel/sched/core.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index bc1638b33449..dee044a5d447 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -2514,6 +2514,8 @@ void scheduler_tick(void)
>  }
>  
>  #ifdef CONFIG_NO_HZ_FULL
> +static u32 sched_tick_max_deferment = HZ;
> +
>  /**
>   * scheduler_tick_max_deferment
>   *
> @@ -2532,13 +2534,25 @@ u64 scheduler_tick_max_deferment(void)
>  	struct rq *rq = this_rq();
>  	unsigned long next, now = ACCESS_ONCE(jiffies);
>  
> -	next = rq->last_sched_tick + HZ;
> +	if (sched_tick_max_deferment == -1)
> +		return KTIME_MAX;
> +
> +	next = rq->last_sched_tick + sched_tick_max_deferment;
>  
>  	if (time_before_eq(next, now))
>  		return 0;
>  
>  	return jiffies_to_nsecs(next - now);
>  }
> +
> +static __init int sched_nohz_full_init_debug(void)
> +{
> +	debugfs_create_u32("sched_tick_max_deferment", 0644, NULL,
> +			   &sched_tick_max_deferment);
> +
> +	return 0;
> +}
> +late_initcall(sched_nohz_full_init_debug);
>  #endif
>  
>  notrace unsigned long get_parent_ip(unsigned long addr)
> -- 
> 2.1.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] sched/nohz: add debugfs control over sched_tick_max_deferment
  2014-09-27 16:59 ` Frederic Weisbecker
@ 2014-09-29 15:11   ` Kevin Hilman
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2014-09-29 15:11 UTC (permalink / raw)
  To: linux-arm-kernel

Frederic Weisbecker <fweisbec@gmail.com> writes:

> On Fri, Sep 26, 2014 at 12:45:32PM -0700, Kevin Hilman wrote:
>> From: Kevin Hilman <khilman@linaro.org>
>> 
>> Allow debugfs override of sched_tick_max_deferment in order to ease
>> finding/fixing the remaining issues with full nohz.
>> 
>> The value to be written is in jiffies, and -1 means the max deferment
>> is disabled (scheduler_tick_max_deferment() returns KTIME_MAX.)
>> 
>> Cc: Frederic Weisbecker <fweisbec@gmail.com>
>> Signed-off-by: Kevin Hilman <khilman@linaro.org>
>
> So, I'm worried that it becomes a hack that everybody uses to shutdown
> the tick completely then nobody will come and fix the issue that prevents
> from doing it properly.

OK.

> I seriously doubt this will be used for development purpose to help
> fixing the real problem. 

Well, that's what I was using it for, until I was distracted by other
tasks.

> Quite the opposite. If developers want to do
> testing, they can as well comment out the call to scheduler_max_tick_deferment().

OK, fair enough.

Thanks,

Kevin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-29 15:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-26 19:45 [PATCH] sched/nohz: add debugfs control over sched_tick_max_deferment Kevin Hilman
2014-09-26 20:03 ` Kevin Hilman
2014-09-27 16:59 ` Frederic Weisbecker
2014-09-29 15:11   ` Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).