Re: [PATCH 2/4] sched/fair: cleanup loop_max and loop_break

Dietmar Eggemann
2022-09-12T08:45:31Z

On 25/08/2022 14:27, Vincent Guittot wrote:
> sched_nr_migrate_break is set to a fix value and never changes so we can
> replace it by a define SCHED_NR_MIGRATE_BREAK.
>
> Also, we adjust SCHED_NR_MIGRATE_BREAK to be aligned with the init value
> of sysctl_sched_nr_migrate which can be init to different values.
>
> Then, use SCHED_NR_MIGRATE_BREAK to init sysctl_sched_nr_migrate.
>
> The behavior stays unchanged unless you modify sysctl_sched_nr_migrate
> trough debugfs.

I don't quite get this sentence. The behavior would potentially change
if you change sysctl_sched_nr_migrate before this patch too?

>
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
> ---
> kernel/sched/core.c | 6 +-----
> kernel/sched/fair.c | 11 ++++-------
> kernel/sched/sched.h | 6 ++++++
> 3 files changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 64c08993221b..a21e817bdd1c 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -142,11 +142,7 @@ __read_mostly int sysctl_resched_latency_warn_once = 1;
> * Number of tasks to iterate in a single balance run.
> * Limited because this is done with IRQs disabled.
> */

^^^
Shouldn't this comment be removed as well?

> -#ifdef CONFIG_PREEMPT_RT
> -const_debug unsigned int sysctl_sched_nr_migrate = 8;
> -#else
> -const_debug unsigned int sysctl_sched_nr_migrate = 32;
> -#endif
> +const_debug unsigned int sysctl_sched_nr_migrate = SCHED_NR_MIGRATE_BREAK;
>
> __read_mostly int scheduler_running; …