Skip to contentSkip to conversation

epoll-use-try_cmpxchg-in-list_add_tail_lockless.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Sep 12, 2022

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: epoll: use try_cmpxchg in list_add_tail_lockless
has been removed from the -mm tree. Its filename was
epoll-use-try_cmpxchg-in-list_add_tail_lockless.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Uros Bizjak <[email protected]>
Subject: epoll: use try_cmpxchg in list_add_tail_lockless
Date: Thu, 14 Jul 2022 19:32:55 +0200

Use try_cmpxchg instead of cmpxchg (*ptr, old, new) == old in list_add_tail_lockless. 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.

---

 fs/eventpoll.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/eventpoll.c renamed from fs/eventpoll.c~epoll-use-try_cmpxchg-in-list_add_tail_lockless +1 -1
@@ -1065,7 +1065,7 @@ static inline bool list_add_tail_lockles
 	 * added to the list from another CPU: the winner observes
 	 * new->next == new.
 	 */
-	if (cmpxchg(&new->next, new, head) != new)
+	if (!try_cmpxchg(&new->next, &new, head))
 		return false;
 
 	/*

_

Patches currently in -mm which might be from [email protected] are