Subject: [PATCH] sched/rt: Disable RT_RUNTIME_SHARE by default

The RT_RUNTIME_SHARE sched feature enables the sharing of rt_runtime
between CPUs, allowing a CPU to run a real-time task up to 100% of the
time while leaving more space for non-real-time tasks to run on the CPU
that lend rt_runtime.

The problem is that a CPU can easily borrow enough rt_runtime to allow
a spinning rt-task to run forever, starving per-cpu tasks like kworkers,
which are non-real-time by design.

This patch disables RT_RUNTIME_SHARE by default, avoiding this problem.
The feature will still be present for users that want to enable it,
though.

Signed-off-by: Daniel Bristot de Oliveira <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Juri Lelli <[email protected]>
Cc: Vincent Guittot <[email protected]>
Cc: Dietmar Eggemann <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Ben Segall <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Daniel Bristot de Oliveira <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
---
kernel/sched/features.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/features.h b/kernel/sched/features.h
index 7481cd96f391..68d369cba9e4 100644
--- a/kernel/sched/features.h
+++ b/kernel/sched/features.h
@@ -77,7 +77,7 @@ SCHED_FEAT(WARN_DOUBLE_CLOCK, false)
SCHED_FEAT(RT_PUSH_IPI, true)
#endif

-SCHED_FEAT(RT_RUNTIME_SHARE, true)
+SCHED_FEAT(RT_RUNTIME_SHARE, false)
SCHED_FEAT(LB_MIN, false)
SCHED_FEAT(ATTACH_AGE_LOAD, true)

--
2.26.2


2020-09-22 17:18:40

by Wei Wang

[permalink] [raw]
Subject: Re: [PATCH] sched/rt: Disable RT_RUNTIME_SHARE by default

On Mon, Sep 21, 2020 at 7:40 AM Daniel Bristot de Oliveira
<[email protected]> wrote:
>
> The RT_RUNTIME_SHARE sched feature enables the sharing of rt_runtime
> between CPUs, allowing a CPU to run a real-time task up to 100% of the
> time while leaving more space for non-real-time tasks to run on the CPU
> that lend rt_runtime.
>
> The problem is that a CPU can easily borrow enough rt_runtime to allow
> a spinning rt-task to run forever, starving per-cpu tasks like kworkers,
> which are non-real-time by design.
>
> This patch disables RT_RUNTIME_SHARE by default, avoiding this problem.
> The feature will still be present for users that want to enable it,
> though.
>
> Signed-off-by: Daniel Bristot de Oliveira <[email protected]>
> Cc: Ingo Molnar <[email protected]>
> Cc: Peter Zijlstra <[email protected]>
> Cc: Juri Lelli <[email protected]>
> Cc: Vincent Guittot <[email protected]>
> Cc: Dietmar Eggemann <[email protected]>
> Cc: Steven Rostedt <[email protected]>
> Cc: Ben Segall <[email protected]>
> Cc: Mel Gorman <[email protected]>
> Cc: Daniel Bristot de Oliveira <[email protected]>
> Cc: Thomas Gleixner <[email protected]>
> Cc: [email protected]
> ---
> kernel/sched/features.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/features.h b/kernel/sched/features.h
> index 7481cd96f391..68d369cba9e4 100644
> --- a/kernel/sched/features.h
> +++ b/kernel/sched/features.h
> @@ -77,7 +77,7 @@ SCHED_FEAT(WARN_DOUBLE_CLOCK, false)
> SCHED_FEAT(RT_PUSH_IPI, true)
> #endif
>
> -SCHED_FEAT(RT_RUNTIME_SHARE, true)
> +SCHED_FEAT(RT_RUNTIME_SHARE, false)
> SCHED_FEAT(LB_MIN, false)
> SCHED_FEAT(ATTACH_AGE_LOAD, true)
>
> --
> 2.26.2
>

Tested on an Android device and can no longer see long running RT
tasks (yes, Android have those for reasons).

Subject: Re: [PATCH] sched/rt: Disable RT_RUNTIME_SHARE by default

On 9/22/20 7:14 PM, Wei Wang wrote:
> On Mon, Sep 21, 2020 at 7:40 AM Daniel Bristot de Oliveira
> <[email protected]> wrote:
>>
>> The RT_RUNTIME_SHARE sched feature enables the sharing of rt_runtime
>> between CPUs, allowing a CPU to run a real-time task up to 100% of the
>> time while leaving more space for non-real-time tasks to run on the CPU
>> that lend rt_runtime.
>>
>> The problem is that a CPU can easily borrow enough rt_runtime to allow
>> a spinning rt-task to run forever, starving per-cpu tasks like kworkers,
>> which are non-real-time by design.
>>
>> This patch disables RT_RUNTIME_SHARE by default, avoiding this problem.
>> The feature will still be present for users that want to enable it,
>> though.
>>
>> Signed-off-by: Daniel Bristot de Oliveira <[email protected]>
>> Cc: Ingo Molnar <[email protected]>
>> Cc: Peter Zijlstra <[email protected]>
>> Cc: Juri Lelli <[email protected]>
>> Cc: Vincent Guittot <[email protected]>
>> Cc: Dietmar Eggemann <[email protected]>
>> Cc: Steven Rostedt <[email protected]>
>> Cc: Ben Segall <[email protected]>
>> Cc: Mel Gorman <[email protected]>
>> Cc: Daniel Bristot de Oliveira <[email protected]>
>> Cc: Thomas Gleixner <[email protected]>
>> Cc: [email protected]
>> ---
>> kernel/sched/features.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/sched/features.h b/kernel/sched/features.h
>> index 7481cd96f391..68d369cba9e4 100644
>> --- a/kernel/sched/features.h
>> +++ b/kernel/sched/features.h
>> @@ -77,7 +77,7 @@ SCHED_FEAT(WARN_DOUBLE_CLOCK, false)
>> SCHED_FEAT(RT_PUSH_IPI, true)
>> #endif
>>
>> -SCHED_FEAT(RT_RUNTIME_SHARE, true)
>> +SCHED_FEAT(RT_RUNTIME_SHARE, false)
>> SCHED_FEAT(LB_MIN, false)
>> SCHED_FEAT(ATTACH_AGE_LOAD, true)
>>
>> --
>> 2.26.2
>>
>
> Tested on an Android device and can no longer see long running RT
> tasks (yes, Android have those for reasons).
>

So:

Tested-by: Wei Wang <[email protected]>

?

Thanks!
-- Daniel

2020-09-22 20:34:03

by Wei Wang

[permalink] [raw]
Subject: Re: [PATCH] sched/rt: Disable RT_RUNTIME_SHARE by default

On Tue, Sep 22, 2020 at 12:04 PM Daniel Bristot de Oliveira
<[email protected]> wrote:
>
> On 9/22/20 7:14 PM, Wei Wang wrote:
> > On Mon, Sep 21, 2020 at 7:40 AM Daniel Bristot de Oliveira
> > <[email protected]> wrote:
> >>
> >> The RT_RUNTIME_SHARE sched feature enables the sharing of rt_runtime
> >> between CPUs, allowing a CPU to run a real-time task up to 100% of the
> >> time while leaving more space for non-real-time tasks to run on the CPU
> >> that lend rt_runtime.
> >>
> >> The problem is that a CPU can easily borrow enough rt_runtime to allow
> >> a spinning rt-task to run forever, starving per-cpu tasks like kworkers,
> >> which are non-real-time by design.
> >>
> >> This patch disables RT_RUNTIME_SHARE by default, avoiding this problem.
> >> The feature will still be present for users that want to enable it,
> >> though.
> >>
> >> Signed-off-by: Daniel Bristot de Oliveira <[email protected]>
> >> Cc: Ingo Molnar <[email protected]>
> >> Cc: Peter Zijlstra <[email protected]>
> >> Cc: Juri Lelli <[email protected]>
> >> Cc: Vincent Guittot <[email protected]>
> >> Cc: Dietmar Eggemann <[email protected]>
> >> Cc: Steven Rostedt <[email protected]>
> >> Cc: Ben Segall <[email protected]>
> >> Cc: Mel Gorman <[email protected]>
> >> Cc: Daniel Bristot de Oliveira <[email protected]>
> >> Cc: Thomas Gleixner <[email protected]>
> >> Cc: [email protected]
> >> ---
> >> kernel/sched/features.h | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/kernel/sched/features.h b/kernel/sched/features.h
> >> index 7481cd96f391..68d369cba9e4 100644
> >> --- a/kernel/sched/features.h
> >> +++ b/kernel/sched/features.h
> >> @@ -77,7 +77,7 @@ SCHED_FEAT(WARN_DOUBLE_CLOCK, false)
> >> SCHED_FEAT(RT_PUSH_IPI, true)
> >> #endif
> >>
> >> -SCHED_FEAT(RT_RUNTIME_SHARE, true)
> >> +SCHED_FEAT(RT_RUNTIME_SHARE, false)
> >> SCHED_FEAT(LB_MIN, false)
> >> SCHED_FEAT(ATTACH_AGE_LOAD, true)
> >>
> >> --
> >> 2.26.2
> >>
> >
> > Tested on an Android device and can no longer see long running RT
> > tasks (yes, Android have those for reasons).
> >
>
> So:
>
> Tested-by: Wei Wang <[email protected]>
>
> ?

Yup, thanks for pushing this.

>
> Thanks!
> -- Daniel
>

Subject: [tip: sched/core] sched/rt: Disable RT_RUNTIME_SHARE by default

The following commit has been merged into the sched/core branch of tip:

Commit-ID: 2586af1ac187f6b3a50930a4e33497074e81762d
Gitweb: https://git.kernel.org/tip/2586af1ac187f6b3a50930a4e33497074e81762d
Author: Daniel Bristot de Oliveira <[email protected]>
AuthorDate: Mon, 21 Sep 2020 16:39:49 +02:00
Committer: Peter Zijlstra <[email protected]>
CommitterDate: Fri, 25 Sep 2020 14:23:24 +02:00

sched/rt: Disable RT_RUNTIME_SHARE by default

The RT_RUNTIME_SHARE sched feature enables the sharing of rt_runtime
between CPUs, allowing a CPU to run a real-time task up to 100% of the
time while leaving more space for non-real-time tasks to run on the CPU
that lend rt_runtime.

The problem is that a CPU can easily borrow enough rt_runtime to allow
a spinning rt-task to run forever, starving per-cpu tasks like kworkers,
which are non-real-time by design.

This patch disables RT_RUNTIME_SHARE by default, avoiding this problem.
The feature will still be present for users that want to enable it,
though.

Signed-off-by: Daniel Bristot de Oliveira <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Tested-by: Wei Wang <[email protected]>
Link: https://lkml.kernel.org/r/b776ab46817e3db5d8ef79175fa0d71073c051c7.1600697903.git.bristot@redhat.com
---
kernel/sched/features.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/features.h b/kernel/sched/features.h
index 7481cd9..68d369c 100644
--- a/kernel/sched/features.h
+++ b/kernel/sched/features.h
@@ -77,7 +77,7 @@ SCHED_FEAT(WARN_DOUBLE_CLOCK, false)
SCHED_FEAT(RT_PUSH_IPI, true)
#endif

-SCHED_FEAT(RT_RUNTIME_SHARE, true)
+SCHED_FEAT(RT_RUNTIME_SHARE, false)
SCHED_FEAT(LB_MIN, false)
SCHED_FEAT(ATTACH_AGE_LOAD, true)