All of lore.kernel.org
 help / color / mirror / Atom feed
* + sched-fair-use-try_cmpxchg-in-task_numa_work.patch added to mm-nonmm-unstable branch
@ 2022-11-07 22:07 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2022-11-07 22:07 UTC (permalink / raw)
  To: mm-commits, vincent.guittot, peterz, mingo, juri.lelli, ubizjak,
	akpm


The patch titled
     Subject: sched/fair: use try_cmpxchg in task_numa_work
has been added to the -mm mm-nonmm-unstable branch.  Its filename is
     sched-fair-use-try_cmpxchg-in-task_numa_work.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/sched-fair-use-try_cmpxchg-in-task_numa_work.patch

This patch will later appear in the mm-nonmm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: Uros Bizjak <ubizjak@gmail.com>
Subject: sched/fair: use try_cmpxchg in task_numa_work
Date: Mon, 22 Aug 2022 19:39:56 +0200

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/20220822173956.82525-1-ubizjak@gmail.com
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 kernel/sched/fair.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/sched/fair.c~sched-fair-use-try_cmpxchg-in-task_numa_work
+++ a/kernel/sched/fair.c
@@ -2964,7 +2964,7 @@ static void task_numa_work(struct callba
 	}
 
 	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;
 
 	/*
_

Patches currently in -mm which might be from ubizjak@gmail.com are

zram-use-try_cmpxchg-in-update_used_max.patch
llist-avoid-extra-memory-read-in-llist_add_batch.patch
sched-fair-use-try_cmpxchg-in-task_numa_work.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-07 22:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-07 22:07 + sched-fair-use-try_cmpxchg-in-task_numa_work.patch added to mm-nonmm-unstable branch Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.