From patchwork Sat Feb 10 11:39:22 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: 199249 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1419605dyd; Sat, 10 Feb 2024 03:37:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVQQOhOqrlVZIyq4/EZhHZ18agK5IyY+Jt9sXGEfm6/feh5lHEiAxQEYltHq4pE7Vh5vvNakck5SQvuXX2y8h9CC6Ix2Q== X-Google-Smtp-Source: AGHT+IHCOh2mzFv0La+76UgxS3SdgTs488V1JfNzauqBV8JrqirwVDagl5sfcvMUCgvkzcF+5FFh X-Received: by 2002:a05:6808:1249:b0:3bf:d1ea:23bc with SMTP id o9-20020a056808124900b003bfd1ea23bcmr2041745oiv.49.1707565038711; Sat, 10 Feb 2024 03:37:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707565038; cv=pass; d=google.com; s=arc-20160816; b=fUAlPR+x9mNJVB/yMAT1TCINaskgEsqK+eIorzcu2nZnQB/hmnreX/NgqCjVYbdSwN aAH4Vo8ZQwGKxtVW5PDl+bLmRqM777KwMCt5pcTLRvTgVu/UTKvYAcBJ8paauehlPXCF HPoVJSdKp7y2Em5AZZS9nlg8wQNMa2nr8bVq9I4r3+pgXtY6rqffCHE/y490pvVX0H6S Gx8MTc676SnEnvdmSRrRyv9ENmfFIMKEEOooc36FvEpwo/6+vwvixXkrAR1Y60GGwZJu 2Dn4I1k4PklYVSTrI0rp4i1yuW9CHJ44/k8DXfJR0A3mwQZQB7Ikr3saPShWqfjWdMaF k9uA== 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=bsvNKD1rZGIfm0uMMym713VPNeccHuGfioHqVE6TDSI=; fh=TlvJMdiUK9BtNzm6kZ+N5nyi0c2TuKsZEpCyDo4V8fY=; b=Y+pDuo1VE2DpzQDWIdH+U8+EEk3AFfApPA5NzorHLM1tg32VgLemOprVB48QcrHYdZ 6T2rHAjg3zmMa6Hfxe3AL4Ely9L0IR5W5jRHycsDkhJy6ET74v/ZeEHfUVag2bipc+oF eOZ19/6hpb9/sqN2lmT2fGYD8OZPePbuaNtA1S2tXNDpk/SeYsb7zGpv02AZy2ei5njj 2mzQ9A/SUTbiFtdiKBtMDshiai1yJx0TReP2jLQuzviQ4MtQol2y/v77NZ7CSH1YrucU +ZyjaJh7G9iTym6+ERp9p2UKAysbjf37Tk1taUd/JhcyjV+DOXBJTBtJPDKHn4bO5H7g jmGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GQ6OlXpU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-60381-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60381-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCXC0PJ7oQLrp61A8BEFp/ECpY0qHFnfUfc7HP+AulgBZAQHkCWaI5F5wHlCzjrpl1MR2QrVidYsQrU4Gr81KCjzc8MHKw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id l13-20020a0cc20d000000b0068cd84a4d53si2574618qvh.44.2024.02.10.03.37.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 03:37:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60381-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GQ6OlXpU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-60381-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60381-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 6B8AA1C22553 for ; Sat, 10 Feb 2024 11:37:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1CF983DB9A; Sat, 10 Feb 2024 11:36:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GQ6OlXpU" 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 840953D986 for ; Sat, 10 Feb 2024 11:36:33 +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=1707564993; cv=none; b=B/N7Zrq5X4AAhwuTBzdAzTWdo1D3Qh0aa8Lvf+FnBsfRXpv5zaBgr0ojNhIqgT7Qv8v397rrZ9l6NYjuNMBSI8Otue55bOyKNy1UciL8ZhLk4GcUQ+UF/xeOQ/8MwFoj7tTjBZPtjbWjc8FHHkNZI2DJZ2Hw3noaMF9PFktEZdE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707564993; c=relaxed/simple; bh=oI0X6ZAibKBh5HTxaKZhT4zJgSzw5vMV8hSzj08VmQc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MljIxCwWdIusjKQnbocwq8+Azk/AuappisAMGwENgIco5WJZBWW0XlL7mgSWb4bQRoBOJM578sUFYnn10sdAMOMfhvtaSGpUxYM6uR2jb8fYVPidPafQv7dUAhxegUti6C6FNW6USa62ThRdNpVQWkrtiE8zyy8E/KB/ABMFC2k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GQ6OlXpU; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2686BC43390; Sat, 10 Feb 2024 11:36:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707564993; bh=oI0X6ZAibKBh5HTxaKZhT4zJgSzw5vMV8hSzj08VmQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GQ6OlXpUx1RH+EL7QIe7bhORMXP1+/r/DwxllnGExM2GIlLJJA3sZc8Y5PXdnecxy 0n45Wr9DG/EVoCcTi3pAKJm+/kcY4RDp/eG4UweDmfopRofrlFG3yEC1QT++Uz1Qvt kOn5UIaoQupAEm/YHAO60BGMLCn2B6A6tedlPp6vjGyrtUs7qH2VwVfJsEGb+L5KSX z4hWw6RqQYXuvcnGrRU5ics1bDRp0ktQc2NoK1Ox2RV8xsGyi7qh5/uLpjdJoG7+UE 1xs5N5Za9YiHRoBnbBoXrrV0nhKZkMNu9v9jVyEFir+rlgl4OCEvDBoaZqtOzVMqJx p8z25ltPnTXhQ== From: alexs@kernel.org To: 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 (open list:SCHEDULER) Cc: Alex Shi , Ricardo Neri , linux-kernel@vger.kernel.org Subject: [PATCH v5 4/5] sched/fair: Check the SD_ASYM_PACKING flag in sched_use_asym_prio() Date: Sat, 10 Feb 2024 19:39:22 +0800 Message-ID: <20240210113924.1130448-4-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240210113924.1130448-1-alexs@kernel.org> References: <20240210113924.1130448-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: 1790511718020339741 X-GMAIL-MSGID: 1790511718020339741 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. Tested-by: Ricardo Neri Signed-off-by: Alex Shi Cc: linux-kernel@vger.kernel.org Cc: Ricardo Neri Cc: Ben Segall Cc: Steven Rostedt Cc: Dietmar Eggemann Cc: Valentin Schneider Cc: Daniel Bristot de Oliveira Cc: Vincent Guittot Cc: Juri Lelli Cc: Peter Zijlstra Cc: Ingo Molnar Reviewed-by: Ricardo Neri Reviewed-by: Vincent Guittot --- 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 426eda9eda57..cd1ec57c0b7b 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; @@ -9933,11 +9936,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)) @@ -11033,9 +11034,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) { @@ -11131,8 +11130,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)); }