Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp653098lqo; Wed, 8 May 2024 10:30:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWzGp6p4nHDIAepjnosDfnOKWKAoSuLKCZNeY2KpX5RYq+SSTEmvU61H7r3mi8wS8SksfXGynaX3iNBmcx0LFKOLqFfpQ+i27WDDLLT3w== X-Google-Smtp-Source: AGHT+IEz98B0j73YD+Tk4Zj7zshLISsNtSLK0Orit4DME4JQrw6YO398/OL8fizsFETWED8rR23y X-Received: by 2002:a17:90b:603:b0:2ac:5a93:636b with SMTP id 98e67ed59e1d1-2b61649d74amr3071553a91.2.1715189428422; Wed, 08 May 2024 10:30:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715189428; cv=pass; d=google.com; s=arc-20160816; b=f32ynp4LHAkyE7bkThGXTWqE+wjkJWDvr/iGU7JLSl02PjikHz2UI4Kpc8K3c3rnAg ew91wagXr31+W65T61HS/pmLzBElx9sbYRIsSjBiK5AdG76D2Bq0Tw/buA7TJ6GvYfhT saVOjD0h1SGNdXKyJDLi49tnGUID4MDDsQ9LnXSzSpnU/8/WmcXtgfg1r/cJ2fJWQgIi COfGjKMiqfyjfDG+3Y3fN1AzlBRZpWymm4mdI/H5DykoJDV+yHI6fqlMuKUD2gc/+5O7 w0MOeOt2JJABHiygUEPS8Y10DcU7w/MPmxStA6hB5dQHQC9ZQpQNdhb0EbC0d6A+vJ3n fJ0w== 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=7+N+ZnUOgf2mygsXax03p3JjiZPmj9PGmZaXcZS3l4U=; fh=qOufyGAq+l1P7PK+SEiR2bVLTQXavvY0JhYnuzDU6LE=; b=gUSAwjW4/XJeA8d/94hzjwDiKT2Vp3MfCWV2iIoxK4RoYIlr3Xdluiw7ray+rMjSno 4skn0PzOjRJXX360nHeFvQJJ6XEjo06JqKlBZ1F/9DnOl1y5J/lJZmrCQAnOlOiKzZ62 pWoWZiG7gVw1z8bawl7gCccCmkrfne0Uvv0SDsiOyn3+gC3RU3tNjYMqdtYK1CuyzDsX q6XZhLs+no68r+rTMYfI1ZXPoedP+S6Kkwi2mXuvugzV37czfRNKRZASKaOAs9c4ka4e qzCs4yrYJd7wLfwC/zE6oyA0OKg+90gP3rlnadl8MruMqMxpEWUMLdba3D3Sx9UJ3kgK HQ3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gJaB+TtC; 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-173624-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173624-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b628ea7ae5si228089a91.94.2024.05.08.10.30.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 10:30:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-173624-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gJaB+TtC; 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-173624-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173624-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 66610B20D51 for ; Wed, 8 May 2024 17:26:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7545E127E34; Wed, 8 May 2024 17:26:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gJaB+TtC" Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 171AF10A28 for ; Wed, 8 May 2024 17:26:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715189187; cv=none; b=YfZMbCikacKgPQgC8Btpxq/FM1bT/K1Kdzjl7lJVHH/gHgXkM2IMHPOaGLNYpw8qTNyOdhNkR0n+M8arG24Xa1VhpnDZdEW0byTv62ze1aXxhHYJ9Ml8z71lNq8IOhDR8uLLAqhFbYS2RfZzQEsYo3M3ZTffCMjHcC25fmNA98M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715189187; c=relaxed/simple; bh=WDqAlbsNHJT2hM1NYyc6kmkejLq/GvPP4lLbyiAl2HE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l3el4RKcL99acZrjdYnQbARe2CWF9zfYOWf1xRZOglPYdWDIGyyMxowKm8/W6VYEiiH46ASN4slWFcFRmDm7pEj0EOuh+drUrv4FfkLhdh65Gww8KBg0t/VLlWsWK3uG+yl4tAMKzQacgzJp4QIkD0pSX3GoaYao4qUmgry5Ufo= 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=gJaB+TtC; arc=none smtp.client-ip=209.85.128.42 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-wm1-f42.google.com with SMTP id 5b1f17b1804b1-41ba0bb5837so32459055e9.3 for ; Wed, 08 May 2024 10:26:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715189184; x=1715793984; 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=7+N+ZnUOgf2mygsXax03p3JjiZPmj9PGmZaXcZS3l4U=; b=gJaB+TtCA5lJzn/AbC/a7TYERNijBwq/7qbz+2xhOkhkV7qC6M0cB5CMS9xrwjFvaX kXhBRvcWYNwO18oh21WU6oWcnODhk9g2OkwCkf2zQ/hWhxKOqdRgmQ9g7bvYSYbyGgKM aPCETDbGmdqgQUxwO9bae27W6QaNz6vyViCxfdQzqzNntimVP2NDSCzhl5yOU8denkcZ KG9b4U8ASAKCHFQqFqkgk+51Ya/1O4O5VtJZ3gYG0SMAsIx2OPT5dJW06Mz4p7ahZWWe qKVW6RIxdOmpbBDggheNM70ocEx3P/KnorbwAbZOTNTLjhKAoFaObxRg38ypgzwZ8YGY 2izQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715189184; x=1715793984; 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=7+N+ZnUOgf2mygsXax03p3JjiZPmj9PGmZaXcZS3l4U=; b=bh9xi8k+Y2YX9sSsJm3DU1U2HPGAjQjmN9SzaQ75rt1JNdVsmqLHYcGsNwbSzEE0Ln OYIQ7dxhHChpNymsQlTyjRTDelSDAXTqi1wxmuU1srYX7fYg0oh+sNmhd7xGSVujK4Kk Ar9/tuhc7MPfnBsZo6IbO5fZNCMrqGTvFxKivGEN34Rrcb8WquX8zWLJMpjYvMIuAE7c McIE/cKGxmM+qtyM1Pgq17UKaq7tlpgivgk/3bxLpgixhwfZzMDTm9Xc46Lg74b2rYRq vVftUY6B0eGAmbFwcWTKQp/MVcdQ3a9++/V2+ZrcVTy3Q7QlCVOCLn905Zj+9MU1vMQs OBEQ== X-Gm-Message-State: AOJu0YxAkYcnNsz04Dl8p8uPRoncjxth01AV4H6h0HupIj3WyaxvHWBE zDNOf1xSK4kKDwmLnXhOm8t1OAz9sslQpYcTuBCI3qVK4wyYvEyM X-Received: by 2002:a05:600c:1d18:b0:418:2a57:380c with SMTP id 5b1f17b1804b1-41f719d6179mr26790595e9.26.1715189184230; Wed, 08 May 2024 10:26:24 -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 5b1f17b1804b1-41f8811110asm30448725e9.35.2024.05.08.10.26.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 08 May 2024 10:26:23 -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 v2] time/tick-sched: idle load balancing when nohz_full cpu becomes idle. Date: Wed, 8 May 2024 18:26:21 +0100 Message-ID: <20240508172621.30069-1-ppbuk5246@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240506213150.13608-1-ppbuk5246@gmail.com> References: <20240506213150.13608-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 bacause 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 is part of nohz.idle_cpus_mask with rq->nohz_tick_stopped. So, nohz_balance_enter_idle() could be called safely without !was_stooped check. Fixes: 0e7767687fda ("time: tick-sched: Reorganize idle tick management code") Signed-off-by: Levi Yun --- 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