[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <366af1f5-9837-8a0c-3550-1a3d9a8e9de9@infradead.org>
Date: Mon, 7 May 2018 17:15:16 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: Rohit Jain <rohit.k.jain@...cle.com>, matt@...eblueprint.co.uk,
peterz@...radead.org
Cc: mingo@...nel.org, dhaval.giani@...cle.com,
subhra.mazumdar@...cle.com, steven.sistare@...cle.com,
linux-kernel@...r.kernel.org
Subject: Re: [RFC] sched: Distinguish between idle_cpu calls based on desired
effect
On 05/07/2018 04:41 PM, Rohit Jain wrote:
> In commit 247f2f6f3c706b40b5f3886646f3eb53671258bf we distinguish
> between idle_cpu when the vcpu is not running for scheduling threads.
> However, idle_cpu function is used at other places for actually checking
> whether the state of the CPU is idle or not. Hence splitting the use of
> that function based on the desired return value.
>
> Signed-off-by: Rohit Jain <rohit.k.jain@...cle.com>
> ---
> include/linux/sched.h | 1 +
> kernel/sched/core.c | 14 ++++++++++++++
> kernel/sched/fair.c | 20 ++++++++++----------
> 3 files changed, 25 insertions(+), 10 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 71bdb86..171e160 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -4028,6 +4028,20 @@ int idle_cpu(int cpu)
> return 0;
> #endif
>
> + return 1;
> +}
> +
> +/**
> + * idle_cpu - is a given CPU idle for enqueuing work.
* available_idle_cpu -
> + * @cpu: the processor in question.
> + *
> + * Return: 1 if the CPU is currently idle. 0 otherwise.
> + */
> +int available_idle_cpu(int cpu)
> +{
> + if (!idle_cpu(cpu))
> + return 0;
> +
> if (vcpu_is_preempted(cpu))
> return 0;
>
--
~Randy
Powered by blists - more mailing lists