Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp712530lqo; Wed, 8 May 2024 12:22:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUbo7qlUZSDhTWTYeSIBspnFSVBy4cmmKh0+qMikwePZ7KBD7f77C9I7N9nuys+2E/gfVkEJsPfkS0P+5rYyN1ft3i9BKoXGG+Rie7SeA== X-Google-Smtp-Source: AGHT+IH1tgxRe0f+RPHZL6boboSou/mM78830wU6KIpB/ySOjwhjW0UuxxUlWKXLx8q8DjgvvRdb X-Received: by 2002:a50:a45d:0:b0:572:d1e1:b4b3 with SMTP id 4fb4d7f45d1cf-5731d9ce4f1mr2376981a12.7.1715196162502; Wed, 08 May 2024 12:22:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715196162; cv=pass; d=google.com; s=arc-20160816; b=QgHcVIamQtsz4QV3Pdeqqwo+kl5Mv6yafI0Foijj/kY+8zIZc2myzNDN/vp481yuRY Pk3E3120IeC/oFY5z1Tfydz7JyKhgSE7cCg5zhULsK13Mwllsfq7447QO2E5z+foor8O UqUiyBUColJNyoYEt8J59XHsMGpRjuVxv95k+mA4Ak6hqZKy0TPHpaBb5A4hqyUASN7R xBBvDQ3S40O8y25zX8A4Q8HeIqyn7X7A1xMyCLPB87/tpoUiYoeSSBFFHjxUeqB9ftEe OKDyO+9in0CR94qBXBtM+ILA4I+OtDEAVwPdGlkM1SQnU9zOCDPuQwbSEyUBJcfPBoV2 jIQQ== 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=JHdWFU3GAmv3dyZh/NErYLFPQ80pO8FEjOYvZYPGwK4=; fh=qOufyGAq+l1P7PK+SEiR2bVLTQXavvY0JhYnuzDU6LE=; b=nw77Y9tDr6Gzt5gsW+ZT00Xw2YL/1xQJiJgBIvACOYL1RaqZxs0+9tbRjL42U0gihw sUcJt5kM2Z+JtX4GEyDirVHQqhMbrqscVdLcVdyY9dTN5Hy/tnqS9KTpFHFa7RZwbLqA L6iVKpXCN76vnkYpP5UwCe5ktjvHA/XQUctLLRZs2ahaTo/2u4wmfoTVSAQwyPkpY2O5 WVakp6Rn8H59S1fQgT1m55Xdau7p4Ilz9cDmsv+hBYLOb9vVDTg7jMnYYbVo3B6wDQ7n 5dlJDpVUVOHQB6gWa15/NXiY1BHoSm7SqVb8oLaWuffRMHbbgcWbaeENciKcGeE/ycaK xGqg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Wlgk9djv; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-173750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173750-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id q3-20020aa7d443000000b00572becee235si6711073edr.421.2024.05.08.12.22.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 12:22:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-173750-linux.lists.archive=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=@gmail.com header.s=20230601 header.b=Wlgk9djv; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-173750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173750-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 1CB251F2314A for ; Wed, 8 May 2024 19:22:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 675E4130A58; Wed, 8 May 2024 19:22:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Wlgk9djv" Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0054912AAE7 for ; Wed, 8 May 2024 19:22:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715196139; cv=none; b=WpSkNlbzJAZea0ENs0RMfwvR67+lObK+COSI6r4ZPSQ1n4FsvaGmnMEq8VVGM/6JEUtDIQss0HXDb2T0p2mHtXvMwZYzqidWrLrTuqJYHrtJQRmETIa38yk94Dccj64s63f3aX4N9AcwgU1DpoTuFgBcQDZWmL3pp6b8PdDkYK4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715196139; c=relaxed/simple; bh=lqqYhTHRkOHchj7ahusEqPtaPXdvyvpJQqB28P8Khpk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kIH4BZf5ErJoLojqoRYL0JEuc6hisgfFB06FxQgSWXpRKJelq5W+aUf8heRYS8iyd0aJpHRE+Me+ZGBmKkwSyY9NhHafe/ZP/iBACMCUM2kIuLdNZgg5eAGqthpV/2FJLPm3yX+QDGI8+VowDtxKcApKADAmbCsrGmkFjmQ6N6U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Wlgk9djv; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-34f52fc2191so28598f8f.1 for ; Wed, 08 May 2024 12:22:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715196136; x=1715800936; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JHdWFU3GAmv3dyZh/NErYLFPQ80pO8FEjOYvZYPGwK4=; b=Wlgk9djvmDnNOsXjQ7WMymA2UB61GzqcHjFYJaYrWjEb8+wfQJ5PxSIZkTbecGkkBu WIycnv5zCqI2YfKHlMXJCQKcabCNWiFq0BXijlTDjZ2r8Shpqu82l3eqMnyxHmcKczFR c4bDilEH8MAZGOa8QGLO+bsFDtHjWveOg/mcGhJnHLxgd/ieWtzQiWenqiwof0KtGL5k +OEu1bHcDztfSarnAmdNcfnqTBITE3se5u6BGUKjy5/8Gw5VDMz/1YlfyXvyreaRQJy7 gZRw471ZFQVyXWk8pnmi4WEBznRTk7kIr6jy6WHWskinGmehqXrO3HJKFFtsZVcxEBJ0 FzAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715196136; x=1715800936; 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=JHdWFU3GAmv3dyZh/NErYLFPQ80pO8FEjOYvZYPGwK4=; b=TxRPbvE1vegyOhpJhNlpmlHADUVEuL/nl70BzBxd7oJ1QzTA5O+lQr0r5pe/RmbJ8f QdU7hR4RPV8zMFpVlIXKrr5sYhPawx+MNSPcG0KMzvkB4cVlioVBWDfZZjTEsTnxi1dy FxXhtlNKGdOmGpbYT5Q093/Ogf+4arkWytYHqQieocvyhSHS3vBt6BiuKJ6ZFgU6X9Bh F2WwlYYMdvmnMwuhCdC+P0CBpaY2vqCbjoC0aTDsqM5R18/J/U7IUDEOA15+l/uN4PFe YU6qPEFJwXq7cwfpoDOFd5uxVjaXaY3Q9LqcsWS77HfS2J8hHkNJpNvLSl7YjZhzvbak ayng== X-Gm-Message-State: AOJu0YzR0vxZiwbMcmCmJwqtnrNEjb4EYtgTY/2WJunXLpk715QJ0n5K ZTMpvx9JEGFJvEANhDSc2oaL8vsh6072ptLYCFj6AvfMXeIN7hRh X-Received: by 2002:a5d:690b:0:b0:34e:16b2:9abf with SMTP id ffacd0b85a97d-34fca339aacmr2603256f8f.33.1715196136172; Wed, 08 May 2024 12:22:16 -0700 (PDT) Received: from localhost.localdomain (host86-177-210-156.range86-177.btcentralplus.com. [86.177.210.156]) by smtp.gmail.com with ESMTPSA id gb30-20020a056000459e00b0034e0346317dsm15984822wrb.13.2024.05.08.12.22.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 08 May 2024 12:22:15 -0700 (PDT) From: Levi Yun To: anna-maria@linutronix.de, frederic@kernel.org, mingo@kernel.org, tglx@linutronix.de, Markus.Elfring@web.de Cc: linux-kernel@vger.kernel.org, Levi Yun Subject: [PATCH v3] time/tick-sched: idle load balancing when nohz_full cpu becomes idle. Date: Wed, 8 May 2024 20:22:13 +0100 Message-ID: <20240508192213.31050-1-ppbuk5246@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240508172621.30069-1-ppbuk5246@gmail.com> References: <20240508172621.30069-1-ppbuk5246@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When nohz_full CPU stops tick in tick_nohz_irq_exit(), It wouldn't be chosen to perform idle load balancing because it doesn't call nohz_balance_enter_idle() in tick_nohz_idle_stop_tick() when it becomes idle. tick_nohz_idle_stop_tick() is only called in idle state and nohz_balance_enter_idle() tracks the CPU which is part of nohz.idle_cpus_mask with rq->nohz_tick_stopped. Change tick_nohz_idle_stop_tick() to call nohz_balance_enter_idle() without checking !was_stopped so that nohz_full cpu can be chosen to perform idle load balancing when it enters idle state. Signed-off-by: Levi Yun --- v3: - Rewording commit message. v2: - Fix typos in commit message. kernel/time/tick-sched.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 71a792cd8936..31a4cd89782f 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -1228,8 +1228,10 @@ void tick_nohz_idle_stop_tick(void) ts->idle_sleeps++; ts->idle_expires = expires; - if (!was_stopped && tick_sched_flag_test(ts, TS_FLAG_STOPPED)) { - ts->idle_jiffies = ts->last_jiffies; + if (tick_sched_flag_test(ts, TS_FLAG_STOPPED)) { + if (!was_stopped) + ts->idle_jiffies = ts->last_jiffies; + nohz_balance_enter_idle(cpu); } } else { -- 2.41.0