public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pierre Gondois <pierre.gondois@arm.com>
To: Shrikanth Hegde <sshegde@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Valentin Schneider <vschneid@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] sched/fair: Use rq in idle_cpu_without()
Date: Thu, 4 Jan 2024 17:12:22 +0100	[thread overview]
Message-ID: <647e6f54-8247-4ee6-b2ed-2b49bfdece06@arm.com> (raw)
In-Reply-To: <75b01ec8-dda9-433e-8980-2d94593dd80c@linux.vnet.ibm.com>

Hello Shrikanth,

On 1/4/24 06:15, Shrikanth Hegde wrote:
> 
> 
> On 1/3/24 6:26 PM, Pierre Gondois wrote:
>> idle_cpu_without() could receive a 'struct rq' instead of a
>> cpu number to avoid converting the cpu number to a 'struct rq'
> 
> nit: s/cpu/CPU
> 
>> two times. Indeed update_sg_wakeup_stats() already makes the
>> conversion.
> 
> This change looks good. There maybe other candidates which might get simplified
> as well. for example, update_blocked_averages. (and then there are some
> like balance_push_set which maybe borderline when it comes to such simplification)

Ok yes, I'll check the functions you pointed out.

> 
>>
>> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
>> ---
>>   kernel/sched/fair.c | 8 +++-----
>>   1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 93e928e76959..d38fec26fd3d 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -10184,15 +10184,13 @@ static unsigned int task_running_on_cpu(int cpu, struct task_struct *p)
>>   
>>   /**
>>    * idle_cpu_without - would a given CPU be idle without p ?
>> - * @cpu: the processor on which idleness is tested.
>> + * @rq: the rq on which idleness is tested.
>>    * @p: task which should be ignored.
>>    *
>>    * Return: 1 if the CPU would be idle. 0 otherwise.
>>    */
>> -static int idle_cpu_without(int cpu, struct task_struct *p)
>> +static int idle_cpu_without(struct rq *rq, struct task_struct *p)
> 
> This might need change in the function name too. perception here is that, is the
> CPU idle without task p.

Yes right, I'll rename to idle_rq_without() in the next version.

Regards,
Pierre

> Otherwise LGTM.
> 
> Reviewed-by: Shrikanth Hegde <sshegde@linux.vnet.ibm.com>
> 
>>   {
>> -	struct rq *rq = cpu_rq(cpu);
>> -
>>   	if (rq->curr != rq->idle && rq->curr != p)
>>   		return 0;
>>   
>> @@ -10247,7 +10245,7 @@ static inline void update_sg_wakeup_stats(struct sched_domain *sd,
>>   		/*
>>   		 * No need to call idle_cpu_without() if nr_running is not 0
>>   		 */
>> -		if (!nr_running && idle_cpu_without(i, p))
>> +		if (!nr_running && idle_cpu_without(rq, p))
>>   			sgs->idle_cpus++;
>>   
>>   		/* Check if task fits in the CPU */
> 
> 

      reply	other threads:[~2024-01-04 16:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-03 12:56 [PATCH 0/2] Small cleanup around sparse report Pierre Gondois
2024-01-03 12:56 ` [PATCH 1/2] sched/topology: Annotate RCU pointers properly Pierre Gondois
2024-01-04  9:54   ` Valentin Schneider
2024-01-04 15:46     ` Pierre Gondois
2024-01-04 14:54   ` kernel test robot
2024-01-03 12:56 ` [PATCH 2/2] sched/fair: Use rq in idle_cpu_without() Pierre Gondois
2024-01-04  5:15   ` Shrikanth Hegde
2024-01-04 16:12     ` Pierre Gondois [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=647e6f54-8247-4ee6-b2ed-2b49bfdece06@arm.com \
    --to=pierre.gondois@arm.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sshegde@linux.vnet.ibm.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox