[PATCH 8/5] llist: Remove cpu_relax() usage in cmpxchg loops

From: Peter Zijlstra
Date: Mon Sep 12 2011 - 10:06:24 EST


Subject: llist: Remove cpu_relax() usage in cmpxchg loops
From: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Date: Mon Sep 12 15:50:49 CEST 2011

Initial benchmarks show they're a net loss (2 socket wsm):

$ for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor ; do echo performance > $i; done
$ echo 4096 32000 64 128 > /proc/sys/kernel/sem
$ ./sembench -t 2048 -w 1900 -o 0

Pre:

run time 30 seconds 778936 worker burns per second
run time 30 seconds 912190 worker burns per second
run time 30 seconds 817506 worker burns per second
run time 30 seconds 830870 worker burns per second
run time 30 seconds 845056 worker burns per second

Post:

run time 30 seconds 905920 worker burns per second
run time 30 seconds 849046 worker burns per second
run time 30 seconds 886286 worker burns per second
run time 30 seconds 822320 worker burns per second
run time 30 seconds 900283 worker burns per second

Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
---
include/linux/llist.h | 3 ---
1 file changed, 3 deletions(-)

Index: linux-2.6/include/linux/llist.h
===================================================================
--- linux-2.6.orig/include/linux/llist.h
+++ linux-2.6/include/linux/llist.h
@@ -169,7 +169,6 @@ static inline bool llist_add(struct llis
entry = cmpxchg(&head->first, old_entry, new);
if (entry == old_entry)
break;
- cpu_relax();
}

return old_entry == NULL;
@@ -198,7 +197,6 @@ static inline bool llist_add_batch(struc
entry = cmpxchg(&head->first, old_entry, new_first);
if (entry == old_entry)
break;
- cpu_relax();
}

return old_entry == NULL;
@@ -233,7 +231,6 @@ static inline struct llist_node *llist_d
entry = cmpxchg(&head->first, old_entry, next);
if (entry == old_entry)
break;
- cpu_relax();
}

return entry;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/