Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp386268lqp; Wed, 12 Jun 2024 04:55:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU4OKD5EVbkwuwMsdB5Vc2TgD25wlV4VeNvfp0gbCxh3zNagPL7im5NyFBDl+OJWp3ZRKURTqNs4vudZSAhP/5CkGXdTesfMxQAGdrQ+A== X-Google-Smtp-Source: AGHT+IHCBFtivZNHJg3i5/hVkGvswWB/8nUtbYBTxKervykU4B+UGjxysNUSedCkGZw1IhNlwLyr X-Received: by 2002:a05:6808:2387:b0:3d2:1cde:52ce with SMTP id 5614622812f47-3d23e02eebdmr1762498b6e.22.1718193334078; Wed, 12 Jun 2024 04:55:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718193334; cv=pass; d=google.com; s=arc-20160816; b=chfxDZEUka03FE7tZBIPhLDUPOnEkMWB4dDnkXjCT9jM7rHk8C78DRjJClUsBrZQJy xB4HdWYW30LuwVXwigVmOyOWV6H+J9hQ6RjRyIThiCvGWCT5xsx9wxjLsnSygh9BUNM8 lby5nQm5ZbWTN0Sf5sZzsNZP9+LfXOilUwETaAjMTGG/7h25gb8CKBRiNh6ZlzELQzur Nj/zKRj74c8MFi7hiJtRt1hvnOnNdVt/sIJXwKBM9ySoKDVPP4ISYHPJGDbhXmwmY7JN g9nknSJJgSJ6tCCIXK4VwER1DIG021kFEPV3ghfy44Vw/T0o4FEF4RwHEiRuPZAmXYlX BEFg== ARC-Message-Signature: i=2; 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:message-id:date:subject:cc:to :from:dkim-signature; bh=oAXgHWrS1mgeDa6+LCBQEaanBVXAXlIttS5LPoYf4c0=; fh=QJe8qyxueLid1+g/WWVpC1bT0FUfKAuaBvrSZ2HMw1k=; b=XurWmGzITvNkt2dW/x3tMb1U5V7EKisYwZswkEeM1OaiEs3NDJq3UYJ7BRuEaM5jbc 2TZ5dTGrW7SZs6HCL4gOO0xtpgdrQ3hCodiSsY8HJKKGzupsAQGNEHT5kyDlE+hy/H9c Yx7pUIivh5JlRCp0jyJGpcgzrko59qRYCZFTQ/lee35tQDywA5NK+7xzI+1euV6lmS4M OBp81Z/LkSw4l/bePhfvH1nPJYgHV91nevsUlP0513Uc6iI65gLJM40kyrgYdO8dZRUk StKp1eCq3sDcpSJUMIR1v1/xGGaoJ4SWwHS+l3GbwGvc8I8lhQmCX8NJ/KQ/Wdw2/S2Q vIEQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=N19E3IGY; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-211444-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211444-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e7f83b2114si7929539a12.387.2024.06.12.04.55.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 04:55:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211444-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=N19E3IGY; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-211444-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211444-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 04A542892FF for ; Wed, 12 Jun 2024 11:54:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 964D416F0EA; Wed, 12 Jun 2024 11:54:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N19E3IGY" Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E193381D4 for ; Wed, 12 Jun 2024 11:54:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.67 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718193267; cv=none; b=nu4fIeTtgjeU0KLmpodgUujH2+sWsMjEDXLtI4MeoVGMSp5wkSrBY6X3K/rH+CiNVb5MpSV40OA4QfCZcXgBo2zG0PM3t3chE5GqP1iGf5pMIFpAJkEz9otoJRAwHirSNH5uM1uqXyk4lkDfGJ+yGBOrj4tFtYHTgWfWxigp9po= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718193267; c=relaxed/simple; bh=yQ9nVZWMADlJlNVpW4Xg5FcuqB5RW/gA9gxat89msBM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=kTJLdaxXF9wo+mlRKO6sdgBZ9eSLtQ0VeGVnox0hzdEEpa6Eh7wT+kYVGAh5CZ4ghjRQC7wLmgBHf2ELWWH9s+7p43hYQ5zD9etY5SlfILZGmEnpoZdbMpTOAi9GzQbMpozQ9C574UVuLMl1/pZ2X5DeN4+y2QUMK6Y9xwprVhk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=N19E3IGY; arc=none smtp.client-ip=209.85.216.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-f67.google.com with SMTP id 98e67ed59e1d1-2c2dee9d9a1so3209818a91.3 for ; Wed, 12 Jun 2024 04:54:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718193266; x=1718798066; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=oAXgHWrS1mgeDa6+LCBQEaanBVXAXlIttS5LPoYf4c0=; b=N19E3IGY2te8ixGWuLAWR6las/xaWVSOxTmhmr/rBw463TVvNf33poKDF7OyaZYrs5 QayPoryWFT+zDqm8at21fbROxDbN5Yg9TRQz/jD8OH0wfO8KfTcESPXP0k0zbWNnuFkE kMK+Up1YHhrgjxk+wzU+jmz9KdRVcGPSfLqekmeySE6iD3tGv/RNHx/ZqzK/1Rr/NoPi 80rLZsfMkRaUfN7P95bQnc2zfsSaPnABvin7TWZCQqzRH69WsoybwlECFd4CJ3bnvQDJ iOKSy8uAuQNzykeL/IikiNsvWnNJ2Q9xtlq1bXJ3Kq/8DNcSGTGWO0Tg4mM/3YmMt/WA zrxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718193266; x=1718798066; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oAXgHWrS1mgeDa6+LCBQEaanBVXAXlIttS5LPoYf4c0=; b=ARc6MIMwHbjUgT0GBScMs61GJnElljO/WTexRj1szfYQcSJrjOtQB9AVBT0sr+3k3o cCp+NnMcDD5572iLa54BQ3lxZGy/r805GPUVbjxTcdUJAxWVFv1Q1cjQlQcOx8ARy2Un UnrwexyLtm6wOyH2Uq1nu3EYi2jOdj0ivyRcS9xnTX4khCR8d9RAocqTFt3QQP1gf7HH 8W9lcUC+Diztadjr1TYxUi5D3nD4ro4LkJt7WmqGY+rqwQzFm9wQSl7ig8kZGjpzHRpz oM0z9NmpFxWLGdHvNXxMpfGuZ8cp950YuMAZ75510STs1S3zU97U1Cdb4Z3kItxkhHLC 95nw== X-Gm-Message-State: AOJu0YwhaX1NqaX0lJg+xKNFF0tdy9DPAYiFlLbVbrLeaPxKruMjLzkI yNymcyfTmP/pKbpznBPp8nHjXAdkE+i2uisA13h3sDZUm6suYSTC X-Received: by 2002:a17:90b:1001:b0:2c2:faf7:67a0 with SMTP id 98e67ed59e1d1-2c4a7624aa7mr1520726a91.16.1718193265634; Wed, 12 Jun 2024 04:54:25 -0700 (PDT) Received: from A03-R28-I229-36-543TLP2.JD.LOCAL ([106.39.178.37]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c4a75deecesm1529373a91.12.2024.06.12.04.54.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 04:54:25 -0700 (PDT) From: zhangwei123171@gmail.com X-Google-Original-From: zhangwei123171@jd.com To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org Cc: linux-kernel@vger.kernel.org, zhangwei123171 Subject: [PATCH] sched/fair: prefer available idle cpu in select_idle_core Date: Wed, 12 Jun 2024 19:54:10 +0800 Message-Id: <20240612115410.1659149-1-zhangwei123171@jd.com> X-Mailer: git-send-email 2.33.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: zhangwei123171 When the idle core cannot be found, the first sched idle cpu or first available idle cpu will be used if exsit. We can use the available idle cpu detected later to ensure it can be used if exsit. Signed-off-by: zhangwei123171 --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 41b58387023d..653ca3ea09b6 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7341,7 +7341,7 @@ static int select_idle_core(struct task_struct *p, int core, struct cpumask *cpu } break; } - if (*idle_cpu == -1 && cpumask_test_cpu(cpu, cpus)) + if (cpumask_test_cpu(cpu, cpus)) *idle_cpu = cpu; } -- 2.33.0