···908908 The default yes will allow the kernel to do irq load balancing.909909 Saying no will keep the kernel from doing irq load balancing.910910911911-config HAVE_DEC_LOCK912912- bool913913- depends on (SMP || PREEMPT) && X86_CMPXCHG914914- default y915915-916911# turning this on wastes a bunch of space.917912# Summit needs it only when NUMA is on918913config BOOT_IOREMAP
···11-/*22- * x86 version of "atomic_dec_and_lock()" using33- * the atomic "cmpxchg" instruction.44- *55- * (For CPU's lacking cmpxchg, we use the slow66- * generic version, and this one never even gets77- * compiled).88- */99-1010-#include <linux/spinlock.h>1111-#include <linux/module.h>1212-#include <asm/atomic.h>1313-1414-int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)1515-{1616- int counter;1717- int newcount;1818-1919-repeat:2020- counter = atomic_read(atomic);2121- newcount = counter-1;2222-2323- if (!newcount)2424- goto slow_path;2525-2626- asm volatile("lock; cmpxchgl %1,%2"2727- :"=a" (newcount)2828- :"r" (newcount), "m" (atomic->counter), "0" (counter));2929-3030- /* If the above failed, "eax" will have changed */3131- if (newcount != counter)3232- goto repeat;3333- return 0;3434-3535-slow_path:3636- spin_lock(lock);3737- if (atomic_dec_and_test(atomic))3838- return 1;3939- spin_unlock(lock);4040- return 0;4141-}4242-EXPORT_SYMBOL(_atomic_dec_and_lock);
-5
arch/ia64/Kconfig
···298298299299source "mm/Kconfig"300300301301-config HAVE_DEC_LOCK302302- bool303303- depends on (SMP || PREEMPT)304304- default y305305-306301config IA32_SUPPORT307302 bool "Support for Linux/x86 binaries"308303 help
···11-/*22- * Copyright (C) 2003 Jerome Marchand, Bull S.A.33- * Cleaned up by David Mosberger-Tang <davidm@hpl.hp.com>44- *55- * This file is released under the GPLv2, or at your option any later version.66- *77- * ia64 version of "atomic_dec_and_lock()" using the atomic "cmpxchg" instruction. This88- * code is an adaptation of the x86 version of "atomic_dec_and_lock()".99- */1010-1111-#include <linux/compiler.h>1212-#include <linux/module.h>1313-#include <linux/spinlock.h>1414-#include <asm/atomic.h>1515-1616-/*1717- * Decrement REFCOUNT and if the count reaches zero, acquire the spinlock. Both of these1818- * operations have to be done atomically, so that the count doesn't drop to zero without1919- * acquiring the spinlock first.2020- */2121-int2222-_atomic_dec_and_lock (atomic_t *refcount, spinlock_t *lock)2323-{2424- int old, new;2525-2626- do {2727- old = atomic_read(refcount);2828- new = old - 1;2929-3030- if (unlikely (old == 1)) {3131- /* oops, we may be decrementing to zero, do it the slow way... */3232- spin_lock(lock);3333- if (atomic_dec_and_test(refcount))3434- return 1;3535- spin_unlock(lock);3636- return 0;3737- }3838- } while (cmpxchg(&refcount->counter, old, new) != old);3939- return 0;4040-}4141-4242-EXPORT_SYMBOL(_atomic_dec_and_lock);
-5
arch/m32r/Kconfig
···220220 Say Y here if you are building a kernel for a desktop, embedded221221 or real-time system. Say N if you are unsure.222222223223-config HAVE_DEC_LOCK224224- bool225225- depends on (SMP || PREEMPT)226226- default n227227-228223config SMP229224 bool "Symmetric multi-processing support"230225 ---help---
···11-/*22- * MIPS version of atomic_dec_and_lock() using cmpxchg33- *44- * This program is free software; you can redistribute it and/or55- * modify it under the terms of the GNU General Public License66- * as published by the Free Software Foundation; either version77- * 2 of the License, or (at your option) any later version.88- */99-1010-#include <linux/module.h>1111-#include <linux/spinlock.h>1212-#include <asm/atomic.h>1313-#include <asm/system.h>1414-1515-/*1616- * This is an implementation of the notion of "decrement a1717- * reference count, and return locked if it decremented to zero".1818- *1919- * This implementation can be used on any architecture that2020- * has a cmpxchg, and where atomic->value is an int holding2121- * the value of the atomic (i.e. the high bits aren't used2222- * for a lock or anything like that).2323- */2424-int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)2525-{2626- int counter;2727- int newcount;2828-2929- for (;;) {3030- counter = atomic_read(atomic);3131- newcount = counter - 1;3232- if (!newcount)3333- break; /* do it the slow way */3434-3535- newcount = cmpxchg(&atomic->counter, counter, newcount);3636- if (newcount == counter)3737- return 0;3838- }3939-4040- spin_lock(lock);4141- if (atomic_dec_and_test(atomic))4242- return 1;4343- spin_unlock(lock);4444- return 0;4545-}4646-4747-EXPORT_SYMBOL(_atomic_dec_and_lock);
···11-#include <linux/module.h>22-#include <linux/spinlock.h>33-#include <asm/atomic.h>44-#include <asm/system.h>55-66-/*77- * This is an implementation of the notion of "decrement a88- * reference count, and return locked if it decremented to zero".99- *1010- * This implementation can be used on any architecture that1111- * has a cmpxchg, and where atomic->value is an int holding1212- * the value of the atomic (i.e. the high bits aren't used1313- * for a lock or anything like that).1414- */1515-int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)1616-{1717- int counter;1818- int newcount;1919-2020- for (;;) {2121- counter = atomic_read(atomic);2222- newcount = counter - 1;2323- if (!newcount)2424- break; /* do it the slow way */2525-2626- newcount = cmpxchg(&atomic->counter, counter, newcount);2727- if (newcount == counter)2828- return 0;2929- }3030-3131- spin_lock(lock);3232- if (atomic_dec_and_test(atomic))3333- return 1;3434- spin_unlock(lock);3535- return 0;3636-}3737-3838-EXPORT_SYMBOL(_atomic_dec_and_lock);
···22# Makefile for ppc64-specific library files..33#4455-lib-y := checksum.o dec_and_lock.o string.o strcase.o55+lib-y := checksum.o string.o strcase.o66lib-y += copypage.o memcpy.o copyuser.o usercopy.o7788# Lock primitives are defined as no-ops in include/linux/spinlock.h
-47
arch/ppc64/lib/dec_and_lock.c
···11-/*22- * ppc64 version of atomic_dec_and_lock() using cmpxchg33- *44- * This program is free software; you can redistribute it and/or55- * modify it under the terms of the GNU General Public License66- * as published by the Free Software Foundation; either version77- * 2 of the License, or (at your option) any later version.88- */99-1010-#include <linux/module.h>1111-#include <linux/spinlock.h>1212-#include <asm/atomic.h>1313-#include <asm/system.h>1414-1515-/*1616- * This is an implementation of the notion of "decrement a1717- * reference count, and return locked if it decremented to zero".1818- *1919- * This implementation can be used on any architecture that2020- * has a cmpxchg, and where atomic->value is an int holding2121- * the value of the atomic (i.e. the high bits aren't used2222- * for a lock or anything like that).2323- */2424-int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)2525-{2626- int counter;2727- int newcount;2828-2929- for (;;) {3030- counter = atomic_read(atomic);3131- newcount = counter - 1;3232- if (!newcount)3333- break; /* do it the slow way */3434-3535- newcount = cmpxchg(&atomic->counter, counter, newcount);3636- if (newcount == counter)3737- return 0;3838- }3939-4040- spin_lock(lock);4141- if (atomic_dec_and_test(atomic))4242- return 1;4343- spin_unlock(lock);4444- return 0;4545-}4646-4747-EXPORT_SYMBOL(_atomic_dec_and_lock);
-8
arch/sparc64/Kconfig.debug
···3333 depends on DEBUG_KERNEL3434 bool "Debug BOOTMEM initialization"35353636-# We have a custom atomic_dec_and_lock() implementation but it's not3737-# compatible with spinlock debugging so we need to fall back on3838-# the generic version in that case.3939-config HAVE_DEC_LOCK4040- bool4141- depends on SMP && !DEBUG_SPINLOCK4242- default y4343-4436config MCOUNT4537 bool4638 depends on STACK_DEBUG
-3
arch/sparc64/kernel/sparc64_ksyms.c
···163163EXPORT_SYMBOL(atomic64_add_ret);164164EXPORT_SYMBOL(atomic64_sub);165165EXPORT_SYMBOL(atomic64_sub_ret);166166-#ifdef CONFIG_SMP167167-EXPORT_SYMBOL(_atomic_dec_and_lock);168168-#endif169166170167/* Atomic bit operations. */171168EXPORT_SYMBOL(test_and_set_bit);
···277277config HAVE_ARCH_EARLY_PFN_TO_NID278278 def_bool y279279280280-config HAVE_DEC_LOCK281281- bool282282- depends on SMP283283- default y284284-285280config NR_CPUS286281 int "Maximum number of CPUs (2-256)"287282 range 2 256
···11-/*22- * x86 version of "atomic_dec_and_lock()" using33- * the atomic "cmpxchg" instruction.44- *55- * (For CPU's lacking cmpxchg, we use the slow66- * generic version, and this one never even gets77- * compiled).88- */99-1010-#include <linux/spinlock.h>1111-#include <asm/atomic.h>1212-1313-int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)1414-{1515- int counter;1616- int newcount;1717-1818-repeat:1919- counter = atomic_read(atomic);2020- newcount = counter-1;2121-2222- if (!newcount)2323- goto slow_path;2424-2525- asm volatile("lock; cmpxchgl %1,%2"2626- :"=a" (newcount)2727- :"r" (newcount), "m" (atomic->counter), "0" (counter));2828-2929- /* If the above failed, "eax" will have changed */3030- if (newcount != counter)3131- goto repeat;3232- return 0;3333-3434-slow_path:3535- spin_lock(lock);3636- if (atomic_dec_and_test(atomic))3737- return 1;3838- spin_unlock(lock);3939- return 0;4040-}
···11#include <linux/module.h>22#include <linux/spinlock.h>33#include <asm/atomic.h>44+#include <asm/system.h>4566+#ifdef __HAVE_ARCH_CMPXCHG77+/*88+ * This is an implementation of the notion of "decrement a99+ * reference count, and return locked if it decremented to zero".1010+ *1111+ * This implementation can be used on any architecture that1212+ * has a cmpxchg, and where atomic->value is an int holding1313+ * the value of the atomic (i.e. the high bits aren't used1414+ * for a lock or anything like that).1515+ */1616+int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)1717+{1818+ int counter;1919+ int newcount;2020+2121+ for (;;) {2222+ counter = atomic_read(atomic);2323+ newcount = counter - 1;2424+ if (!newcount)2525+ break; /* do it the slow way */2626+2727+ newcount = cmpxchg(&atomic->counter, counter, newcount);2828+ if (newcount == counter)2929+ return 0;3030+ }3131+3232+ spin_lock(lock);3333+ if (atomic_dec_and_test(atomic))3434+ return 1;3535+ spin_unlock(lock);3636+ return 0;3737+}3838+#else539/*640 * This is an architecture-neutral, but slow,741 * implementation of the notion of "decrement···6733 spin_unlock(lock);6834 return 0;6935}3636+#endif70377138EXPORT_SYMBOL(_atomic_dec_and_lock);