lkml.org 
[lkml]   [2018]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC] sched: Distinguish between idle_cpu calls based on desired effect
From
Date
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@oracle.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

\
 
 \ /
  Last update: 2018-05-08 02:16    [W:0.079 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site