diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Kconfig | 3 | ||||
| -rw-r--r-- | lib/Makefile | 4 | ||||
| -rw-r--r-- | lib/llist.c | 74 | ||||
| -rw-r--r-- | lib/raid6/int.uc | 2 | ||||
| -rw-r--r-- | lib/smp_processor_id.c | 2 |
5 files changed, 20 insertions, 65 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index 6c695ff9caba..32f3e5ae2be5 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
| @@ -276,7 +276,4 @@ config CORDIC | |||
| 276 | so its calculations are in fixed point. Modules can select this | 276 | so its calculations are in fixed point. Modules can select this |
| 277 | when they require this function. Module will be called cordic. | 277 | when they require this function. Module will be called cordic. |
| 278 | 278 | ||
| 279 | config LLIST | ||
| 280 | bool | ||
| 281 | |||
| 282 | endmenu | 279 | endmenu |
diff --git a/lib/Makefile b/lib/Makefile index 3f5bc6d903e0..a4da283f5dc0 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
| @@ -22,7 +22,7 @@ lib-y += kobject.o kref.o klist.o | |||
| 22 | obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ | 22 | obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ |
| 23 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ | 23 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ |
| 24 | string_helpers.o gcd.o lcm.o list_sort.o uuid.o flex_array.o \ | 24 | string_helpers.o gcd.o lcm.o list_sort.o uuid.o flex_array.o \ |
| 25 | bsearch.o find_last_bit.o find_next_bit.o | 25 | bsearch.o find_last_bit.o find_next_bit.o llist.o |
| 26 | obj-y += kstrtox.o | 26 | obj-y += kstrtox.o |
| 27 | obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o | 27 | obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o |
| 28 | 28 | ||
| @@ -115,8 +115,6 @@ obj-$(CONFIG_CPU_RMAP) += cpu_rmap.o | |||
| 115 | 115 | ||
| 116 | obj-$(CONFIG_CORDIC) += cordic.o | 116 | obj-$(CONFIG_CORDIC) += cordic.o |
| 117 | 117 | ||
| 118 | obj-$(CONFIG_LLIST) += llist.o | ||
| 119 | |||
| 120 | hostprogs-y := gen_crc32table | 118 | hostprogs-y := gen_crc32table |
| 121 | clean-files := crc32table.h | 119 | clean-files := crc32table.h |
| 122 | 120 | ||
diff --git a/lib/llist.c b/lib/llist.c index da445724fa1f..700cff77a387 100644 --- a/lib/llist.c +++ b/lib/llist.c | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | * | 3 | * |
| 4 | * The basic atomic operation of this list is cmpxchg on long. On | 4 | * The basic atomic operation of this list is cmpxchg on long. On |
| 5 | * architectures that don't have NMI-safe cmpxchg implementation, the | 5 | * architectures that don't have NMI-safe cmpxchg implementation, the |
| 6 | * list can NOT be used in NMI handler. So code uses the list in NMI | 6 | * list can NOT be used in NMI handlers. So code that uses the list in |
| 7 | * handler should depend on CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG. | 7 | * an NMI handler should depend on CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG. |
| 8 | * | 8 | * |
| 9 | * Copyright 2010,2011 Intel Corp. | 9 | * Copyright 2010,2011 Intel Corp. |
| 10 | * Author: Huang Ying <ying.huang@intel.com> | 10 | * Author: Huang Ying <ying.huang@intel.com> |
| @@ -30,48 +30,28 @@ | |||
| 30 | #include <asm/system.h> | 30 | #include <asm/system.h> |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| 33 | * llist_add - add a new entry | ||
| 34 | * @new: new entry to be added | ||
| 35 | * @head: the head for your lock-less list | ||
| 36 | */ | ||
| 37 | void llist_add(struct llist_node *new, struct llist_head *head) | ||
| 38 | { | ||
| 39 | struct llist_node *entry, *old_entry; | ||
| 40 | |||
| 41 | #ifndef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG | ||
| 42 | BUG_ON(in_nmi()); | ||
| 43 | #endif | ||
| 44 | |||
| 45 | entry = head->first; | ||
| 46 | do { | ||
| 47 | old_entry = entry; | ||
| 48 | new->next = entry; | ||
| 49 | cpu_relax(); | ||
| 50 | } while ((entry = cmpxchg(&head->first, old_entry, new)) != old_entry); | ||
| 51 | } | ||
| 52 | EXPORT_SYMBOL_GPL(llist_add); | ||
| 53 | |||
| 54 | /** | ||
| 55 | * llist_add_batch - add several linked entries in batch | 33 | * llist_add_batch - add several linked entries in batch |
| 56 | * @new_first: first entry in batch to be added | 34 | * @new_first: first entry in batch to be added |
| 57 | * @new_last: last entry in batch to be added | 35 | * @new_last: last entry in batch to be added |
| 58 | * @head: the head for your lock-less list | 36 | * @head: the head for your lock-less list |
| 37 | * | ||
| 38 | * Return whether list is empty before adding. | ||
| 59 | */ | 39 | */ |
| 60 | void llist_add_batch(struct llist_node *new_first, struct llist_node *new_last, | 40 | bool llist_add_batch(struct llist_node *new_first, struct llist_node *new_last, |
| 61 | struct llist_head *head) | 41 | struct llist_head *head) |
| 62 | { | 42 | { |
| 63 | struct llist_node *entry, *old_entry; | 43 | struct llist_node *entry, *old_entry; |
| 64 | 44 | ||
| 65 | #ifndef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG | ||
| 66 | BUG_ON(in_nmi()); | ||
| 67 | #endif | ||
| 68 | |||
| 69 | entry = head->first; | 45 | entry = head->first; |
| 70 | do { | 46 | for (;;) { |
| 71 | old_entry = entry; | 47 | old_entry = entry; |
| 72 | new_last->next = entry; | 48 | new_last->next = entry; |
| 73 | cpu_relax(); | 49 | entry = cmpxchg(&head->first, old_entry, new_first); |
| 74 | } while ((entry = cmpxchg(&head->first, old_entry, new_first)) != old_entry); | 50 | if (entry == old_entry) |
| 51 | break; | ||
| 52 | } | ||
| 53 | |||
| 54 | return old_entry == NULL; | ||
| 75 | } | 55 | } |
| 76 | EXPORT_SYMBOL_GPL(llist_add_batch); | 56 | EXPORT_SYMBOL_GPL(llist_add_batch); |
| 77 | 57 | ||
| @@ -93,37 +73,17 @@ struct llist_node *llist_del_first(struct llist_head *head) | |||
| 93 | { | 73 | { |
| 94 | struct llist_node *entry, *old_entry, *next; | 74 | struct llist_node *entry, *old_entry, *next; |
| 95 | 75 | ||
| 96 | #ifndef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG | ||
| 97 | BUG_ON(in_nmi()); | ||
| 98 | #endif | ||
| 99 | |||
| 100 | entry = head->first; | 76 | entry = head->first; |
| 101 | do { | 77 | for (;;) { |
| 102 | if (entry == NULL) | 78 | if (entry == NULL) |
| 103 | return NULL; | 79 | return NULL; |
| 104 | old_entry = entry; | 80 | old_entry = entry; |
| 105 | next = entry->next; | 81 | next = entry->next; |
| 106 | cpu_relax(); | 82 | entry = cmpxchg(&head->first, old_entry, next); |
| 107 | } while ((entry = cmpxchg(&head->first, old_entry, next)) != old_entry); | 83 | if (entry == old_entry) |
| 84 | break; | ||
| 85 | } | ||
| 108 | 86 | ||
| 109 | return entry; | 87 | return entry; |
| 110 | } | 88 | } |
| 111 | EXPORT_SYMBOL_GPL(llist_del_first); | 89 | EXPORT_SYMBOL_GPL(llist_del_first); |
| 112 | |||
| 113 | /** | ||
| 114 | * llist_del_all - delete all entries from lock-less list | ||
| 115 | * @head: the head of lock-less list to delete all entries | ||
| 116 | * | ||
| 117 | * If list is empty, return NULL, otherwise, delete all entries and | ||
| 118 | * return the pointer to the first entry. The order of entries | ||
| 119 | * deleted is from the newest to the oldest added one. | ||
| 120 | */ | ||
| 121 | struct llist_node *llist_del_all(struct llist_head *head) | ||
| 122 | { | ||
| 123 | #ifndef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG | ||
| 124 | BUG_ON(in_nmi()); | ||
| 125 | #endif | ||
| 126 | |||
| 127 | return xchg(&head->first, NULL); | ||
| 128 | } | ||
| 129 | EXPORT_SYMBOL_GPL(llist_del_all); | ||
diff --git a/lib/raid6/int.uc b/lib/raid6/int.uc index d1e276a14fab..5b50f8dfc5d2 100644 --- a/lib/raid6/int.uc +++ b/lib/raid6/int.uc | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | * ----------------------------------------------------------------------- */ | 11 | * ----------------------------------------------------------------------- */ |
| 12 | 12 | ||
| 13 | /* | 13 | /* |
| 14 | * raid6int$#.c | 14 | * int$#.c |
| 15 | * | 15 | * |
| 16 | * $#-way unrolled portable integer math RAID-6 instruction set | 16 | * $#-way unrolled portable integer math RAID-6 instruction set |
| 17 | * | 17 | * |
diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c index 4689cb073da4..503f087382a4 100644 --- a/lib/smp_processor_id.c +++ b/lib/smp_processor_id.c | |||
| @@ -22,7 +22,7 @@ notrace unsigned int debug_smp_processor_id(void) | |||
| 22 | * Kernel threads bound to a single CPU can safely use | 22 | * Kernel threads bound to a single CPU can safely use |
| 23 | * smp_processor_id(): | 23 | * smp_processor_id(): |
| 24 | */ | 24 | */ |
| 25 | if (cpumask_equal(¤t->cpus_allowed, cpumask_of(this_cpu))) | 25 | if (cpumask_equal(tsk_cpus_allowed(current), cpumask_of(this_cpu))) |
| 26 | goto out; | 26 | goto out; |
| 27 | 27 | ||
| 28 | /* | 28 | /* |
