Skip to contentSkip to conversation

tick: Use the wrapped function to clear the logic

PATCH Applied Wang Wensheng 2 participants 2 messages Mar 26, 2021 – Apr 16, 2021 Nohz, dynticks support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tick: Use the wrapped function to clear the logic

The function tick_check_replacement() is the combination of tick_check_percpu() and tick_check_preferred(). It make the code easier to understand to use the self-described one function.

---
 kernel/time/tick-common.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
kernel/time/tick-common.c +1 -6
index 9d3a225..e15bc0e 100644
@@ -348,12 +348,7 @@ void tick_check_new_device(struct clock_event_device *newdev)
 	td = &per_cpu(tick_cpu_device, cpu);
 	curdev = td->evtdev;
 
-	/* cpu local device ? */
-	if (!tick_check_percpu(curdev, newdev, cpu))
-		goto out_bc;
-
-	/* Preference decision */
-	if (!tick_check_preferred(curdev, newdev))
+	if (!tick_check_replacement(curdev, newdev))
 		goto out_bc;
 
 	if (!try_module_get(newdev->owner))
Signature · 1 line
2.9.4
merge bot Applied
#1 lore raw

[tip: timers/core] tick: Use tick_check_replacement() instead of open coding it

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

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

Commit-ID:     d7840aaadd6e84915866a8f0dab586f6107dadf1
Gitweb:        https://git.kernel.org/tip/d7840aaadd6e84915866a8f0dab586f6107dadf1
Author:        Wang Wensheng <[email protected]>
AuthorDate:    Fri, 26 Mar 2021 02:23:28 
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Fri, 16 Apr 2021 21:03:50 +02:00

tick: Use tick_check_replacement() instead of open coding it

The function tick_check_replacement() is the combination of tick_check_percpu() and tick_check_preferred(), but tick_check_new_device() has the same logic open coded.

Use the helper to simplify the code.

[ tglx: Massage changelog ]

---
 kernel/time/tick-common.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
kernel/time/tick-common.c +1 -6
index 9d3a225..e15bc0e 100644
@@ -348,12 +348,7 @@ void tick_check_new_device(struct clock_event_device *newdev)
 	td = &per_cpu(tick_cpu_device, cpu);
 	curdev = td->evtdev;
 
-	/* cpu local device ? */
-	if (!tick_check_percpu(curdev, newdev, cpu))
-		goto out_bc;
-
-	/* Preference decision */
-	if (!tick_check_preferred(curdev, newdev))
+	if (!tick_check_replacement(curdev, newdev))
 		goto out_bc;
 
 	if (!try_module_get(newdev->owner))