diff options
| author | Uros Bizjak <[email protected]> | 2022-08-22 19:39:56 +0200 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2022-11-18 13:55:09 -0800 |
| commit | 8baceabca656d5ef4494cdeb3b9b9fbb844ac613 (patch) | |
| tree | b60ac4475d4ad3d2b3ddf83a6d0adb199ca48a2e | |
| parent | 333d073dee3a6865171d43e3b0a9ff688bff5891 (diff) | |
sched/fair: use try_cmpxchg in task_numa_work
Use try_cmpxchg instead of cmpxchg (*ptr, old, new) == old in
task_numa_work. x86 CMPXCHG instruction returns success in ZF flag, so
this change saves a compare after cmpxchg (and related move instruction in
front of cmpxchg).
No functional change intended.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Uros Bizjak <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Juri Lelli <[email protected]>
Cc: Vincent Guittot <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
| -rw-r--r-- | kernel/sched/fair.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e4a0b8bd941c..d6fa06f036e1 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2964,7 +2964,7 @@ static void task_numa_work(struct callback_head *work) } next_scan = now + msecs_to_jiffies(p->numa_scan_period); - if (cmpxchg(&mm->numa_next_scan, migrate, next_scan) != migrate) + if (!try_cmpxchg(&mm->numa_next_scan, &migrate, next_scan)) return; /* |