From patchwork Wed Feb 7 03:47:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexs@kernel.org X-Patchwork-Id: 197725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1984922dyb; Tue, 6 Feb 2024 19:56:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUPERtmI9ERBCwxJ0HG4EcsS4gB3MIlQQ+YhwHEkqorH8zf43fUc9t2x0YtQijGQVxrh8YQzD2bKeb9G9aXK0vrLpCdOQ== X-Google-Smtp-Source: AGHT+IFH3lY6sEQ/8xO1dCZRiNjD7AYlfWqk9AdXt07dyXZejOys+RFpi4sNR2ExfIQDt9Bijb1t X-Received: by 2002:a05:6902:2847:b0:dc2:5553:ca12 with SMTP id ee7-20020a056902284700b00dc25553ca12mr4201602ybb.14.1707278167519; Tue, 06 Feb 2024 19:56:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707278167; cv=pass; d=google.com; s=arc-20160816; b=XwEZ7BGNf74bQMoZEwB5WVuDURCcktUImswB4brzu+4Oh/NMCeaG62auzq+D6y2wn+ QowXL4guzXJtDKFLnOWWW1z8cNnihQQwWeFqsJB3aGnCKMiZRxyVF2D3zgr8Nw6ZOSTU JMh79xeQdpz96oEtGHu8wFKa/MJYD6F+Tg6ALszMYXJZobUmlPg4Y4Gf0hkyC+aSA+2C fWNRUJ/zWd8XKT9k5qvAoF8xIUcrtgBDGHMFwrZpj8byJWd80N1QaFXa0I4bIBRzyYBr 86cDT+rC87dv0x1YFS8bPOEgdKQNIf7DvVPGx7FN+f+HwocziVD1FD0ZBL9Qe/wIZ0z4 ojOw== 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=5+hZBjq6GH2fdXcTSYktDVP+nwXHAjtey9f1/nH6+hs=; fh=SuMIPsKSigXdZn3vYf6IwFdoj9SpbTmQ0ufMotKUrYo=; b=ZSU3g72GU0rhMB5gFl7UHF8cfFCTp8Zhn2RGY1b+BpGSoPjkUQpIuAkAiashXb/9SX /4wtU/0nFHVIB2STpiITfx0vNbVc2vBrEKbjpwdlZfG47zJTtMfrJLXCPgW9sECh8n+e gtKjvTcypx5gN6qQjoUQNzASAjP12iuJejOmfkpCsn8VEaHW5UdwuG+3dzRmHUUG32rW 6ROQaDt+6vTg2tEIYcppdzc51YQ7iCNsLmMvUlF/5sQWZS/n595JEo4S8HgjpZIQawkx PWntMYuK0LSf2vv1GGJYMuTwiUAbOusD40HL1lEzopfPpbV9OP0HIzzkiv1dYxhcqVOk gRQQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lczDQgnf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-55905-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55905-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCXxikVqkvd7HSJCiVy0dhvD0RoqQkjjg8UN/hriN5jA4OhOaPc0s7G6E/yB3KsszAZO4DGZ4qIr8sd9QjKb4ABeKxYr9Q== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id l28-20020a63ba5c000000b005cdbeb8228dsi499422pgu.433.2024.02.06.19.56.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 19:56:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55905-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lczDQgnf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-55905-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55905-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 26171B292CB for ; Wed, 7 Feb 2024 03:44:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B39514AB2; Wed, 7 Feb 2024 03:44:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lczDQgnf" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C554B12E74 for ; Wed, 7 Feb 2024 03:44:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707277450; cv=none; b=DHc1T0fK7sLWmJsFcYHpOBV2MIyGK9WlNymvOEUFcI5LZiq38CU/6zyAcU3V/6UmuY7x2YeaXFDsD3jGKDx3vFvu9JANSdVquKbLmVAdnw2atjmy8uA+dtgogN7NsI1LYH1OFJpvfl1bvGz/imyyDPyBlngxh+w4ddhDR+G/FLg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707277450; c=relaxed/simple; bh=7vUiNV5G3nvvwfoetaYLt/ii5ihVPI2ja1/aLjEI590=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qscFHHmNAiJYDHZJuwlcOZ9/OqzWfoampphDLhvL73eVTOt/ipFlF/urBdT8DbWPmjqZfe97RNDVXBn+ZwDC4NPvAzpzhCDlrw2NFIrhyrnwW2KEXJaRWcLvuNJ8cQ3l0AoB6W9uBRjOkG/yyjmfPjaTJQjqHXyl593/r+dhDts= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lczDQgnf; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B701C433C7; Wed, 7 Feb 2024 03:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707277450; bh=7vUiNV5G3nvvwfoetaYLt/ii5ihVPI2ja1/aLjEI590=; h=From:To:Cc:Subject:Date:From; b=lczDQgnfgJOCY4MK/ePzFHE6JOGKVK8GTmB6IaxhfwXYjnpCndTNp392dkhjX8MaK TddRliBpzoeVAdGAUV4lEhA0WsAgm6z1stDQWyrY3JgjK9aEmpomLCi9zOToOsBuGo ygqCFnhLcXEG4V8YR7+ScGCyPzCtfz7Sprl9026ckxNUagfUv0aW5hj5HvJrDzvjEM 9bQMEJN7Zl5thJCqnPvCtyxGS43vu30Ue4JKOtyJgnkWtOlSfQ5swhfesApv80T/VO 5V3T7k58nNF7Eqc5II3Ka/UIq2lEND0ZdEaIrlgAXr6689pIN7UX4chlgGeswf3tfT Nkj+2BSao0WoA== From: alexs@kernel.org To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org, ricardo.neri-calderon@linux.intel.com, yangyicong@hisilicon.com Cc: Alex Shi Subject: [PATCH v4 1/4] sched/topology: Remove duplicate descriptions from TOPOLOGY_SD_FLAGS Date: Wed, 7 Feb 2024 11:47:01 +0800 Message-ID: <20240207034704.935774-1-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790210911613844723 X-GMAIL-MSGID: 1790210911613844723 From: Alex Shi These flags are already documented in include/linux/sched/sd_flags.h. Also add missing SD_CLUSTER and keep the comment on SD_ASYM_PACKING as it is a special case. Suggested-by: Ricardo Neri Signed-off-by: Alex Shi To: Valentin Schneider To: Vincent Guittot To: Juri Lelli To: Peter Zijlstra To: Ingo Molnar Reviewed-by: Ricardo Neri Reviewed-by: Valentin Schneider --- kernel/sched/topology.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 10d1391e7416..0b33f7b05d21 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -1551,11 +1551,12 @@ static struct cpumask ***sched_domains_numa_masks; * * These flags are purely descriptive of the topology and do not prescribe * behaviour. Behaviour is artificial and mapped in the below sd_init() - * function: + * function. For details, see include/linux/sched/sd_flags.h. * - * SD_SHARE_CPUCAPACITY - describes SMT topologies - * SD_SHARE_PKG_RESOURCES - describes shared caches - * SD_NUMA - describes NUMA topologies + * SD_SHARE_CPUCAPACITY + * SD_SHARE_PKG_RESOURCES + * SD_CLUSTER + * SD_NUMA * * Odd one out, which beside describing the topology has a quirk also * prescribes the desired behaviour that goes along with it: From patchwork Wed Feb 7 03:47:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexs@kernel.org X-Patchwork-Id: 197723 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1981390dyb; Tue, 6 Feb 2024 19:45:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXWChkVrnStXzUpSB96SpXi+dhNM7SS17QGgDiQ9csO0QQrJmIyQ7rMRBo8JBGiUYrQoVrJm592JW8dxvQTS0yNS9B5JQ== X-Google-Smtp-Source: AGHT+IFXgHitr5w90d9Msn///J0FH4VbeVO12uyyl6dibIfQyak8uC4ZkIXf+JQcj/LRdN+fkaEk X-Received: by 2002:a05:6a20:8f07:b0:19e:9dc4:522d with SMTP id b7-20020a056a208f0700b0019e9dc4522dmr2708593pzk.2.1707277509568; Tue, 06 Feb 2024 19:45:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707277509; cv=pass; d=google.com; s=arc-20160816; b=iK539b53MaZsIsNPnl2TozkEwBmeHpxojJgQ7TqxBJbyOdfilV+LUOp5aMtBZtwlei cyZH+pwTHDaHzgUVeKtX0x7XbHVjZWBRBHgPZIGmyu5PxDueSh6Ec4Hihy+gpsRl5zyU l72rkSbtHPzWaVLpaP6JFqRRuORNQGCgjk/fhHY+xwYQB7Gnrm4RbdNF2jbl0p30dZHO 8ZlaCijCf/MAlxs4muifB9mIPVaniuJEJGjyASLXJWCJFAw0rwnG51+tfL1cQQNxErRM PlkwWChom7oh5iUuhI+vcJv9msf/ONhfjIWwDqVWYuBFxJvrq/W6ja5UqeYs22YtNElB L62g== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hC+wTqBhmX1pbzHJm2ef3XAbHrltQyryPIKacY/kE18=; fh=LCmw56rM0E1npX/1TlTnP8S4vn7w7RBpAckxM7AGlxo=; b=vvI4rHEHeFSKg+IZzLtGsGZfluEZcNuP52HyuySm2nHEWvrDikG5BXgxM5yxGfOqXd TBwTmwn5KGiDIzZNW2tKcHm6kzzwriGdVzCwSxsDC90vIAHOf6rFM0pzbIYzac2yeXHV EguPQj5UbcXG1ZO5lhq2OusHHT6okRETzm2Sa98ikNHrk1HIiH3sJxW8MmL0E0dldv+7 gjMpObA257vmJfz5s/uO2bNMUvnbzV7ggRpDdYaHOqQf2uWRSZYRLxg5OouPG3H4Aim6 wfrbixginnttmCzu1GUFXIHx+BkEeFidNQVarkdWC13OlcmPu4LpDRtqa5AEZb6v18zw 9N2g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="snmTf/yo"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-55906-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55906-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUyyW+5AqRVCy79NQ5gmMl0IPmnet9tAUMkfHwvDsSpMr3d/EyiDmBgPO0+9JjDSjU9c2D9CTPKin7uw4ZwsnsWoBFZOQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l12-20020a65680c000000b005dc35c340a1si151126pgt.9.2024.02.06.19.45.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 19:45:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55906-ouuuleilei=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=@kernel.org header.s=k20201202 header.b="snmTf/yo"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-55906-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55906-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 C7E0C286A12 for ; Wed, 7 Feb 2024 03:44:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1978E1BF3A; Wed, 7 Feb 2024 03:44:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="snmTf/yo" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63C6615E86 for ; Wed, 7 Feb 2024 03:44:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707277454; cv=none; b=HrDmD+ddv1tML/mGFrveXp6Jl2E43J/u4hG6AaYGKZIcCpDNCl3hXLmXTIN9Sn626mVeQS4cp/JzXxhD+d/8FrIRAU9D1fRFUIvILcaJUCvw3hpJbIbch+kqKYGEfNM4oJnv752jkSOyoPPTWxrl7zxVvvJY5GQHASc2ERfwZH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707277454; c=relaxed/simple; bh=8blD+uBMrelaCyYwKVTuyE+VAFxDX4apKVm3xaEDk4Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=keudBAlMtGxwBFwZFGrsZ7ZthJ3GEprlqBzWIFIoqi2dEmMR4Abee2NrsxouMY9S19n1R/tNlGBL6qwZz/zNZCtmUIAmeuVjftGrgLMuOMlR3M5VT0DZhHvGvEAn8xuMtj3IZ3DdTeOXBsk3lscVOblKt4nDKPUVm3es38pUYXY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=snmTf/yo; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8F0BC43394; Wed, 7 Feb 2024 03:44:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707277453; bh=8blD+uBMrelaCyYwKVTuyE+VAFxDX4apKVm3xaEDk4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=snmTf/yoiXRg69vxtX7HWuGaeYpHFH8rX2TAMaj1+FoxJ46nelr6wtU1GUAU0aOa3 8w1kNKdQjyes4Ej/qWfhAcADRJpkS3R179ZznsS5lsR+4uc4KFNewrP6EXgxKGVjor d0G94TZHis5V7bV6QfNGvsqYT0hzQf00b4dLjAR20IbPI2ocNeXIKqrBzzh1cuxh3M mNd9HcTmNNx+lgh+yDeW9/vIV4SQGPpkOXnsciyzbHnTJTfQ3qDyvUCFE83AoINlQh UO36mcMZY/2tC31RoJdN7ljPUxZAcWLcDTh/2e2Fc5K3gxMzkpfA6eB3P4V0vvIVvo rYizEE1JSLfVg== From: alexs@kernel.org To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org, ricardo.neri-calderon@linux.intel.com, yangyicong@hisilicon.com Cc: Alex Shi Subject: [PATCH v4 2/4] sched/fair: remove unused parameters Date: Wed, 7 Feb 2024 11:47:02 +0800 Message-ID: <20240207034704.935774-2-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240207034704.935774-1-alexs@kernel.org> References: <20240207034704.935774-1-alexs@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790210221660730550 X-GMAIL-MSGID: 1790210221660730550 From: Alex Shi sds isn't used in function sched_asym(), so remove it to cleanup code. Fixes: c9ca07886aaa ("sched/fair: Do not even the number of busy CPUs via asym_packing") Signed-off-by: Alex Shi Reviewed-by: Ricardo Neri To: Valentin Schneider To: Vincent Guittot To: Juri Lelli To: Peter Zijlstra To: Ingo Molnar Reviewed-by: Valentin Schneider --- kernel/sched/fair.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 533547e3c90a..607dc310b355 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9749,7 +9749,6 @@ static bool sched_use_asym_prio(struct sched_domain *sd, int cpu) /** * sched_asym - Check if the destination CPU can do asym_packing load balance * @env: The load balancing environment - * @sds: Load-balancing data with statistics of the local group * @sgs: Load-balancing statistics of the candidate busiest group * @group: The candidate busiest group * @@ -9768,8 +9767,7 @@ static bool sched_use_asym_prio(struct sched_domain *sd, int cpu) * otherwise. */ static inline bool -sched_asym(struct lb_env *env, struct sd_lb_stats *sds, struct sg_lb_stats *sgs, - struct sched_group *group) +sched_asym(struct lb_env *env, struct sg_lb_stats *sgs, struct sched_group *group) { /* Ensure that the whole local core is idle, if applicable. */ if (!sched_use_asym_prio(env->sd, env->dst_cpu)) @@ -9940,7 +9938,7 @@ static inline void update_sg_lb_stats(struct lb_env *env, /* Check if dst CPU is idle and preferred to this group */ if (!local_group && env->sd->flags & SD_ASYM_PACKING && env->idle != CPU_NOT_IDLE && sgs->sum_h_nr_running && - sched_asym(env, sds, sgs, group)) { + sched_asym(env, sgs, group)) { sgs->group_asym_packing = 1; } From patchwork Wed Feb 7 03:47:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexs@kernel.org X-Patchwork-Id: 197722 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1981338dyb; Tue, 6 Feb 2024 19:44:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGK/Sho8wHsGT+6JyetI1nOqd1wUPVfq++6A8sjDqChmbotnzZJOjJzhlWu899fkiCuMyI4 X-Received: by 2002:ac8:554a:0:b0:42b:f0aa:3b2f with SMTP id o10-20020ac8554a000000b0042bf0aa3b2fmr4426682qtr.42.1707277499772; Tue, 06 Feb 2024 19:44:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707277499; cv=pass; d=google.com; s=arc-20160816; b=KYLSZV1XxrOLmDK7LJuQ1VI0X5EAEDQPKJTrYeZFASRbrxoe1j+DS0Z9/4bFuU75Nj 7bnLhEIgY/WMikhgwTbShBJoMiHnk5seU0AZzEyUg7qobdbflUCEib3u6CbFyEGs2Fu6 XFzZ7nLyIQYjGLoiEdhw0YfICmkTEYrq+P/TEwEyqZDzO/aiH2W5ou+icBRd1C4H1mFv CRD0uo3M1vvdsTygRZctDR2oVi5m7nX16mXXnyySGce9Sd43IxzzMN6u3j989iykoQfg tPpLjAS/bkSD/DHJ45l82OV7HNmNxp4Q20t3rmze721WEu4qOzly5tldp/WynubVt3gI C1MQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hoLgI6tgVplVDKK3BnwI+V8rgXQ9re+fu3yG12BK0Pg=; fh=NBpwoF15zOm/VJQPRd0MQ/6rlkXq13LFJWeB5txr0mg=; b=C0+hWgNlFkykjjc9dwBzPerODftNzmDMELR0gcTU+DmT3qU0l8Q4bd36WyqDCl7CjX uNtNdZkrUWerBBOsVG7wmqT8Uv7knEYKncjeoZ/moYEGczHTJvi3s0KoUm7PrwgUQ19n 9qjR6t2pgB+IaAOsKTghym/JG+C8YY2HQgcd2d5LFH9OcGRBXh67RxpLkDSPxlv0H+Cx hDNxE/RwSZI9+zGXS7NAmH3njhbZRlaVVyTreDT0llAoKB5Wv+Qj6XmFjljW9ZGfOwwy cvRUSVDuS/kCSpcXyx59Qlz7KgSp9cBmLwvW9/livZbm5fx4K6KOfgJS9xoI5WJFgq7e 5Iwg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tSWUTl5M; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-55907-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55907-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUSL1ay0po9voi4oI4CnCUjjHmjcshn9ZJ2d+3Yf1uFXKqenuBGx2eYSTx0JKVSODp4XFR0TiivP11swLzxQNxPdhwXuA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f20-20020a05620a12f400b0078564385e39si340576qkl.372.2024.02.06.19.44.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 19:44:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55907-ouuuleilei=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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tSWUTl5M; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-55907-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55907-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 820651C24A7E for ; Wed, 7 Feb 2024 03:44:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B73271CD3B; Wed, 7 Feb 2024 03:44:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tSWUTl5M" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E28AF1C694 for ; Wed, 7 Feb 2024 03:44:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707277458; cv=none; b=nnjTJCf3epIqzGhG685VMDY5zNBwOF/n/vq9KDS8qRIB4eQNG6rk/soP1VZb9aVef4qXs6VZyUpLnoGtoR4/r/QcdSkIAWd0IzOCW+fZKI89B4Z50Z08Tp4JJvI79lWFmLEBDQOJjKWmzUIrRz//gGcdeU13bCdUc1GEsm2UXb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707277458; c=relaxed/simple; bh=ZBWabr/sl4BLAglGWdQysfp0ZTpL5iL55T/CdtsmPuA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KSs/rvFp8VYsn62nmeFgY4eEVAjKYN0oU9ZVRthPIlPC5zUPteTR7BGP17ysPHhoV2j/3W1OQv5HotN5yPzOAUIxDRIJwSXOQmGsI732Hq0Za5dkoP2sMPVEQ0NtG8T8R3MzcSqeGVNWEWstHlYwe2ALYcmlI0n18U1c0hbPFso= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tSWUTl5M; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59F2DC433F1; Wed, 7 Feb 2024 03:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707277457; bh=ZBWabr/sl4BLAglGWdQysfp0ZTpL5iL55T/CdtsmPuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tSWUTl5MrVR3aRqaLNPAk0UvumXyYjyTudHP0DvKUQpEUu8DiZdBWzjLL3F7C8MED JcjrVw3T/pkkEP/V/FSUU/hlGHNoNKKDoqC5ay/0S8uu8PGzom6PTfAzDgsq5PQN/X BmFs3agVrqKEKfVS7TAVYDB2KztXTTEgQSTc1EA3hjRWZVOZeXGi21cr+Hi9bKlsjL 1NhuATAg6EMERrch94F3xAUivLqTF9dCXFOn9eRs8idRL+0uvdkQouBqL5mtghLeQa CFYJo3eAVYuLP57L1h7rUcMlVMhqliBsYDtQfGEnLeFm46k1E53Ihf54MUq/VVPf+v LvD1Obi8r8odA== From: alexs@kernel.org To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org, ricardo.neri-calderon@linux.intel.com, yangyicong@hisilicon.com Cc: Alex Shi Subject: [PATCH v4 3/4] sched/fair: Rework sched_use_asym_prio() and sched_asym_prefer() Date: Wed, 7 Feb 2024 11:47:03 +0800 Message-ID: <20240207034704.935774-3-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240207034704.935774-1-alexs@kernel.org> References: <20240207034704.935774-1-alexs@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790210211610530825 X-GMAIL-MSGID: 1790210211610530825 From: Alex Shi sched_use_asym_prio() sched_asym_prefer() are used together in various places. Consolidate them into a single function sched_asym(). The existing sched_group_asym() is only used when collecting statistics of a scheduling group. Rename it as sched_group_asym(). This makes the code easier to read. No functional changes. Signed-off-by: Alex Shi To: Ricardo Neri To: Valentin Schneider To: Vincent Guittot To: Peter Zijlstra To: Ingo Molnar Reviewed-by: Ricardo Neri Tested-by: Ricardo Neri --- kernel/sched/fair.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 607dc310b355..942b6358f683 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9746,8 +9746,18 @@ static bool sched_use_asym_prio(struct sched_domain *sd, int cpu) return sd->flags & SD_SHARE_CPUCAPACITY || is_core_idle(cpu); } +static inline bool sched_asym(struct sched_domain *sd, int dst_cpu, int src_cpu) +{ + /* + * First check if @dst_cpu can do asym_packing load balance. Only do it + * if it has higher priority than @src_cpu. + */ + return sched_use_asym_prio(sd, dst_cpu) && + sched_asym_prefer(dst_cpu, src_cpu); +} + /** - * sched_asym - Check if the destination CPU can do asym_packing load balance + * sched_group_asym - Check if the destination CPU can do asym_packing balance * @env: The load balancing environment * @sgs: Load-balancing statistics of the candidate busiest group * @group: The candidate busiest group @@ -9767,22 +9777,17 @@ static bool sched_use_asym_prio(struct sched_domain *sd, int cpu) * otherwise. */ static inline bool -sched_asym(struct lb_env *env, struct sg_lb_stats *sgs, struct sched_group *group) +sched_group_asym(struct lb_env *env, struct sg_lb_stats *sgs, struct sched_group *group) { - /* Ensure that the whole local core is idle, if applicable. */ - if (!sched_use_asym_prio(env->sd, env->dst_cpu)) - return false; - /* - * CPU priorities does not make sense for SMT cores with more than one + * CPU priorities do not make sense for SMT cores with more than one * busy sibling. */ - if (group->flags & SD_SHARE_CPUCAPACITY) { - if (sgs->group_weight - sgs->idle_cpus != 1) - return false; - } + if ((group->flags & SD_SHARE_CPUCAPACITY) && + (sgs->group_weight - sgs->idle_cpus != 1)) + return false; - return sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu); + return sched_asym(env->sd, env->dst_cpu, group->asym_prefer_cpu); } /* One group has more than one SMT CPU while the other group does not */ @@ -9938,7 +9943,7 @@ static inline void update_sg_lb_stats(struct lb_env *env, /* Check if dst CPU is idle and preferred to this group */ if (!local_group && env->sd->flags & SD_ASYM_PACKING && env->idle != CPU_NOT_IDLE && sgs->sum_h_nr_running && - sched_asym(env, sgs, group)) { + sched_group_asym(env, sgs, group)) { sgs->group_asym_packing = 1; } @@ -11037,8 +11042,7 @@ static struct rq *find_busiest_queue(struct lb_env *env, * SMT cores with more than one busy sibling. */ if ((env->sd->flags & SD_ASYM_PACKING) && - sched_use_asym_prio(env->sd, i) && - sched_asym_prefer(i, env->dst_cpu) && + sched_asym(env->sd, i, env->dst_cpu) && nr_running == 1) continue; @@ -11908,8 +11912,7 @@ static void nohz_balancer_kick(struct rq *rq) * preferred CPU must be idle. */ for_each_cpu_and(i, sched_domain_span(sd), nohz.idle_cpus_mask) { - if (sched_use_asym_prio(sd, i) && - sched_asym_prefer(i, cpu)) { + if (sched_asym(sd, i, cpu)) { flags = NOHZ_STATS_KICK | NOHZ_BALANCE_KICK; goto unlock; } From patchwork Wed Feb 7 03:47:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexs@kernel.org X-Patchwork-Id: 197724 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1981536dyb; Tue, 6 Feb 2024 19:45:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU/eVXlVA0WUCYfmeK7OH9arvOReETYTrKQX2fDRxzwJbbtRoXGJLzxwMLuNidbX4iL+5KoVmU1UHs5u3BfcfbREykbww== X-Google-Smtp-Source: AGHT+IGLr2r2qUCaQb9uEQ6CjzwU40ANY+jvy9ZuEL4nsVJSJceiGnaZixli1vS/hl8jiXjfL2y7 X-Received: by 2002:a05:620a:20cc:b0:783:bccc:1c3c with SMTP id f12-20020a05620a20cc00b00783bccc1c3cmr3971048qka.50.1707277533722; Tue, 06 Feb 2024 19:45:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707277533; cv=pass; d=google.com; s=arc-20160816; b=KqWtTNHlawaTUX1Z7mrBpnA4KHxk+Mkj7W9sl8Sz9X8r3d32H0cPWgnGT8KqAijPuk C8vZSrtkxwz+x9mFEtm9fvDppqvvzEoHuAoyUe+3PVyPFllR7SIWWNkL4GYbHqvSkkTv dCclLjWLlWC3luvB2bYCfpJVYGi5Hk7qogFNAN8JQIftQw1XolywKXx3hzdTF/FDSr6e XBLaXI6R+7FQZwPvxMGKKIfcrXveNrKci94+Ns5R6vlEJSoed4hIYuHTwXGXVK3H6L4L 5IwYfRkOwsMWbzBAxB2w/vFUuMa+49kfYW6SDQrfy8Lh8rLN/79RslxRFBJLHSPlm+jd g5Cw== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ik2cotX23r5Hd4AICdyaM/XDRCBerV7dO7M5HlB9A94=; fh=Pkoff50d1EUFiXYMW+0sOH3E32h4/MVw4Ct5YgW6PuQ=; b=AvfyoyhAyQN8MD1ZjZkuPyDEiktfrWtgYtikSK5C96Xb2mJREOH61oConUu9a7wCpx bmH80cPP0x5Vop4mQjF9/4c0zljlyik4oJHnVN0JdN7jrymyPMZwshdZMq5iKAUqe86S cBfE94r0jJFPYmYaT0UsGCTGYUGLHA04hu4PM/49AYjWrmSwlCRXqD9v2EFmxwMo55Rd rkV3lEKceKCyPfRuHqvRFbwflytIa1VqCOZ0avQ+frtTMKtpuMgJ/IFiOFQBmk92w03C nMZVGZYSWE+00NkM3cck7Db9reYoi832QNtQzYSq9k6UklGhNhDCeQI8M5rQ8AMl/Ghw IIIw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JVqunjyh; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-55908-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55908-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCWHQldhQ2nB2BEts0DFQeiY9z0RR2QR7iIcSLCIrlTGiHZmzupTUMFcdCqOyy+HyFX/EYeSpJU+5WL++lOTOezq5JKayQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v4-20020a05622a014400b0042c2f2c42ccsi353190qtw.610.2024.02.06.19.45.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 19:45:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55908-ouuuleilei=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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JVqunjyh; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-55908-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55908-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 3FB3E1C2467B for ; Wed, 7 Feb 2024 03:45:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4098F1CFAF; Wed, 7 Feb 2024 03:44:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JVqunjyh" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62DF11CF80 for ; Wed, 7 Feb 2024 03:44:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707277461; cv=none; b=p8/kDztpGY8GF/53rdRr35G8KaapV4uAJQnUJCrgP8uKHAB4caApKQ00F6G8rwtnZaqyyUIwYfn7SZIrdEqLJ+imH99GeCn9x4hERrCF1zpEFP64y3k0836HkBaUx1ugEKGVuNPZoYEXa2MS+C8JMa+QXEAQ1+ux0AmvbPHVgiA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707277461; c=relaxed/simple; bh=JRihQeRnvMv6IBslLO3YQYd+JbOoJjzD4VVOTcl40hQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Noh0DryfFOr5uoJz4+0xvrx29k90XL6ew0ohQoEfYaCDIL1Cy85PdC2wQLPeN7l/ghRRsnQqLxVG/Ob2TmAQDSmtLn2laFb1j2bq6WXOxYwkZdbWzkp7u0FiXmK3YjMi9vStyyGNVKuurmykNOmPo1rwkzxD9hmIFgPkEQxBztM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JVqunjyh; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE4A7C433C7; Wed, 7 Feb 2024 03:44:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707277460; bh=JRihQeRnvMv6IBslLO3YQYd+JbOoJjzD4VVOTcl40hQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JVqunjyhj6v9iIXA7+241LS3sT9Zrqu2nctH3nylTQFehdPLbLm1Bh9DUwe2RVHEv 3SiRF9snGljzV3h3qluoCadqVVBBJ6y9bpUWjUG8/VRuAqnng08hvVWuRPtF/vJsdC Nd/yS6E5P3GlrE1+sqsuIRu97G0px/UEftKWACDtSVYmjzoYevAeWtCeG9KS5NxgO/ cgHFPzBjQNUqa5zhVaSYSV96MqtsKFYN6J1eMy00l/XzypTsRiRygSbxE5TfFhux6y zZYLiE4mAzS2C4jD5rkLx+nm9b0rbjYjctvzYmZ5vI0oR/SMWbLEh3oMPVcNc9LY5l Mplk7d9HIqjYw== From: alexs@kernel.org To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org, ricardo.neri-calderon@linux.intel.com, yangyicong@hisilicon.com Cc: Alex Shi Subject: [PATCH v4 4/4] sched/fair: Check the SD_ASYM_PACKING flag in sched_use_asym_prio() Date: Wed, 7 Feb 2024 11:47:04 +0800 Message-ID: <20240207034704.935774-4-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240207034704.935774-1-alexs@kernel.org> References: <20240207034704.935774-1-alexs@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790210247204491559 X-GMAIL-MSGID: 1790210247204491559 From: Alex Shi sched_use_asym_prio() checks whether CPU priorities should be used. It makes sense to check for the SD_ASYM_PACKING() inside the function. Since both sched_asym() and sched_group_asym() use sched_use_asym_prio(), remove the now superfluous checks for the flag in various places. Signed-off-by: Alex Shi To: linux-kernel@vger.kernel.org To: Ricardo Neri To: Ben Segall To: Steven Rostedt To: Dietmar Eggemann To: Valentin Schneider To: Daniel Bristot de Oliveira To: Vincent Guittot To: Juri Lelli To: Peter Zijlstra To: Ingo Molnar Reviewed-by: Ricardo Neri Tested-by: Ricardo Neri --- kernel/sched/fair.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 942b6358f683..10ae28e1c088 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9740,6 +9740,9 @@ group_type group_classify(unsigned int imbalance_pct, */ static bool sched_use_asym_prio(struct sched_domain *sd, int cpu) { + if (!(sd->flags & SD_ASYM_PACKING)) + return false; + if (!sched_smt_active()) return true; @@ -9941,11 +9944,9 @@ static inline void update_sg_lb_stats(struct lb_env *env, sgs->group_weight = group->group_weight; /* Check if dst CPU is idle and preferred to this group */ - if (!local_group && env->sd->flags & SD_ASYM_PACKING && - env->idle != CPU_NOT_IDLE && sgs->sum_h_nr_running && - sched_group_asym(env, sgs, group)) { + if (!local_group && env->idle != CPU_NOT_IDLE && sgs->sum_h_nr_running && + sched_group_asym(env, sgs, group)) sgs->group_asym_packing = 1; - } /* Check for loaded SMT group to be balanced to dst CPU */ if (!local_group && smt_balance(env, sgs, group)) @@ -11041,9 +11042,7 @@ static struct rq *find_busiest_queue(struct lb_env *env, * If balancing between cores, let lower priority CPUs help * SMT cores with more than one busy sibling. */ - if ((env->sd->flags & SD_ASYM_PACKING) && - sched_asym(env->sd, i, env->dst_cpu) && - nr_running == 1) + if (sched_asym(env->sd, i, env->dst_cpu) && nr_running == 1) continue; switch (env->migration_type) { @@ -11139,8 +11138,7 @@ asym_active_balance(struct lb_env *env) * the lower priority @env::dst_cpu help it. Do not follow * CPU priority. */ - return env->idle != CPU_NOT_IDLE && (env->sd->flags & SD_ASYM_PACKING) && - sched_use_asym_prio(env->sd, env->dst_cpu) && + return env->idle != CPU_NOT_IDLE && sched_use_asym_prio(env->sd, env->dst_cpu) && (sched_asym_prefer(env->dst_cpu, env->src_cpu) || !sched_use_asym_prio(env->sd, env->src_cpu)); }