Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7103313rdb; Wed, 3 Jan 2024 05:00:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVf0hbLE8UiUBdmq53I4yv0TDl3tEOu4GPnYt/RJ9V8CaW4vWTRYTKZRWEjMxWuvpcx7/N X-Received: by 2002:a05:6a00:1a87:b0:6d9:b9ba:fc7b with SMTP id e7-20020a056a001a8700b006d9b9bafc7bmr1232374pfv.33.1704286800876; Wed, 03 Jan 2024 05:00:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704286800; cv=none; d=google.com; s=arc-20160816; b=GAb21Gw9UMhw2EobBh9M6Fu+Y89M4zFXpxeU2BAtzUoGUm99OtYarh8PN/9U7JFpWY AfBaEqvin8yIXTLptqYL+KuLjrbjoSdy6UEYY8kDGjFKPItFLMHO1ea5YOqgS3kW2D3s u9gpKaIRRqohTjALLfygE+QEKX065YpGrcUXcbX2t7fxphy3SlGNZxSn6h+TNdlofBKH bMKrD1IQSuEPFr5uhtOmOlOa3wdWM81brHiHAwPRiyCM4vX0xORj8G+eDPQlnBnfsMXM 3pZeEDJkrFjIBEqsanzG2yLg5ytgr3UBD2ypJGo/oyhNuRP11Ud65WPbOuobGEVEa7tI 0LPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=FeCqbc2tDZuVhUKULEb0wAN6vdmGIRjgs8NnCRNp+kI=; fh=q2O5b0D4J2cuSJyaPE284WzuH6G1SvLUKX1oUTIo+oQ=; b=hHso2M2OK/QY3kKVX5fOeLNh05MufilRXV/xjtWjQDUr2Fxdl/oD7e0hIjSR0xqb3U brJ1hjgwe4BbnKdT2Ep7DWFX2pPpLYrbr/kRH3Rzgmn5Or+smFxQXkjuQMOUkWkfmy8C 55M4q5nxRDV2uzVP+wyzMwRkRUQxk2UetqbZg65pagv57kvD1DD+vdp0pHPwZPQ4AUhI k6ZBXHd8sidibrq/qWRG8ivtk6KA3XR3+nMfbN1F9lbtQq9eocsJKm0t8p/fJykMfx7u WxjICjsiSbxVoC9BbKjK9PbqPHtakMey8WDf6kIoMObgnW/dnrTKrvhoJWk5eA1fvoLX fYzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-15544-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15544-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o19-20020a056a001b5300b006d9927778d4si17907862pfv.405.2024.01.03.05.00.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 05:00:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15544-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-15544-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15544-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id DB0B62813B1 for ; Wed, 3 Jan 2024 12:59:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 415CF1A29F; Wed, 3 Jan 2024 12:57:03 +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 DE76B19BCC for ; Wed, 3 Jan 2024 12:57:00 +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 0D95B152B; Wed, 3 Jan 2024 04:57:46 -0800 (PST) Received: from e126645.nice.arm.com (e126645.nice.arm.com [10.34.100.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6AF2E3F64C; Wed, 3 Jan 2024 04:56:58 -0800 (PST) From: Pierre Gondois To: linux-kernel@vger.kernel.org Cc: Pierre Gondois , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider Subject: [PATCH 2/2] sched/fair: Use rq in idle_cpu_without() Date: Wed, 3 Jan 2024 13:56:48 +0100 Message-Id: <20240103125648.194516-3-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240103125648.194516-1-pierre.gondois@arm.com> References: <20240103125648.194516-1-pierre.gondois@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit idle_cpu_without() could receive a 'struct rq' instead of a cpu number to avoid converting the cpu number to a 'struct rq' two times. Indeed update_sg_wakeup_stats() already makes the conversion. 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) { - 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 */ -- 2.25.1