From patchwork Wed May 10 13:49:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 92147 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3643814vqo; Wed, 10 May 2023 06:59:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ59ipZmoKi4XfDwJLlRyG2nWWSploDVINqYHbvFR+6Sc1eMPnEDJfjCXLmMS12bAn5xKrYU X-Received: by 2002:a05:6a00:17a3:b0:643:aa8d:8cd7 with SMTP id s35-20020a056a0017a300b00643aa8d8cd7mr25293698pfg.32.1683727162979; Wed, 10 May 2023 06:59:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683727162; cv=none; d=google.com; s=arc-20160816; b=UD9+NfK74OCIX3Hzqas612VPD7amv6mN+uhhzkCKf8OZu9SYzuBIGMlnXua+uiAiZ3 lCe/W9R8ha6P4LjAwf6ixm8Ojo9k/XEi5VZFOog5o44j7xL5bkX016pFR6LKEPquQL2I qmDoU0FvZLCxM8wXVDMT5i0TTvYtUPEr85Ilhz5CD7ft9hSL0Dgp1BQlmNbh88n2F4r0 J8lv751y/sJHFV9CEdtrnzLbVycWhST8eozShuzwWxDEZF45vW8QT2asc7I99x8QdTzu MhQEHuwo0qOQCQqeKMOFtRdZdxvBFOR5dAVJxObOU0tfRUBVdJmWZ4ckiI79Aq/208d5 yVNg== 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 header.s=2020e; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 123-20020a630181000000b005303a66d412si4013590pgb.812.2023.05.10.06.59.10; Wed, 10 May 2023 06:59:22 -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 header.s=2020e; 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 S237158AbjEJNuF (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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762459700725646402?= X-GMAIL-MSGID: =?utf-8?q?1765515893599588387?= 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: