From patchwork Tue Jan 30 13:17:07 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: 194171 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1210508dyb; Tue, 30 Jan 2024 05:15:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3bGu64s3l2nZKrEqa4ACw30R6pVWqvqMZqUgUuzHA53f2Z0mYkAlmgS9kYtQeGZXO919Q X-Received: by 2002:a17:906:8888:b0:a35:2758:2278 with SMTP id ak8-20020a170906888800b00a3527582278mr6176382ejc.10.1706620526667; Tue, 30 Jan 2024 05:15:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706620526; cv=pass; d=google.com; s=arc-20160816; b=fH9uTqMFieikrcAB8yDWJZVNmn2Qiu6SegYZxmYu12S5XaT5aIdZacL3IxCgmWZY96 OOn2onDajgvpDitZaXoqK+QejHKk+0dv0QurhOQeamwVrxjYqNza/g6DpkZ/RrY+V9rR p8N5ErpFB2zfQAO2qN14oTPWu77ZaoUzTSSdSBR2UXMbMPARzGhlLcs/zmDDO+XvcqP8 njh/oAwab/J/yDm/f9E3FFxcwje8vmsoCPtwmGjhRYfwQtnOTeS/Wq0jzsFQOehzGIc3 cxW5teUW/M8fk64OSGhmlob7V5R52UxhuXS7CFPLUe1KOHFMcEk96uzBDer2gXUzTcN/ 1Qzw== 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=oRBLQJbbCwobDB+pFl37jFjA+Qd4tVNBxzBT7KWDBV8=; fh=CH0OO+rsEMoKRW5HY96+2DQ466rE9ttKX9bm1c+/3Ro=; b=uTpDn/JoA7biwbM87qqc5dmq4fvbm/jwCOoQAyDiI9TIkku85lp1GhtIUxwPgB/HXo AtN/1ZbFWxxLq/ZTRkovrWY0OI9IgJpA1L3Ce5BP75sN2VPdnuowaPg5JCpRdPpW812G KZgayF6NfX7Tc/OREzPoaqXqPyQLn/FN2B0i4xQDwbMY7m4GKJGUgG6O6mDns+TCNIug Sum4SRVcHeksUizstjtNXS9xLA1px7GwGudEEebB4akg8r7rlrxkymq+CV4dhbvRnkoU Hg19TlwHOZn6HP0abkH720Gveb5LOhkN8Quu94FsrVn69IdGmIyPmSL84MMwi40f3kAa L7KA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Hd3ps/Y4"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-44685-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44685-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id rv15-20020a17090710cf00b00a326070d9c5si4402748ejb.235.2024.01.30.05.15.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 05:15:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44685-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Hd3ps/Y4"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-44685-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44685-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 492881F2310A for ; Tue, 30 Jan 2024 13:15:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 980B26EB66; Tue, 30 Jan 2024 13:14:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Hd3ps/Y4" 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 043936BB4E for ; Tue, 30 Jan 2024 13:14:29 +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=1706620470; cv=none; b=PPNlMcd5Su4bp3C+wepRGJ8R2NTbA3OFhskt0lIyNAvjWloJ/KxCYxEOtDNeAdA5yRgF25g0g9zcyvs4aXHd3yVCcxVxzWHjWvZTdBgE6jfCwG6WgJvEKWP7zi+N6m0GfUg7Dpcvh2CoDsxF5DNDJ9i5kDky/rmRZh3pfAWgWdc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706620470; c=relaxed/simple; bh=c/1WLOAzJwWvvX/sgjls1EE1+Z+vkWbOlUsZdDywdRk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l4AYmrzN0iB9ZRTbbx7TAuVBwAszXGlc+GQk2SvI/GawBI5UPqqgSuELlht2yAFzv3daalJ4gP8Hj8pReuCUlGSL2E5aR6ifTcmFMS42jq9PoaymI4CxT7QiRiB+QEBy6uwz8Ea0Cn9e6IfZAhvfKKpbww3aPC9swicwV0qYcKI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Hd3ps/Y4; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAC96C433C7; Tue, 30 Jan 2024 13:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706620469; bh=c/1WLOAzJwWvvX/sgjls1EE1+Z+vkWbOlUsZdDywdRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hd3ps/Y4HblMhC0xw3r7X70E3ks/5ppE6tv6mPpnNsmQdi6REpusZYFZPRRa1SK/X INqbcdzMpKf2995ytotNzgE4BlgYua8EyVDtoQpUrzcWsJPqW0ChoyhzrP0FQnAW9E WLk2kenCEZtpYj36bH1JgoZkxCEHSVfXRhHSHGktvuuSrP5FjEySvCUGNjvKQwi3lQ NUzC6pZgq0zxSaXbBXQk1+enHWi5odj3VXDkfEMKTFvpbui92TbM+PHI+eDJu54QLr x0DrFmYXKTaRRdKYGXNtxOQHFPO7emjI4370wjUbo5KBmP1Nk5D/urWWiDzCypGdYG FefAncI4V72wA== 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, sshegde@linux.ibm.com Cc: Alex Shi Subject: [PATCH v2 5/6] sched/fair: pack SD_ASYM_PACKING into sched_use_asym_prio Date: Tue, 30 Jan 2024 21:17:07 +0800 Message-ID: <20240130131708.429425-5-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130131708.429425-1-alexs@kernel.org> References: <20240130131708.429425-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: 1789521325461184654 X-GMAIL-MSGID: 1789521325461184654 From: Alex Shi Then the flags check passed into sched_asym and sched_group_asym. It's a code cleanup, no func changes. Signed-off-by: Alex Shi 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 --- kernel/sched/fair.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 835dbe77b260..6680cb39c787 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9741,6 +9741,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; + return (!sched_smt_active()) || (sd->flags & SD_SHARE_CPUCAPACITY) || is_core_idle(cpu); } @@ -9935,11 +9938,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)) @@ -11035,9 +11036,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) { @@ -11133,7 +11132,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) && + 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));