Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7315247rwr; Wed, 10 May 2023 06:51:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4t2UKGql1h+/FC81M0FnWt1Cwdw4pkyv5dbd9SG+CgONh93DH3ngwn/f9wFoenz9ZpAXQT X-Received: by 2002:a17:90b:3e82:b0:23f:1165:b49f with SMTP id rj2-20020a17090b3e8200b0023f1165b49fmr16916690pjb.38.1683726676309; Wed, 10 May 2023 06:51:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683726676; cv=none; d=google.com; s=arc-20160816; b=MHZ6GroZILcWHr+HAVm1LQSdi1Fk8eM41vuJ/4JH9aCitTUtA683MjQBOTVA3Hl/8C l2RKy+vyng2I5XtUAPu8WdKW0JeQoVtzZt3gh/Gtr0qQR/wr0ceTB6fs3q88N94lqu11 l7BdEeAteqHApOjjiUraRKukGf5LVkJybT2PK4x8cPBnjfqFln5W3Ly++FucTZ3RgX1M FW85zqslR/SUiTpF31OGIM08UK8n0PaExc/MHME7ZBFWMqAdIzuGIU1pldJzvVs+p3AT FtctE9mYe8kbRNwq+XaHOCF/+MxPzZEd1wfwRzBwy8AXrcIePB78VNakgdS47pWcN8h2 WxiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=YKGyqrD8zYmw4nObiR+R8GcM1J6bpSuoUPrrBmfOVuQ=; b=PP49nEDWxJ10hRq2ZNB8YRb8Y6QOp8/9ExB5cWpr2IPqC8opcVq08Mrg+46jG4dZ0B NFVO9ER8hlNlY1KDvmiQEKR+yFe7XaYYWnjvQXC6KU5ZxmULDbE2JhbdA83l/roCu84T uv2ByXlIieUC+0dfOLtNOfZ8eVXGl9EvtCSxbFgVhDlpVo51vRzvsaEP+EdnCn7RWn5u EuosR3vMOlg+1gTtti97uUjlzmMDV06oJnP1sM/K4D4Ki+Xw6aoG5AS2czCgxCZSGkih gbhuKf9/MyrpWyY6CeJZIKHFVN+/X7/FQFgajkpb7ke8OE8loPuTUiVbpY6CBKo7+nml V9/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Ju4n2lm4; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q8-20020a17090a430800b002507aba141asi7696081pjg.171.2023.05.10.06.51.03; Wed, 10 May 2023 06:51:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Ju4n2lm4; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237299AbjEJNuF (ORCPT + 99 others); Wed, 10 May 2023 09:50:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237275AbjEJNtX (ORCPT ); Wed, 10 May 2023 09:49:23 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B62941BE5; Wed, 10 May 2023 06:49:20 -0700 (PDT) Date: Wed, 10 May 2023 13:49:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1683726554; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YKGyqrD8zYmw4nObiR+R8GcM1J6bpSuoUPrrBmfOVuQ=; b=Ju4n2lm4LwUBxgaIR0G8TXRAYnSCGfOa4+YGCSbp3relLpmPnxjC/VMEnQ5zHbSvUGtWsW l3+sgzcl/6Z2m4pO4qytTu6blG1I1fz/wIHXSauTJynlNdP7nj+Odqg1jZD5wFblLLN366 GfYMuXzJl0nuFRyUkqfNYuUK+rsnmuZV9ZT4DtsBtA1EFpN/93rGKZnVpbFYO4nRHiwhB0 ZodMurDaYdDan3wHe68h9VP5CwO9sUoiORX2F2BHsooN3DqO2uixu139aVc2M90WB+J6H8 +rv81dS7htX1uTB7AIQAlLAnT3ZpxD6EbV6Qaj2mjK/j8a74gkYnIsO4awc+cg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1683726554; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YKGyqrD8zYmw4nObiR+R8GcM1J6bpSuoUPrrBmfOVuQ=; b=GK8BhBBMjofjX2uB1ahdZRDsw28rp0kbR1XazHu7tzEKzWi+T1Xd3sc7Cz3t1415GWFTvB DXbTE4nA3+MGGCBQ== From: "tip-bot2 for Ricardo Neri" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/fair: Keep a fully_busy SMT sched group as busiest Cc: Ricardo Neri , "Peter Zijlstra (Intel)" , Zhang Rui , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230406203148.19182-6-ricardo.neri-calderon@linux.intel.com> References: <20230406203148.19182-6-ricardo.neri-calderon@linux.intel.com> MIME-Version: 1.0 Message-ID: <168372655364.404.8890048970678444740.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: 5fd6d7f43958cb62da105c8413eac3e78480f09a Gitweb: https://git.kernel.org/tip/5fd6d7f43958cb62da105c8413eac3e78480f09a Author: Ricardo Neri AuthorDate: Thu, 06 Apr 2023 13:31:41 -07:00 Committer: Peter Zijlstra CommitterDate: Mon, 08 May 2023 10:58:35 +02:00 sched/fair: Keep a fully_busy SMT sched group as busiest When comparing two fully_busy scheduling groups, keep the current busiest group if it represents an SMT core. Tasks in such scheduling group share CPU resources and need more help than tasks in a non-SMT fully_busy group. Signed-off-by: Ricardo Neri Signed-off-by: Peter Zijlstra (Intel) Tested-by: Zhang Rui Link: https://lore.kernel.org/r/20230406203148.19182-6-ricardo.neri-calderon@linux.intel.com --- kernel/sched/fair.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 85ce249..4a9f040 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9619,10 +9619,22 @@ static bool update_sd_pick_busiest(struct lb_env *env, * contention when accessing shared HW resources. * * XXX for now avg_load is not computed and always 0 so we - * select the 1st one. + * select the 1st one, except if @sg is composed of SMT + * siblings. */ - if (sgs->avg_load <= busiest->avg_load) + + if (sgs->avg_load < busiest->avg_load) return false; + + if (sgs->avg_load == busiest->avg_load) { + /* + * SMT sched groups need more help than non-SMT groups. + * If @sg happens to also be SMT, either choice is good. + */ + if (sds->busiest->flags & SD_SHARE_CPUCAPACITY) + return false; + } + break; case group_has_spare: