linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] timers/migration: Clean up the loop in tmigr_quick_check()
@ 2025-06-06 12:48 Petr Tesarik
  2025-06-10 12:57 ` Frederic Weisbecker
  2025-06-12 20:49 ` [tip: timers/core] " tip-bot2 for Petr Tesarik
  0 siblings, 2 replies; 3+ messages in thread
From: Petr Tesarik @ 2025-06-06 12:48 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner
  Cc: (open list:HIGH-RESOLUTION TIMERS, TIMER WHEEL, CLOCKEVENTS),
	Petr Tesarik

Make the logic easier to follow:

  - Remove the final return statement, which is never reached, and move the
    actual walk-terminating return statement out of the do-while loop.

  - Remove the else-clause to reduce indentation. If a non-lonely group is
    encountered during the walk, the loop is immediately terminated with a
    return statement anyway; no need for an else.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
 kernel/time/timer_migration.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c
index 2f6330831f084..c0c54dc5314c3 100644
--- a/kernel/time/timer_migration.c
+++ b/kernel/time/timer_migration.c
@@ -1405,23 +1405,20 @@ u64 tmigr_quick_check(u64 nextevt)
 		return KTIME_MAX;
 
 	do {
-		if (!tmigr_check_lonely(group)) {
+		if (!tmigr_check_lonely(group))
 			return KTIME_MAX;
-		} else {
-			/*
-			 * Since current CPU is active, events may not be sorted
-			 * from bottom to the top because the CPU's event is ignored
-			 * up to the top and its sibling's events not propagated upwards.
-			 * Thus keep track of the lowest observed expiry.
-			 */
-			nextevt = min_t(u64, nextevt, READ_ONCE(group->next_expiry));
-			if (!group->parent)
-				return nextevt;
-		}
+
+		/*
+		 * Since current CPU is active, events may not be sorted
+		 * from bottom to the top because the CPU's event is ignored
+		 * up to the top and its sibling's events not propagated upwards.
+		 * Thus keep track of the lowest observed expiry.
+		 */
+		nextevt = min_t(u64, nextevt, READ_ONCE(group->next_expiry));
 		group = group->parent;
 	} while (group);
 
-	return KTIME_MAX;
+	return nextevt;
 }
 
 /*
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] timers/migration: Clean up the loop in tmigr_quick_check()
  2025-06-06 12:48 [PATCH] timers/migration: Clean up the loop in tmigr_quick_check() Petr Tesarik
@ 2025-06-10 12:57 ` Frederic Weisbecker
  2025-06-12 20:49 ` [tip: timers/core] " tip-bot2 for Petr Tesarik
  1 sibling, 0 replies; 3+ messages in thread
From: Frederic Weisbecker @ 2025-06-10 12:57 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: Anna-Maria Behnsen, Thomas Gleixner,
	(open list:HIGH-RESOLUTION TIMERS, TIMER WHEEL, CLOCKEVENTS)

Le Fri, Jun 06, 2025 at 02:48:18PM +0200, Petr Tesarik a écrit :
> Make the logic easier to follow:
> 
>   - Remove the final return statement, which is never reached, and move the
>     actual walk-terminating return statement out of the do-while loop.
> 
>   - Remove the else-clause to reduce indentation. If a non-lonely group is
>     encountered during the walk, the loop is immediately terminated with a
>     return statement anyway; no need for an else.
> 
> Signed-off-by: Petr Tesarik <ptesarik@suse.com>

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>

-- 
Frederic Weisbecker
SUSE Labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: timers/core] timers/migration: Clean up the loop in tmigr_quick_check()
  2025-06-06 12:48 [PATCH] timers/migration: Clean up the loop in tmigr_quick_check() Petr Tesarik
  2025-06-10 12:57 ` Frederic Weisbecker
@ 2025-06-12 20:49 ` tip-bot2 for Petr Tesarik
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Petr Tesarik @ 2025-06-12 20:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Petr Tesarik, Thomas Gleixner, Frederic Weisbecker, x86,
	linux-kernel

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     ff56a3e2a8613e8524f40ef2efa2c0169659e99e
Gitweb:        https://git.kernel.org/tip/ff56a3e2a8613e8524f40ef2efa2c0169659e99e
Author:        Petr Tesarik <ptesarik@suse.com>
AuthorDate:    Fri, 06 Jun 2025 14:48:18 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Thu, 12 Jun 2025 21:03:45 +02:00

timers/migration: Clean up the loop in tmigr_quick_check()

Make the logic easier to follow:

  - Remove the final return statement, which is never reached, and move the
    actual walk-terminating return statement out of the do-while loop.

  - Remove the else-clause to reduce indentation. If a non-lonely group is
    encountered during the walk, the loop is immediately terminated with a
    return statement anyway; no need for an else.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/all/20250606124818.455560-1-ptesarik@suse.com

---
 kernel/time/timer_migration.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c
index 2f63308..c0c54dc 100644
--- a/kernel/time/timer_migration.c
+++ b/kernel/time/timer_migration.c
@@ -1405,23 +1405,20 @@ u64 tmigr_quick_check(u64 nextevt)
 		return KTIME_MAX;
 
 	do {
-		if (!tmigr_check_lonely(group)) {
+		if (!tmigr_check_lonely(group))
 			return KTIME_MAX;
-		} else {
-			/*
-			 * Since current CPU is active, events may not be sorted
-			 * from bottom to the top because the CPU's event is ignored
-			 * up to the top and its sibling's events not propagated upwards.
-			 * Thus keep track of the lowest observed expiry.
-			 */
-			nextevt = min_t(u64, nextevt, READ_ONCE(group->next_expiry));
-			if (!group->parent)
-				return nextevt;
-		}
+
+		/*
+		 * Since current CPU is active, events may not be sorted
+		 * from bottom to the top because the CPU's event is ignored
+		 * up to the top and its sibling's events not propagated upwards.
+		 * Thus keep track of the lowest observed expiry.
+		 */
+		nextevt = min_t(u64, nextevt, READ_ONCE(group->next_expiry));
 		group = group->parent;
 	} while (group);
 
-	return KTIME_MAX;
+	return nextevt;
 }
 
 /*

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-12 20:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-06 12:48 [PATCH] timers/migration: Clean up the loop in tmigr_quick_check() Petr Tesarik
2025-06-10 12:57 ` Frederic Weisbecker
2025-06-12 20:49 ` [tip: timers/core] " tip-bot2 for Petr Tesarik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).