Message ID | 20231212003141.216236-5-void@manifault.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7426462vqy; Mon, 11 Dec 2023 16:32:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IHG86UdOvdlQNcPRGAms9lnwG1F5u0o6+TTiUVHyT18Z/bL6slLG1+3477o3J9GtkU2Sa8M X-Received: by 2002:a05:6808:2e99:b0:3b9:fe98:39af with SMTP id gt25-20020a0568082e9900b003b9fe9839afmr6509737oib.6.1702341146830; Mon, 11 Dec 2023 16:32:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702341146; cv=none; d=google.com; s=arc-20160816; b=WQws1UlfRm8MCHp8cQLMO5CfZFEagKZwP5DMQg9TboMHWOu/DMfpkqpVwtb0KYAhEi 5Qm3UkE1GdC2zvLNNQwFElUL3KQPngmMjdtt/5chKzwxJxulwDoiQRsXy3Nzj1LccndB 5p5iq+3F6aHDUrCypQm+FY6dVwFVG+HhsDhwauRzcAPoUEx5+Fwh5BZZk+nqIFZPDR8P GgnsElRzz0ZU8ceRU7JAEeFnXVVIIz36wNL13DnDpF8pHbdK8IB2ZmfLuveFiQ9UxMU2 zXpdkAU+LdqzG/aPjAwl7p/lfNLESvUy/qroE/g2XpYyHUudlUc13J/3yS98yn9ZuYAa 2ArA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1ozM4BpN3Xt6MsBMcAeU5+sN7FM9jw+H7uMlVGcPsYU=; fh=M1Y4hH0c3aJh0Tk+r5qI6oW+pPzAHXWG1oPGqjHDYxM=; b=inZldbJLoygYYpyZIPT3w/Pu6vtzdMnZQa4TCjZmIhuivC7X8LkfI6ZWzEnJyps0yk 7alr+gYnfctw0g8dFRfE6voEqnnkxampvBI43cxhJjzjPjgNNY1lF6IA1O2bnjFpZgHl UhXgcClucHR6dlB2wzi0vX3HKY3HPMyU2BhZ9Td32he6RX124C35ueIjPG6mJ+BIniyx +SeIjieMCHQIxqMDgKLFGf3f/JKCJoNk9caPCnW2DJt1MECcgFjfPHjiYok/S1BQQzs7 a0Jw8H5t3DVXYx591UogmYK3w7Qyc1+tdu2HAJ9lWt7OaYe9+7gbD9WiXhIEoldG6/S2 JKlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id c8-20020a056a000ac800b006d087385ddfsi2722732pfl.194.2023.12.11.16.32.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 16:32:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id F221D8053630; Mon, 11 Dec 2023 16:32:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345514AbjLLAcB (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Mon, 11 Dec 2023 19:32:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231131AbjLLAbw (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 11 Dec 2023 19:31:52 -0500 Received: from mail-il1-f173.google.com (mail-il1-f173.google.com [209.85.166.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3000FDB for <linux-kernel@vger.kernel.org>; Mon, 11 Dec 2023 16:31:55 -0800 (PST) Received: by mail-il1-f173.google.com with SMTP id e9e14a558f8ab-35d4e557c4bso23274655ab.0 for <linux-kernel@vger.kernel.org>; Mon, 11 Dec 2023 16:31:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702341115; x=1702945915; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1ozM4BpN3Xt6MsBMcAeU5+sN7FM9jw+H7uMlVGcPsYU=; b=M6fROFzYXqiUvfysdgYd9JyunX57Gbfjd9muWKBsFPOw9QisqV9jZQgPygmbevtprR 3MSiK6BlgahonWwHTRCE0VFkz/4IGNWF51swsD8HtuMMIriFL2+VlnpmBPqoBanxFv8U iaRlVG6kI9fwKfZYy6vHWbP/VDcBIgu8TUNWjigyE172tLdjLlr/1um2TxIKKOI5VlqH Z1kDoChgh8q/RjH+uqRDfc7ro0IOLTosAEDzxH0s7LCl9QoTkRsGYKZ5u20rcZMkDYLQ qSqxPv7Fgj0HpI1feVlod7Iu+UjTglgFWkTKjKzsyx3VB6R9EQkKehpQcp1Fq/NyqRnD oDiw== X-Gm-Message-State: AOJu0YwvYjG5KSZJYiKX2aRPNI22ltV8XhcRIGyvrvkQxStgx+Fc+aaz XkW5JZxzZNpShrZ5Shvh33XBV2IErqVABBaP X-Received: by 2002:a05:6e02:1a4d:b0:35d:a4a9:7bb7 with SMTP id u13-20020a056e021a4d00b0035da4a97bb7mr8463770ilv.63.1702341114970; Mon, 11 Dec 2023 16:31:54 -0800 (PST) Received: from localhost (c-24-1-27-177.hsd1.il.comcast.net. [24.1.27.177]) by smtp.gmail.com with ESMTPSA id u4-20020a056e021a4400b0035d714a68fbsm2619217ilv.78.2023.12.11.16.31.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 16:31:54 -0800 (PST) From: David Vernet <void@manifault.com> To: linux-kernel@vger.kernel.org Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, youssefesmat@google.com, joelaf@google.com, roman.gushchin@linux.dev, yu.c.chen@intel.com, kprateek.nayak@amd.com, gautham.shenoy@amd.com, aboorvad@linux.vnet.ibm.com, wuyun.abel@bytedance.com, tj@kernel.org, kernel-team@meta.com Subject: [PATCH v4 4/8] sched: Check cpu_active() earlier in newidle_balance() Date: Mon, 11 Dec 2023 18:31:37 -0600 Message-ID: <20231212003141.216236-5-void@manifault.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231212003141.216236-1-void@manifault.com> References: <20231212003141.216236-1-void@manifault.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 11 Dec 2023 16:32:22 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785034070383185009 X-GMAIL-MSGID: 1785034070383185009 |
Series |
sched: Implement shared runqueue in fair.c
|
|
Commit Message
David Vernet
Dec. 12, 2023, 12:31 a.m. UTC
In newidle_balance(), we check if the current CPU is inactive, and then
decline to pull any remote tasks to the core if so. Before this check,
however, we're currently updating rq->idle_stamp. If a core is offline,
setting its idle stamp is not useful. The core won't be chosen by any
task in select_task_rq_fair(), and setting the rq->idle_stamp is
misleading anyways given that the core being inactive should imply that
it should be idle for a very long time.
Let's set rq->idle_stamp in newidle_balance() only if the cpu is active.
Signed-off-by: David Vernet <void@manifault.com>
---
kernel/sched/fair.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e1b676bb1fed..49f047df5d9d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -12284,18 +12284,18 @@ static int newidle_balance(struct rq *this_rq, struct rq_flags *rf) if (this_rq->ttwu_pending) return 0; - /* - * We must set idle_stamp _before_ calling idle_balance(), such that we - * measure the duration of idle_balance() as idle time. - */ - this_rq->idle_stamp = rq_clock(this_rq); - /* * Do not pull tasks towards !active CPUs... */ if (!cpu_active(this_cpu)) return 0; + /* + * We must set idle_stamp _before_ calling idle_balance(), such that we + * measure the duration of idle_balance() as idle time. + */ + this_rq->idle_stamp = rq_clock(this_rq); + rcu_read_lock(); sd = rcu_dereference_check_sched_domain(this_rq->sd);