sched: Use lock guards, wave 1
Status from this message: The following commit has been merged into the sched/core branch of tip:
Get series with b4
b4 am [email protected]Versions newest first
Patches in v1 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/9 | sched: Simplify get_nohz_timer_target()kernel/ | +6 | 3 replies | |
| 2/9 | sched: Simplify sysctl_sched_uclamp_handler()kernel/ | +4 | 0 replies | |
| 3/9 | sched: Simplify: migrate_swap_stop()kernel/ kernel/ | +27 | 0 replies | |
| 4/9 | sched: Simplify wake_up_if_idle()kernel/ kernel/ | +21 | 0 replies | |
| 5/9 | sched: Simplify ttwu()kernel/ | +109 | 3 replies | |
| 6/9 | sched: Simplify sched_exec()kernel/ | +9 | 0 replies | |
| 7/9 | sched: Simplify sched_tick_remote()kernel/ | +18 | 0 replies | |
| 8/9 | sched: Simplify try_steal_cookie()kernel/ | +9 | 0 replies | |
| 9/9 | sched: Simplify sched_core_cpu_{starting,deactivate}()kernel/ | +12 | 0 replies |
Reviews trailers per patch
1 of 9 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Joel Fernandes (Google) | Valentin Schneider |
|---|---|---|
| Series | R-b | |
| 1/9 | R-b | |
| 2/9 | ||
| 3/9 | ||
| 4/9 | ||
| 5/9 | ||
| 6/9 | ||
| 7/9 | ||
| 8/9 | ||
| 9/9 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/9] sched: Use lock guards, wave 1
Hi,
This is the first of two series converting kernel/sched/core.c to use the shiny new Scope-Based Resource Management machinery that has recently been merged:
https://lkml.kernel.org/r/20230612093537.614161713%40infradead.org
TL;DR:
void foo()
{
raw_spin_lock(&lock);
if (!cond)
goto unlock;
...
unlock:
raw_spin_unlock(&lock);
}can now be written like:
void foo()
{
guard(raw_spinlock)(&lock);
if (!cond)
return;
...
}or:
void foo()
{
scoped_guard (raw_spinlock, &lock) {
if (!cond)
break;
...
}
}Where guard() instantiates a 'cleanup' variable that is initialized by an expression that locks and returns the lock pointer. When this variable goes out of scope, the cleanup does the unlock. And scoped_guard() does the same but creates an explicit scope (using for).
By having the unlock be implicit, the code becomes simpler since it is no longer needed to manually track the various exit/error cases and many goto's just go away.
Specifically, every patch in this series is aimed at removing an out/unlock label and it's corresponding gotos.
If there are no objections / comments, I'm aiming to post the second batch at the end of the week.
Also available at:
git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/guards