Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7804765rdb; Thu, 4 Jan 2024 08:12:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IF8Zx1aNiVGC4nbzL6ZvvICBIJ/kh1+JzFNfZS3hLkzj45qh6FathVpUMAIAUBM+Ni77y6f X-Received: by 2002:a05:6808:20a1:b0:3bc:2a40:f201 with SMTP id s33-20020a05680820a100b003bc2a40f201mr959413oiw.81.1704384756940; Thu, 04 Jan 2024 08:12:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704384756; cv=none; d=google.com; s=arc-20160816; b=yCIrwL9cqyglllj8J2SKB2GMVQmjZpfOXVfi1hUyHaTJo8bq77a4IMt27H9Q3ZD27t Zci3pl5vyvwJdj3Wf/chBME/bbkEaUnw1n/J48D6bchzAhhx19LK7/c7DaTFKWE3OZa5 aZrBEgaUG7LBszlxbmuxsebNB8tCW6FRt31w/RFDBduKPFqHd38byAp2vYNWKUx3+cyt iITE8GtbbF6IqIJIL0ZSLPo/Uokj1ZogsT0IY3swVdsylAoI63okXpnTqi0B6KuY3KI2 BFE69j1Zur7KjIWPGY3+g3ZwE/ZkZ4YSCjIOILDoTC8ZBnNm6V81t4lCX5AMkeeWwuXh GJtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=F6gw72+4mzqoNB/6XPXr6Y0qv4tHJtQFoMA9J5iljWg=; fh=Fz/P11/d0tq6vB3NiGhI6fls/xL8469//hhlo5KEI7o=; b=d9IcreISPRPvbCYyU1F20Ce6oltETbKOWm+xfGDSSrTfncUS93/zNri3Sj1W1NzCmD D/Cum9USc8vG4f4iGsAlAYOcq7WKsZfsS4tS/3h+GZAbI/eP0BwXkr74Ox/8Wu8nGsle wDIgtfbIWF9l8z2ccw1dvA0NIwCSehJSAVIEQ9wzgbofDgWwRiFUblDTgbaXM8CLz7E+ 1xsU0gM96NaRz8xvtT97IR5nQIMXbyM/zfleq3+P1M8OnIcjdM48VuRGrvKrJIQT1u2p aP1db5nMQN3vgpt8no+P+mzm2OaB22/BwxiOycrNfqLXveRJkN0ydUu/O7Qw0ts7pOgn KSmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-16909-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16909-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x27-20020a0cb21b000000b006809d5461a6si12535955qvd.510.2024.01.04.08.12.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 08:12:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16909-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-16909-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16909-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id AA6DB1C221B5 for ; Thu, 4 Jan 2024 16:12:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C9D424A1F; Thu, 4 Jan 2024 16:12:29 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 21D5A24A02 for ; Thu, 4 Jan 2024 16:12:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 537A9C15; Thu, 4 Jan 2024 08:13:12 -0800 (PST) Received: from [192.168.1.13] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C39473F5A1; Thu, 4 Jan 2024 08:12:23 -0800 (PST) Message-ID: <647e6f54-8247-4ee6-b2ed-2b49bfdece06@arm.com> Date: Thu, 4 Jan 2024 17:12:22 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] sched/fair: Use rq in idle_cpu_without() Content-Language: en-US To: Shrikanth Hegde Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org References: <20240103125648.194516-1-pierre.gondois@arm.com> <20240103125648.194516-3-pierre.gondois@arm.com> <75b01ec8-dda9-433e-8980-2d94593dd80c@linux.vnet.ibm.com> From: Pierre Gondois In-Reply-To: <75b01ec8-dda9-433e-8980-2d94593dd80c@linux.vnet.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 >> --- >> 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 > >> { >> - 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 */ > >