Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2235047/?format=api
{ "id": 2235047, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2235047/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260508131647.43868-12-frederic@kernel.org/", "project": { "id": 2, "url": "http://patchwork.ozlabs.org/api/1.2/projects/2/?format=api", "name": "Linux PPC development", "link_name": "linuxppc-dev", "list_id": "linuxppc-dev.lists.ozlabs.org", "list_email": "linuxppc-dev@lists.ozlabs.org", "web_url": "https://github.com/linuxppc/wiki/wiki", "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git", "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/", "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/", "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}" }, "msgid": "<20260508131647.43868-12-frederic@kernel.org>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20260508131647.43868-12-frederic@kernel.org/", "date": "2026-05-08T13:16:43", "name": "[11/15] tick/sched: Account tickless idle cputime only when tick is stopped", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "ac2369c5cdb88ddde410c747d5cf8cd3811d3b23", "submitter": { "id": 79411, "url": "http://patchwork.ozlabs.org/api/1.2/people/79411/?format=api", "name": "Frederic Weisbecker", "email": "frederic@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260508131647.43868-12-frederic@kernel.org/mbox/", "series": [ { "id": 503389, "url": "http://patchwork.ozlabs.org/api/1.2/series/503389/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=503389", "date": "2026-05-08T13:16:32", "name": "tick/sched: Refactor idle cputime accounting", "version": 4, "mbox": "http://patchwork.ozlabs.org/series/503389/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2235047/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2235047/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linuxppc-dev+bounces-20621-incoming=patchwork.ozlabs.org@lists.ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linuxppc-dev@lists.ozlabs.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=odGALObB;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=2404:9400:21b9:f100::1; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-20621-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)", "lists.ozlabs.org;\n arc=none smtp.remote-ip=172.234.252.31", "lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org", "lists.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=odGALObB;\n\tdkim-atps=neutral", "lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org\n (client-ip=172.234.252.31; helo=sea.source.kernel.org;\n envelope-from=frederic@kernel.org; receiver=lists.ozlabs.org)" ], "Received": [ "from lists.ozlabs.org (lists.ozlabs.org\n [IPv6:2404:9400:21b9:f100::1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4gBqSd3RSLz1yJq\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 23:18:41 +1000 (AEST)", "from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4gBqSd2Tb4z30WF;\n\tFri, 08 May 2026 23:18:41 +1000 (AEST)", "from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4gBqSc46jpz30Vy\n\tfor <linuxppc-dev@lists.ozlabs.org>; Fri, 08 May 2026 23:18:40 +1000 (AEST)", "from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n\tby sea.source.kernel.org (Postfix) with ESMTP id 139E443A49;\n\tFri, 8 May 2026 13:18:39 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id CBFB0C2BCB0;\n\tFri, 8 May 2026 13:18:30 +0000 (UTC)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1778246321;\n\tcv=none;\n b=LyVqPQpBvv9Dvd8jGmfYUFJyYV+tvX+HlMtdWG6hVgjFtoenA8jxtYVF0bElMqWzHOxuUv85CnL8jCzUVdk0zZou6usLFn4sxH4VzjArwaaNJTdAeng/YhjoPLoOAc5el04KEzr+X4PGNzwNcM6qtHNrNoHIGFQgON+k4MbAnAMxSF/C1ZjdGJHU2g8s0LheAOcjsRovISBuRQ9NaDbjwJXs8LOa3EVsqqJy9DV00WztHwSR2lQOGsPhrwLVp/2ptVKnysXUNG4w7+sA81fgSbiydHHNYaHy0EuBVZcwpTTJKoQFCVVWkWfPdwmmgTARK1rlAiVd+edH/QVsjsPcSg==", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1778246321; c=relaxed/relaxed;\n\tbh=RnHLTtopLU7OOOTHRdqqkeIjmjkR2pqhAVPVWaUOnXI=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=XAP+lj1xBrAgQ0rMg3PToC1mS/uXCT4i+ADgdQiW9j4Ewec5F3IBrPKsQWjYuSFuj7BScexJXyZcle7cwnrWfpyv/XAdBygwuxAiCzV/aUOk/roUZs2Z0fcFUpJvVEU2PTcvdjyKcPb9cQ5RtyA0sUYWZnZ+304kPKmptlFb53Qwz/iFjxz9eWMsmiFb7vhVdwsdTACMj4mVv8dss+KMw+r4MqW4Zfl5yiGuX7k0PsxTqL+c2jhd7yQhZ74zU7KENO8q3qj2PHnyUEZZ+FrOU41WRgeUCDBliE5m+TyUcbIsFfvXY4R+/laG50LQforsfEopjwUt+UOg3YVEOid7cQ==", "ARC-Authentication-Results": "i=1; lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org;\n dkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=odGALObB; dkim-atps=neutral;\n spf=pass (client-ip=172.234.252.31; helo=sea.source.kernel.org;\n envelope-from=frederic@kernel.org;\n receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1778246319;\n\tbh=aDFX0+laRCKARzsRyJXt2dacO4Lp4TbF1nix0/a8GEw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=odGALObB+8PSkGeU76sOdQvTcd+Ulfgdeu/xmsXvrU3fgW3UPCPEs25FKu5qJqYLe\n\t 2qb8WxUYbj0ewXH7rHl5cKQQ7hwYDRuQ6pXRfpsyIyIP3IJ9gPrwA4HKtpqPO+6Srw\n\t /gG7hW7BYDXL01UGMGRLQY5yvhcgVxh7zWqHwIFs5oTc4pIYLalCZ+VOIPkKbORBbO\n\t lqifg1C4C4JxwCvKroFuhd2eVx4aY3W3rIdDomzpOn4F+jD+qeNLiX+2Fy0hUh7g5V\n\t PYTyXhuSF0jSoOYTVyyBZQyTMM+E5cd5gPT8gEVgTXHKqVcbLa5wNfCn2OEpUTdJgO\n\t Cu3YKAwskHevg==", "From": "Frederic Weisbecker <frederic@kernel.org>", "To": "LKML <linux-kernel@vger.kernel.org>", "Cc": "Frederic Weisbecker <frederic@kernel.org>,\n\t\"Christophe Leroy (CS GROUP)\" <chleroy@kernel.org>,\n\t\"Rafael J. Wysocki\" <rafael@kernel.org>,\n\tAlexander Gordeev <agordeev@linux.ibm.com>,\n\tAnna-Maria Behnsen <anna-maria@linutronix.de>,\n\tBen Segall <bsegall@google.com>, Boqun Feng <boqun.feng@gmail.com>,\n\tChristian Borntraeger <borntraeger@linux.ibm.com>,\n\tDietmar Eggemann <dietmar.eggemann@arm.com>,\n\tHeiko Carstens <hca@linux.ibm.com>, Ingo Molnar <mingo@kernel.org>,\n\tIngo Molnar <mingo@redhat.com>, Jan Kiszka <jan.kiszka@siemens.com>,\n\tJoel Fernandes <joelagnelf@nvidia.com>,\n\tJuri Lelli <juri.lelli@redhat.com>,\n\tKieran Bingham <kbingham@kernel.org>,\n\tMadhavan Srinivasan <maddy@linux.ibm.com>,\n\tMel Gorman <mgorman@suse.de>, Michael Ellerman <mpe@ellerman.id.au>,\n\tNeeraj Upadhyay <neeraj.upadhyay@kernel.org>,\n\tNicholas Piggin <npiggin@gmail.com>,\n\t\"Paul E . McKenney\" <paulmck@kernel.org>,\n\tPeter Zijlstra <peterz@infradead.org>, Sashiko@lists.ozlabs.org,\n\tShrikanth Hegde <sshegde@linux.ibm.com>,\n\tSteven Rostedt <rostedt@goodmis.org>,\n\tSven Schnelle <svens@linux.ibm.com>,\n\tThomas Gleixner <tglx@linutronix.de>,\n\tUladzislau Rezki <urezki@gmail.com>,\n\tValentin Schneider <vschneid@redhat.com>,\n\tVasily Gorbik <gor@linux.ibm.com>,\n\tVincent Guittot <vincent.guittot@linaro.org>,\n\tViresh Kumar <viresh.kumar@linaro.org>,\n\tXin Zhao <jackzxcui1989@163.com>, linux-pm@vger.kernel.org,\n\tlinux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org", "Subject": "[PATCH 11/15] tick/sched: Account tickless idle cputime only when\n tick is stopped", "Date": "Fri, 8 May 2026 15:16:43 +0200", "Message-ID": "<20260508131647.43868-12-frederic@kernel.org>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260508131647.43868-1-frederic@kernel.org>", "References": "<20260508131647.43868-1-frederic@kernel.org>", "X-Mailing-List": "linuxppc-dev@lists.ozlabs.org", "List-Id": "<linuxppc-dev.lists.ozlabs.org>", "List-Help": "<mailto:linuxppc-dev+help@lists.ozlabs.org>", "List-Owner": "<mailto:linuxppc-dev+owner@lists.ozlabs.org>", "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>", "List-Archive": "<https://lore.kernel.org/linuxppc-dev/>,\n <https://lists.ozlabs.org/pipermail/linuxppc-dev/>", "List-Subscribe": "<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>", "List-Unsubscribe": "<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>", "Precedence": "list", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Spam-Status": "No, score=-0.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,\n\tDKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS\n\tautolearn=disabled version=4.0.1 OzLabs 8", "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org" }, "content": "There is no real point in switching to dyntick-idle cputime accounting\nmode if the tick is not actually stopped. This just adds overhead,\nnotably fetching the GTOD, on each idle exit and each idle IRQ entry for\nno reason during short idle trips.\n\nSigned-off-by: Frederic Weisbecker <frederic@kernel.org>\nTested-by: Shrikanth Hegde <sshegde@linux.ibm.com>\n---\n kernel/time/tick-sched.c | 50 +++++++++++++++++++++-------------------\n 1 file changed, 26 insertions(+), 24 deletions(-)", "diff": "diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c\nindex fa03cf7b3cec..c1ee0b256445 100644\n--- a/kernel/time/tick-sched.c\n+++ b/kernel/time/tick-sched.c\n@@ -1157,8 +1157,10 @@ void tick_nohz_idle_stop_tick(void)\n \t\tts->idle_sleeps++;\n \t\tts->idle_expires = expires;\n \n-\t\tif (!was_stopped && tick_sched_flag_test(ts, TS_FLAG_STOPPED))\n+\t\tif (!was_stopped && tick_sched_flag_test(ts, TS_FLAG_STOPPED)) {\n+\t\t\tkcpustat_dyntick_start(ts->idle_entrytime);\n \t\t\tnohz_balance_enter_idle(cpu);\n+\t\t}\n \t} else {\n \t\ttick_nohz_retain_tick(ts);\n \t}\n@@ -1200,7 +1202,6 @@ void tick_nohz_idle_enter(void)\n \tWARN_ON_ONCE(ts->timer_expires_base);\n \ttick_sched_flag_set(ts, TS_FLAG_INIDLE);\n \tts->idle_entrytime = ktime_get();\n-\tkcpustat_dyntick_start(ts->idle_entrytime);\n \ttick_nohz_clock_sleep(ts);\n \n \tlocal_irq_enable();\n@@ -1230,9 +1231,10 @@ void tick_nohz_irq_exit(void)\n \tstruct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched);\n \n \tif (tick_sched_flag_test(ts, TS_FLAG_INIDLE)) {\n-\t\tts->idle_entrytime = ktime_get();\n-\t\tkcpustat_irq_exit(ts->idle_entrytime);\n \t\ttick_nohz_clock_sleep(ts);\n+\t\tts->idle_entrytime = ktime_get();\n+\t\tif (tick_sched_flag_test(ts, TS_FLAG_STOPPED))\n+\t\t\tkcpustat_irq_exit(ts->idle_entrytime);\n \t} else {\n \t\ttick_nohz_full_update_tick(ts);\n \t}\n@@ -1333,8 +1335,17 @@ void tick_nohz_idle_restart_tick(void)\n {\n \tstruct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched);\n \n-\tif (tick_sched_flag_test(ts, TS_FLAG_STOPPED))\n-\t\ttick_nohz_restart_sched_tick(ts, ktime_get());\n+\tif (tick_sched_flag_test(ts, TS_FLAG_STOPPED)) {\n+\t\t/*\n+\t\t * Update entrytime here in case the tick restart is due to temporary\n+\t\t * polling on forced broadcast. The tick may be stopped again later within\n+\t\t * the same idle trip. The idle_entrytime was updated recently but make sure\n+\t\t * no tiny amount of idle time is accounted twice.\n+\t\t */\n+\t\tts->idle_entrytime = ktime_get();\n+\t\tkcpustat_dyntick_stop(ts->idle_entrytime);\n+\t\ttick_nohz_restart_sched_tick(ts, ts->idle_entrytime);\n+\t}\n }\n \n static void tick_nohz_idle_update_tick(struct tick_sched *ts, ktime_t now)\n@@ -1364,7 +1375,6 @@ static void tick_nohz_idle_update_tick(struct tick_sched *ts, ktime_t now)\n void tick_nohz_idle_exit(void)\n {\n \tstruct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched);\n-\tbool idle_active, tick_stopped;\n \tktime_t now;\n \n \tlocal_irq_disable();\n@@ -1373,18 +1383,13 @@ void tick_nohz_idle_exit(void)\n \tWARN_ON_ONCE(ts->timer_expires_base);\n \n \ttick_sched_flag_clear(ts, TS_FLAG_INIDLE);\n-\tidle_active = tick_sched_flag_test(ts, TS_FLAG_IDLE_ACTIVE);\n-\ttick_stopped = tick_sched_flag_test(ts, TS_FLAG_STOPPED);\n+\ttick_nohz_clock_wakeup(ts);\n \n-\tif (idle_active || tick_stopped)\n+\tif (tick_sched_flag_test(ts, TS_FLAG_STOPPED)) {\n \t\tnow = ktime_get();\n-\n-\tif (idle_active)\n-\t\ttick_nohz_clock_wakeup(ts);\n-\n-\tif (tick_stopped)\n+\t\tkcpustat_dyntick_stop(now);\n \t\ttick_nohz_idle_update_tick(ts, now);\n-\tkcpustat_dyntick_stop(now);\n+\t}\n \n \tlocal_irq_enable();\n }\n@@ -1439,15 +1444,13 @@ static inline void tick_nohz_irq_enter(void)\n \tstruct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched);\n \tktime_t now;\n \n-\tif (!tick_sched_flag_test(ts, TS_FLAG_STOPPED | TS_FLAG_IDLE_ACTIVE))\n+\ttick_nohz_clock_wakeup(ts);\n+\n+\tif (!tick_sched_flag_test(ts, TS_FLAG_STOPPED))\n \t\treturn;\n \n \tnow = ktime_get();\n-\n-\tif (tick_sched_flag_test(ts, TS_FLAG_IDLE_ACTIVE)) {\n-\t\ttick_nohz_clock_wakeup(ts);\n-\t\tkcpustat_irq_enter(now);\n-\t}\n+\tkcpustat_irq_enter(now);\n \n \t/*\n \t * If all CPUs are idle we may need to update a stale jiffies value.\n@@ -1456,8 +1459,7 @@ static inline void tick_nohz_irq_enter(void)\n \t * rare case (typically stop machine). So we must make sure we have a\n \t * last resort.\n \t */\n-\tif (tick_sched_flag_test(ts, TS_FLAG_STOPPED))\n-\t\ttick_nohz_update_jiffies(now);\n+\ttick_nohz_update_jiffies(now);\n }\n \n #else\n", "prefixes": [ "11/15" ] }