···908 The default yes will allow the kernel to do irq load balancing.909 Saying no will keep the kernel from doing irq load balancing.910911-config HAVE_DEC_LOCK912- bool913- depends on (SMP || PREEMPT) && X86_CMPXCHG914- default y915-916# turning this on wastes a bunch of space.917# Summit needs it only when NUMA is on918config BOOT_IOREMAP
···908 The default yes will allow the kernel to do irq load balancing.909 Saying no will keep the kernel from doing irq load balancing.91000000911# turning this on wastes a bunch of space.912# Summit needs it only when NUMA is on913config BOOT_IOREMAP
···1-/*2- * x86 version of "atomic_dec_and_lock()" using3- * the atomic "cmpxchg" instruction.4- *5- * (For CPU's lacking cmpxchg, we use the slow6- * generic version, and this one never even gets7- * compiled).8- */9-10-#include <linux/spinlock.h>11-#include <linux/module.h>12-#include <asm/atomic.h>13-14-int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)15-{16- int counter;17- int newcount;18-19-repeat:20- counter = atomic_read(atomic);21- newcount = counter-1;22-23- if (!newcount)24- goto slow_path;25-26- asm volatile("lock; cmpxchgl %1,%2"27- :"=a" (newcount)28- :"r" (newcount), "m" (atomic->counter), "0" (counter));29-30- /* If the above failed, "eax" will have changed */31- if (newcount != counter)32- goto repeat;33- return 0;34-35-slow_path:36- spin_lock(lock);37- if (atomic_dec_and_test(atomic))38- return 1;39- spin_unlock(lock);40- return 0;41-}42-EXPORT_SYMBOL(_atomic_dec_and_lock);
···000000000000000000000000000000000000000000
-5
arch/ia64/Kconfig
···298299source "mm/Kconfig"300301-config HAVE_DEC_LOCK302- bool303- depends on (SMP || PREEMPT)304- default y305-306config IA32_SUPPORT307 bool "Support for Linux/x86 binaries"308 help
···298299source "mm/Kconfig"30000000301config IA32_SUPPORT302 bool "Support for Linux/x86 binaries"303 help
···1-/*2- * Copyright (C) 2003 Jerome Marchand, Bull S.A.3- * Cleaned up by David Mosberger-Tang <davidm@hpl.hp.com>4- *5- * This file is released under the GPLv2, or at your option any later version.6- *7- * ia64 version of "atomic_dec_and_lock()" using the atomic "cmpxchg" instruction. This8- * code is an adaptation of the x86 version of "atomic_dec_and_lock()".9- */10-11-#include <linux/compiler.h>12-#include <linux/module.h>13-#include <linux/spinlock.h>14-#include <asm/atomic.h>15-16-/*17- * Decrement REFCOUNT and if the count reaches zero, acquire the spinlock. Both of these18- * operations have to be done atomically, so that the count doesn't drop to zero without19- * acquiring the spinlock first.20- */21-int22-_atomic_dec_and_lock (atomic_t *refcount, spinlock_t *lock)23-{24- int old, new;25-26- do {27- old = atomic_read(refcount);28- new = old - 1;29-30- if (unlikely (old == 1)) {31- /* oops, we may be decrementing to zero, do it the slow way... */32- spin_lock(lock);33- if (atomic_dec_and_test(refcount))34- return 1;35- spin_unlock(lock);36- return 0;37- }38- } while (cmpxchg(&refcount->counter, old, new) != old);39- return 0;40-}41-42-EXPORT_SYMBOL(_atomic_dec_and_lock);
···000000000000000000000000000000000000000000
-5
arch/m32r/Kconfig
···220 Say Y here if you are building a kernel for a desktop, embedded221 or real-time system. Say N if you are unsure.222223-config HAVE_DEC_LOCK224- bool225- depends on (SMP || PREEMPT)226- default n227-228config SMP229 bool "Symmetric multi-processing support"230 ---help---
···220 Say Y here if you are building a kernel for a desktop, embedded221 or real-time system. Say N if you are unsure.22200000223config SMP224 bool "Symmetric multi-processing support"225 ---help---
-4
arch/mips/Kconfig
···1009 bool1010 default y10111012-config HAVE_DEC_LOCK1013- bool1014- default y1015-1016#1017# Select some configuration options automatically based on user selections.1018#
···1009 bool1010 default y101100001012#1013# Select some configuration options automatically based on user selections.1014#
···1-/*2- * MIPS version of atomic_dec_and_lock() using cmpxchg3- *4- * This program is free software; you can redistribute it and/or5- * modify it under the terms of the GNU General Public License6- * as published by the Free Software Foundation; either version7- * 2 of the License, or (at your option) any later version.8- */9-10-#include <linux/module.h>11-#include <linux/spinlock.h>12-#include <asm/atomic.h>13-#include <asm/system.h>14-15-/*16- * This is an implementation of the notion of "decrement a17- * reference count, and return locked if it decremented to zero".18- *19- * This implementation can be used on any architecture that20- * has a cmpxchg, and where atomic->value is an int holding21- * the value of the atomic (i.e. the high bits aren't used22- * for a lock or anything like that).23- */24-int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)25-{26- int counter;27- int newcount;28-29- for (;;) {30- counter = atomic_read(atomic);31- newcount = counter - 1;32- if (!newcount)33- break; /* do it the slow way */34-35- newcount = cmpxchg(&atomic->counter, counter, newcount);36- if (newcount == counter)37- return 0;38- }39-40- spin_lock(lock);41- if (atomic_dec_and_test(atomic))42- return 1;43- spin_unlock(lock);44- return 0;45-}46-47-EXPORT_SYMBOL(_atomic_dec_and_lock);
···1-#include <linux/module.h>2-#include <linux/spinlock.h>3-#include <asm/atomic.h>4-#include <asm/system.h>5-6-/*7- * This is an implementation of the notion of "decrement a8- * reference count, and return locked if it decremented to zero".9- *10- * This implementation can be used on any architecture that11- * has a cmpxchg, and where atomic->value is an int holding12- * the value of the atomic (i.e. the high bits aren't used13- * for a lock or anything like that).14- */15-int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)16-{17- int counter;18- int newcount;19-20- for (;;) {21- counter = atomic_read(atomic);22- newcount = counter - 1;23- if (!newcount)24- break; /* do it the slow way */25-26- newcount = cmpxchg(&atomic->counter, counter, newcount);27- if (newcount == counter)28- return 0;29- }30-31- spin_lock(lock);32- if (atomic_dec_and_test(atomic))33- return 1;34- spin_unlock(lock);35- return 0;36-}37-38-EXPORT_SYMBOL(_atomic_dec_and_lock);
···28 bool29 default y30000031config EARLY_PRINTK32 bool33 default y
+1-1
arch/ppc64/lib/Makefile
···2# Makefile for ppc64-specific library files..3#45-lib-y := checksum.o dec_and_lock.o string.o strcase.o6lib-y += copypage.o memcpy.o copyuser.o usercopy.o78# Lock primitives are defined as no-ops in include/linux/spinlock.h
···2# Makefile for ppc64-specific library files..3#45+lib-y := checksum.o string.o strcase.o6lib-y += copypage.o memcpy.o copyuser.o usercopy.o78# Lock primitives are defined as no-ops in include/linux/spinlock.h
-47
arch/ppc64/lib/dec_and_lock.c
···1-/*2- * ppc64 version of atomic_dec_and_lock() using cmpxchg3- *4- * This program is free software; you can redistribute it and/or5- * modify it under the terms of the GNU General Public License6- * as published by the Free Software Foundation; either version7- * 2 of the License, or (at your option) any later version.8- */9-10-#include <linux/module.h>11-#include <linux/spinlock.h>12-#include <asm/atomic.h>13-#include <asm/system.h>14-15-/*16- * This is an implementation of the notion of "decrement a17- * reference count, and return locked if it decremented to zero".18- *19- * This implementation can be used on any architecture that20- * has a cmpxchg, and where atomic->value is an int holding21- * the value of the atomic (i.e. the high bits aren't used22- * for a lock or anything like that).23- */24-int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)25-{26- int counter;27- int newcount;28-29- for (;;) {30- counter = atomic_read(atomic);31- newcount = counter - 1;32- if (!newcount)33- break; /* do it the slow way */34-35- newcount = cmpxchg(&atomic->counter, counter, newcount);36- if (newcount == counter)37- return 0;38- }39-40- spin_lock(lock);41- if (atomic_dec_and_test(atomic))42- return 1;43- spin_unlock(lock);44- return 0;45-}46-47-EXPORT_SYMBOL(_atomic_dec_and_lock);
···33 depends on DEBUG_KERNEL34 bool "Debug BOOTMEM initialization"3536-# We have a custom atomic_dec_and_lock() implementation but it's not37-# compatible with spinlock debugging so we need to fall back on38-# the generic version in that case.39-config HAVE_DEC_LOCK40- bool41- depends on SMP && !DEBUG_SPINLOCK42- default y43-44config MCOUNT45 bool46 depends on STACK_DEBUG
···33 depends on DEBUG_KERNEL34 bool "Debug BOOTMEM initialization"350000000036config MCOUNT37 bool38 depends on STACK_DEBUG
-3
arch/sparc64/kernel/sparc64_ksyms.c
···163EXPORT_SYMBOL(atomic64_add_ret);164EXPORT_SYMBOL(atomic64_sub);165EXPORT_SYMBOL(atomic64_sub_ret);166-#ifdef CONFIG_SMP167-EXPORT_SYMBOL(_atomic_dec_and_lock);168-#endif169170/* Atomic bit operations. */171EXPORT_SYMBOL(test_and_set_bit);
···163EXPORT_SYMBOL(atomic64_add_ret);164EXPORT_SYMBOL(atomic64_sub);165EXPORT_SYMBOL(atomic64_sub_ret);000166167/* Atomic bit operations. */168EXPORT_SYMBOL(test_and_set_bit);
···277config HAVE_ARCH_EARLY_PFN_TO_NID278 def_bool y279280-config HAVE_DEC_LOCK281- bool282- depends on SMP283- default y284-285config NR_CPUS286 int "Maximum number of CPUs (2-256)"287 range 2 256
···277config HAVE_ARCH_EARLY_PFN_TO_NID278 def_bool y27900000280config NR_CPUS281 int "Maximum number of CPUs (2-256)"282 range 2 256
···1-/*2- * x86 version of "atomic_dec_and_lock()" using3- * the atomic "cmpxchg" instruction.4- *5- * (For CPU's lacking cmpxchg, we use the slow6- * generic version, and this one never even gets7- * compiled).8- */9-10-#include <linux/spinlock.h>11-#include <asm/atomic.h>12-13-int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)14-{15- int counter;16- int newcount;17-18-repeat:19- counter = atomic_read(atomic);20- newcount = counter-1;21-22- if (!newcount)23- goto slow_path;24-25- asm volatile("lock; cmpxchgl %1,%2"26- :"=a" (newcount)27- :"r" (newcount), "m" (atomic->counter), "0" (counter));28-29- /* If the above failed, "eax" will have changed */30- if (newcount != counter)31- goto repeat;32- return 0;33-34-slow_path:35- spin_lock(lock);36- if (atomic_dec_and_test(atomic))37- return 1;38- spin_unlock(lock);39- return 0;40-}
···1#include <linux/module.h>2#include <linux/spinlock.h>3#include <asm/atomic.h>040000000000000000000000000000000005/*6 * This is an architecture-neutral, but slow,7 * implementation of the notion of "decrement···67 spin_unlock(lock);68 return 0;69}07071EXPORT_SYMBOL(_atomic_dec_and_lock);
···1#include <linux/module.h>2#include <linux/spinlock.h>3#include <asm/atomic.h>4+#include <asm/system.h>56+#ifdef __HAVE_ARCH_CMPXCHG7+/*8+ * This is an implementation of the notion of "decrement a9+ * reference count, and return locked if it decremented to zero".10+ *11+ * This implementation can be used on any architecture that12+ * has a cmpxchg, and where atomic->value is an int holding13+ * the value of the atomic (i.e. the high bits aren't used14+ * for a lock or anything like that).15+ */16+int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)17+{18+ int counter;19+ int newcount;20+21+ for (;;) {22+ counter = atomic_read(atomic);23+ newcount = counter - 1;24+ if (!newcount)25+ break; /* do it the slow way */26+27+ newcount = cmpxchg(&atomic->counter, counter, newcount);28+ if (newcount == counter)29+ return 0;30+ }31+32+ spin_lock(lock);33+ if (atomic_dec_and_test(atomic))34+ return 1;35+ spin_unlock(lock);36+ return 0;37+}38+#else39/*40 * This is an architecture-neutral, but slow,41 * implementation of the notion of "decrement···33 spin_unlock(lock);34 return 0;35}36+#endif3738EXPORT_SYMBOL(_atomic_dec_and_lock);