Skip to contentSkip to conversation

semaphore rewrite

PATCH New Matthew Wilcox 7 participants 30 messages Feb 27, 2008 – Mar 3, 2008

Subsystems (72)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 semaphore rewrite

Here's a series of twelve patches to introduce down_killable(). I expect the first ten to be uncontroversial, and easy to apply. The last two ... I'm still testing. More testers would be welcome, particularly people who have performance test-suites they wouldn't want to see regress.

The way I go about introducing down_killable is to replace all the carefully hand-tuned assembler with a generic C implementation. One of the annoying things about this is that the header file is in asm/semaphore.h instead of linux/semaphore.h. I tackle this by removing all the obsolete inclusions of asm/semaphore.h (around 100 of them). In order for that to work, I actually need to add a couple in places where they were being implicitly included.

Then I replace the per-arch implementations with a generic one. All the <asm/semaphore.h> files become a one-line include of linux/sempahore.h.

Then all remaining users in the tree are converted to use linux/semaphore.h.

I add 'removal of asm/semaphore.h' to features-removal to not inflict extra pain on Andrew during this process.

So, to recap:

Patches 1 - 2: Add missing includes
Patches 3 - 10: Remove obsolete includes (split up by top-level directory)
Patch 11: Generic semaphore implementation
Patch 12: Switch remaining users to linux/semaphore.h

I hope this split causes the least amount of pain.

Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
#1 lore raw

PATCH 1/12 Fix quota.h includes

quota.h currently relies on asm/semaphore.h (through some chain; it doesn't actually include semaphore.h itself) to include wait.h. As well as being bad practice to rely on an implicit include, subsequent patches will break this. While I'm in this file, add atomic.h and list.h, and sort the list of includes.

---
 include/linux/quota.h |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
include/linux/quota.h +6 -2
index 6e0393a..eb560d0 100644
@@ -160,14 +160,18 @@ enum {
 
 
 #ifdef __KERNEL__
-#include <linux/spinlock.h>
-#include <linux/rwsem.h>
+#include <linux/list.h>
 #include <linux/mutex.h>
+#include <linux/rwsem.h>
+#include <linux/spinlock.h>
+#include <linux/wait.h>
 
 #include <linux/dqblk_xfs.h>
 #include <linux/dqblk_v1.h>
 #include <linux/dqblk_v2.h>
 
+#include <asm/atomic.h>
+
 extern spinlock_t dq_data_lock;
 
 /* Maximal numbers of writes for quota operation (insert/delete/update)
Signature · 1 line
1.5.4.1
#2 lore raw

PATCH 2/12 Add semaphore.h to kernel_lock.c

kernel_lock.c uses DECLARE_MUTEX, up() and down() without explicitly including asm/semaphore.h. This is fragile and leaves it vulnerable to breakage during header reorganisations.

---
 lib/kernel_lock.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
lib/kernel_lock.c +1 -0
index 812dbf0..fbc11a3 100644
@@ -8,6 +8,7 @@
 #include <linux/smp_lock.h>
 #include <linux/module.h>
 #include <linux/kallsyms.h>
+#include <asm/semaphore.h>
 
 /*
  * The 'big kernel semaphore'
Signature · 1 line
1.5.4.1
#3 lore raw

PATCH 3/12 arch: Remove unnecessary inclusions of asm/semaphore.h

None of these files use any of the functionality promised by asm/semaphore.h. It's possible that they rely on it dragging in some unrelated header file, but I can't build all these files, so we'll have fix any build failures as they come up.

---
 arch/arm/common/rtctime.c                    |    1 -
 arch/arm/mach-aaec2000/clock.c               |    2 --
 arch/arm/mach-at91/clock.c                   |    1 -
 arch/arm/mach-integrator/clock.c             |    1 -
 arch/arm/mach-pnx4008/clock.c                |    1 -
 arch/arm/mach-pnx4008/gpio.c                 |    1 -
 arch/arm/mach-realview/clock.c               |    1 -
 arch/arm/mach-versatile/clock.c              |    1 -
 arch/arm/plat-omap/clock.c                   |    1 -
 arch/ia64/sn/kernel/sn2/sn_hwperf.c          |    1 -
 arch/m68k/atari/stram.c                      |    1 -
 arch/m68k/sun3/intersil.c                    |    1 -
 arch/mips/sgi-ip27/ip27-console.c            |    1 -
 arch/parisc/kernel/sys_parisc32.c            |    1 -
 arch/powerpc/kernel/rtas.c                   |    1 -
 arch/powerpc/kernel/sys_ppc32.c              |    1 -
 arch/powerpc/kernel/syscalls.c               |    1 -
 arch/powerpc/platforms/cell/spufs/file.c     |    1 -
 arch/powerpc/platforms/cell/spufs/inode.c    |    1 -
 arch/powerpc/platforms/powermac/pfunc_core.c |    1 -
 arch/ppc/syslib/ocp.c                        |    1 -
 arch/s390/kernel/compat_linux.c              |    1 -
 arch/s390/kernel/debug.c                     |    1 -
 arch/sparc64/kernel/sys_sparc32.c            |    1 -
 arch/v850/kernel/syscalls.c                  |    1 -
 arch/x86/ia32/sys_ia32.c                     |    1 -
 arch/x86/kernel/cpu/common.c                 |    1 -
 arch/x86/kernel/cpu/proc.c                   |    1 -
 28 files changed, 0 insertions(+), 29 deletions(-)
arch/arm/common/rtctime.c +0 -1
index f53bca4..aa8f773 100644
@@ -22,7 +22,6 @@
 #include <linux/mutex.h>
 
 #include <asm/rtc.h>
-#include <asm/semaphore.h>
 
 static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);
 static struct fasync_struct *rtc_async_queue;
arch/arm/mach-aaec2000/clock.c +0 -2
index 74aa7a3..e10ee15 100644
@@ -18,8 +18,6 @@
 #include <linux/clk.h>
 #include <linux/mutex.h>
 
-#include <asm/semaphore.h>
-
 #include "clock.h"
 
 static LIST_HEAD(clocks);
arch/arm/mach-at91/clock.c +0 -1
index de6424e..a33dfe4 100644
@@ -23,7 +23,6 @@
 #include <linux/delay.h>
 #include <linux/clk.h>
 
-#include <asm/semaphore.h>
 #include <asm/io.h>
 #include <asm/mach-types.h>
 
arch/arm/mach-integrator/clock.c +0 -1
index 95a1e26..8d761fd 100644
@@ -17,7 +17,6 @@
 #include <linux/clk.h>
 #include <linux/mutex.h>
 
-#include <asm/semaphore.h>
 #include <asm/hardware/icst525.h>
 
 #include "clock.h"
arch/arm/mach-pnx4008/clock.c +0 -1
index daa8d3d..6cfffd2 100644
@@ -21,7 +21,6 @@
 #include <linux/err.h>
 #include <linux/delay.h>
 
-#include <asm/semaphore.h>
 #include <asm/hardware.h>
 #include <asm/io.h>
 
arch/arm/mach-pnx4008/gpio.c +0 -1
index 1ab84ce..ef179ca 100644
@@ -17,7 +17,6 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <asm/semaphore.h>
 #include <asm/io.h>
 #include <asm/arch/platform.h>
 #include <asm/arch/gpio.h>
arch/arm/mach-realview/clock.c +0 -1
index 21325a4..3e706c5 100644
@@ -16,7 +16,6 @@
 #include <linux/clk.h>
 #include <linux/mutex.h>
 
-#include <asm/semaphore.h>
 #include <asm/hardware/icst307.h>
 
 #include "clock.h"
arch/arm/mach-versatile/clock.c +0 -1
index 9858c96..9336508 100644
@@ -17,7 +17,6 @@
 #include <linux/clk.h>
 #include <linux/mutex.h>
 
-#include <asm/semaphore.h>
 #include <asm/hardware/icst307.h>
 
 #include "clock.h"
arch/arm/plat-omap/clock.c +0 -1
index 0a60324..203ac50 100644
@@ -23,7 +23,6 @@
 #include <linux/platform_device.h>
 
 #include <asm/io.h>
-#include <asm/semaphore.h>
 
 #include <asm/arch/clock.h>
 
arch/ia64/sn/kernel/sn2/sn_hwperf.c +0 -1
index 4b0d153..8cc0c47 100644
@@ -37,7 +37,6 @@
 
 #include <asm/processor.h>
 #include <asm/topology.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 #include <asm/sal.h>
 #include <asm/sn/io.h>
arch/m68k/atari/stram.c +0 -1
index 0055a6c..04c69ff 100644
@@ -29,7 +29,6 @@
 #include <asm/atarihw.h>
 #include <asm/atari_stram.h>
 #include <asm/io.h>
-#include <asm/semaphore.h>
 
 #undef DEBUG
 
arch/m68k/sun3/intersil.c +0 -1
index db359d7..0116d20 100644
@@ -15,7 +15,6 @@
 
 #include <asm/errno.h>
 #include <asm/system.h>
-#include <asm/semaphore.h>
 #include <asm/rtc.h>
 #include <asm/intersil.h>
 
arch/mips/sgi-ip27/ip27-console.c +0 -1
index 3ba8306..984e561 100644
@@ -8,7 +8,6 @@
 #include <linux/init.h>
 
 #include <asm/page.h>
-#include <asm/semaphore.h>
 #include <asm/sn/addrs.h>
 #include <asm/sn/sn0/hub.h>
 #include <asm/sn/klconfig.h>
arch/parisc/kernel/sys_parisc32.c +0 -1
index 50bbf33..71efd6a 100644
@@ -49,7 +49,6 @@
 
 #include <asm/types.h>
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 #include <asm/mmu_context.h>
 
 #include "sys32.h"
arch/powerpc/kernel/rtas.c +0 -1
index 52e95c2..fe8d951 100644
@@ -26,7 +26,6 @@
 #include <asm/prom.h>
 #include <asm/rtas.h>
 #include <asm/hvcall.h>
-#include <asm/semaphore.h>
 #include <asm/machdep.h>
 #include <asm/firmware.h>
 #include <asm/page.h>
arch/powerpc/kernel/sys_ppc32.c +0 -1
index 4a4f5c6..fee9ee2 100644
@@ -47,7 +47,6 @@
 #include <asm/types.h>
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
-#include <asm/semaphore.h>
 #include <asm/time.h>
 #include <asm/mmu_context.h>
 #include <asm/ppc-pci.h>
arch/powerpc/kernel/syscalls.c +0 -1
index 3b1d5dd..e722a4e 100644
@@ -38,7 +38,6 @@
 #include <linux/personality.h>
 
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 #include <asm/syscalls.h>
 #include <asm/time.h>
 #include <asm/unistd.h>
arch/powerpc/platforms/cell/spufs/file.c +0 -1
index c66c375..bcb8af8 100644
@@ -32,7 +32,6 @@
 #include <linux/marker.h>
 
 #include <asm/io.h>
-#include <asm/semaphore.h>
 #include <asm/spu.h>
 #include <asm/spu_info.h>
 #include <asm/uaccess.h>
arch/powerpc/platforms/cell/spufs/inode.c +0 -1
index 6d1228c..0c32a05 100644
@@ -35,7 +35,6 @@
 #include <linux/parser.h>
 
 #include <asm/prom.h>
-#include <asm/semaphore.h>
 #include <asm/spu.h>
 #include <asm/spu_priv1.h>
 #include <asm/uaccess.h>
arch/powerpc/platforms/powermac/pfunc_core.c +0 -1
index 8543423..96d5ce5 100644
@@ -12,7 +12,6 @@
 #include <linux/module.h>
 #include <linux/mutex.h>
 
-#include <asm/semaphore.h>
 #include <asm/prom.h>
 #include <asm/pmac_pfunc.h>
 
arch/ppc/syslib/ocp.c +0 -1
index ac80370..a6fb7dc 100644
@@ -49,7 +49,6 @@
 #include <asm/io.h>
 #include <asm/ocp.h>
 #include <asm/errno.h>
-#include <asm/semaphore.h>
 
 //#define DBG(x)	printk x
 #define DBG(x)
arch/s390/kernel/compat_linux.c +0 -1
index 50b85d0..d7f2222 100644
@@ -62,7 +62,6 @@
 
 #include <asm/types.h>
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 
 #include <net/scm.h>
 #include <net/sock.h>
arch/s390/kernel/debug.c +0 -1
index 1b2f5ce..79653a7 100644
@@ -17,7 +17,6 @@
 #include <linux/ctype.h>
 #include <linux/sysctl.h>
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/fs.h>
arch/sparc64/kernel/sys_sparc32.c +0 -1
index deaba2b..de3be1e 100644
@@ -55,7 +55,6 @@
 #include <asm/types.h>
 #include <asm/uaccess.h>
 #include <asm/fpumacro.h>
-#include <asm/semaphore.h>
 #include <asm/mmu_context.h>
 #include <asm/compat_signal.h>
 
arch/v850/kernel/syscalls.c +0 -1
index 0a4df4d..003db9c 100644
@@ -30,7 +30,6 @@
 #include <linux/file.h>
 
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 #include <asm/unistd.h>
 
 /*
arch/x86/ia32/sys_ia32.c +0 -1
index abf71d2..211eed3 100644
@@ -64,7 +64,6 @@
 #include <asm/mman.h>
 #include <asm/types.h>
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 #include <asm/atomic.h>
 #include <asm/ldt.h>
 
arch/x86/kernel/cpu/common.c +0 -1
index a38aafa..2ffab32 100644
@@ -5,7 +5,6 @@
 #include <linux/module.h>
 #include <linux/percpu.h>
 #include <linux/bootmem.h>
-#include <asm/semaphore.h>
 #include <asm/processor.h>
 #include <asm/i387.h>
 #include <asm/msr.h>
arch/x86/kernel/cpu/proc.c +0 -1
index af11d31..149dbce 100644
@@ -1,7 +1,6 @@
 #include <linux/smp.h>
 #include <linux/timex.h>
 #include <linux/string.h>
-#include <asm/semaphore.h>
 #include <linux/seq_file.h>
 #include <linux/cpufreq.h>
 
Signature · 1 line
1.5.4.1
#4 lore raw

PATCH 4/12 net: Remove unnecessary inclusions of asm/semaphore.h

None of these files use any of the functionality promised by asm/semaphore.h. It's possible that they rely on it dragging in some unrelated header file, but I can't build all these files, so we'll have fix any build failures as they come up.

---
 drivers/net/cxgb3/adapter.h                    |    1 -
 drivers/net/cxgb3/t3cdev.h                     |    1 -
 drivers/net/ibmveth.c                          |    1 -
 drivers/net/netxen/netxen_nic_hdr.h            |    1 -
 drivers/net/usb/kaweth.c                       |    1 -
 drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h |    1 -
 net/core/flow.c                                |    1 -
 net/dccp/proto.c                               |    1 -
 net/ipv4/ipcomp.c                              |    1 -
 net/ipv6/ipcomp6.c                             |    1 -
 10 files changed, 0 insertions(+), 10 deletions(-)
drivers/net/cxgb3/adapter.h +0 -1
index eb305a0..4fdb13f 100644
@@ -43,7 +43,6 @@
 #include <linux/mutex.h>
 #include <linux/bitops.h>
 #include "t3cdev.h"
-#include <asm/semaphore.h>
 #include <asm/io.h>
 
 struct vlan_group;
drivers/net/cxgb3/t3cdev.h +0 -1
index 77fcc1a..a18c8a1 100644
@@ -34,7 +34,6 @@
 
 #include <linux/list.h>
 #include <asm/atomic.h>
-#include <asm/semaphore.h>
 #include <linux/netdevice.h>
 #include <linux/proc_fs.h>
 #include <linux/skbuff.h>
drivers/net/ibmveth.c +0 -1
index 57772be..e2d7b66 100644
@@ -49,7 +49,6 @@
 #include <linux/in.h>
 #include <linux/ip.h>
 #include <net/net_namespace.h>
-#include <asm/semaphore.h>
 #include <asm/hvcall.h>
 #include <asm/atomic.h>
 #include <asm/vio.h>
drivers/net/netxen/netxen_nic_hdr.h +0 -1
index d72f8f8..5bc3cbf 100644
@@ -34,7 +34,6 @@
 #include <linux/kernel.h>
 #include <linux/version.h>
 
-#include <asm/semaphore.h>
 #include <linux/spinlock.h>
 #include <asm/irq.h>
 #include <linux/init.h>
drivers/net/usb/kaweth.c +0 -1
index 569ad8b..0dcfc03 100644
@@ -58,7 +58,6 @@
 #include <linux/dma-mapping.h>
 #include <linux/wait.h>
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 #include <asm/byteorder.h>
 
 #undef DEBUG
drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h +0 -1
index a40d1af..b46f43d 100644
@@ -7,7 +7,6 @@ struct bcm43xx_xmitstatus;
 #ifdef CONFIG_BCM43XX_DEBUG
 
 #include <linux/list.h>
-#include <asm/semaphore.h>
 
 struct dentry;
 
net/core/flow.c +0 -1
index a77531c..1999117 100644
@@ -23,7 +23,6 @@
 #include <linux/mutex.h>
 #include <net/flow.h>
 #include <asm/atomic.h>
-#include <asm/semaphore.h>
 #include <linux/security.h>
 
 struct flow_cache_entry {
net/dccp/proto.c +0 -1
index e3f5d37..c12af3d 100644
@@ -27,7 +27,6 @@
 #include <net/xfrm.h>
 
 #include <asm/ioctls.h>
-#include <asm/semaphore.h>
 #include <linux/spinlock.h>
 #include <linux/timer.h>
 #include <linux/delay.h>
net/ipv4/ipcomp.c +0 -1
index ae1f45f..fc9de7c 100644
@@ -14,7 +14,6 @@
  *   - Adaptive compression.
  */
 #include <linux/module.h>
-#include <asm/semaphore.h>
 #include <linux/crypto.h>
 #include <linux/err.h>
 #include <linux/pfkeyv2.h>
net/ipv6/ipcomp6.c +0 -1
index b900395..eebc218 100644
@@ -34,7 +34,6 @@
 #include <net/ip.h>
 #include <net/xfrm.h>
 #include <net/ipcomp.h>
-#include <asm/semaphore.h>
 #include <linux/crypto.h>
 #include <linux/err.h>
 #include <linux/pfkeyv2.h>
Signature · 1 line
1.5.4.1
#5 lore raw

PATCH 5/12 drivers: Remove unnecessary inclusions of asm/semaphore.h

None of these files use any of the functionality promised by asm/semaphore.h. It's possible that they rely on it dragging in some unrelated header file, but I can't build all these files, so we'll have fix any build failures as they come up.

---
 drivers/ata/libata-core.c                     |    1 -
 drivers/block/cryptoloop.c                    |    1 -
 drivers/char/generic_serial.c                 |    1 -
 drivers/char/rio/rioboot.c                    |    1 -
 drivers/char/rio/riocmd.c                     |    1 -
 drivers/char/rio/rioctrl.c                    |    1 -
 drivers/char/rio/rioinit.c                    |    1 -
 drivers/char/rio/riointr.c                    |    1 -
 drivers/char/rio/rioparam.c                   |    1 -
 drivers/char/rio/rioroute.c                   |    1 -
 drivers/char/rio/riotable.c                   |    1 -
 drivers/char/rio/riotty.c                     |    1 -
 drivers/firewire/fw-transaction.c             |    1 -
 drivers/firmware/dcdbas.c                     |    1 -
 drivers/infiniband/hw/amso1100/c2.h           |    1 -
 drivers/infiniband/hw/nes/nes.h               |    1 -
 drivers/lguest/lg.h                           |    1 -
 drivers/media/radio/radio-aimslab.c           |    1 -
 drivers/media/video/ir-kbd-i2c.c              |    1 -
 drivers/media/video/ov511.c                   |    1 -
 drivers/media/video/pvrusb2/pvrusb2-context.c |    1 -
 drivers/media/video/pvrusb2/pvrusb2-hdw.c     |    1 -
 drivers/media/video/pvrusb2/pvrusb2-sysfs.c   |    1 -
 drivers/mfd/ucb1x00-ts.c                      |    1 -
 drivers/s390/cio/ccwgroup.c                   |    1 -
 drivers/s390/net/qeth_main.c                  |    1 -
 drivers/scsi/aacraid/aachba.c                 |    1 -
 drivers/scsi/aacraid/comminit.c               |    1 -
 drivers/scsi/aacraid/linit.c                  |    1 -
 drivers/scsi/aacraid/rx.c                     |    1 -
 drivers/scsi/aacraid/sa.c                     |    1 -
 drivers/scsi/dpt/dpti_i2o.h                   |    1 -
 drivers/scsi/megaraid/mega_common.h           |    1 -
 drivers/serial/mcfserial.c                    |    1 -
 drivers/usb/atm/usbatm.h                      |    1 -
 drivers/usb/core/hub.c                        |    1 -
 drivers/usb/misc/appledisplay.c               |    1 -
 drivers/usb/serial/io_ti.c                    |    1 -
 drivers/usb/serial/ti_usb_3410_5052.c         |    1 -
 39 files changed, 0 insertions(+), 39 deletions(-)
drivers/ata/libata-core.c +0 -1
index 4fbcce7..b665674 100644
@@ -62,7 +62,6 @@
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_host.h>
 #include <linux/libata.h>
-#include <asm/semaphore.h>
 #include <asm/byteorder.h>
 #include <linux/cdrom.h>
 
drivers/block/cryptoloop.c +0 -1
index 2411678..8b6bb76 100644
@@ -27,7 +27,6 @@
 #include <linux/blkdev.h>
 #include <linux/loop.h>
 #include <linux/scatterlist.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 MODULE_LICENSE("GPL");
drivers/char/generic_serial.c +0 -1
index 8facf3e..7ed7da1 100644
@@ -28,7 +28,6 @@
 #include <linux/interrupt.h>
 #include <linux/tty_flip.h>
 #include <linux/delay.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 #define DEBUG 
drivers/char/rio/rioboot.c +0 -1
index eca2b95..d956dd3 100644
@@ -35,7 +35,6 @@
 #include <linux/termios.h>
 #include <linux/serial.h>
 #include <linux/vmalloc.h>
-#include <asm/semaphore.h>
 #include <linux/generic_serial.h>
 #include <linux/errno.h>
 #include <linux/interrupt.h>
drivers/char/rio/riocmd.c +0 -1
index 7321d00..bf36959 100644
@@ -41,7 +41,6 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c	1.2";
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/string.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 #include <linux/termios.h>
drivers/char/rio/rioctrl.c +0 -1
index 7ce7761..d8eb2bc 100644
@@ -40,7 +40,6 @@ static char *_rioctrl_c_sccs_ = "@(#)rioctrl.c	1.3";
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/string.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 #include <linux/termios.h>
drivers/char/rio/rioinit.c +0 -1
index 0794844..add1718 100644
@@ -40,7 +40,6 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c	1.3";
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/string.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 #include <linux/termios.h>
drivers/char/rio/riointr.c +0 -1
index ebc7634..4734e26 100644
@@ -42,7 +42,6 @@ static char *_riointr_c_sccs_ = "@(#)riointr.c	1.2";
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/string.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 #include <linux/termios.h>
drivers/char/rio/rioparam.c +0 -1
index bb498d2..da276ed 100644
@@ -41,7 +41,6 @@ static char *_rioparam_c_sccs_ = "@(#)rioparam.c	1.3";
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/string.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 #include <linux/termios.h>
drivers/char/rio/rioroute.c +0 -1
index a99f3d9..85091ff 100644
@@ -39,7 +39,6 @@ static char *_rioroute_c_sccs_ = "@(#)rioroute.c	1.3";
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/string.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 #include <linux/termios.h>
drivers/char/rio/riotable.c +0 -1
index 991119c..dfce405 100644
@@ -42,7 +42,6 @@ static char *_riotable_c_sccs_ = "@(#)riotable.c	1.2";
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/string.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 #include <linux/termios.h>
drivers/char/rio/riotty.c +0 -1
index a4f0b1e..5f053e1 100644
@@ -44,7 +44,6 @@ static char *_riotty_c_sccs_ = "@(#)riotty.c	1.3";
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/string.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 #include <linux/termios.h>
drivers/firewire/fw-transaction.c +0 -1
index 7fcc59d..1fe3d45 100644
@@ -28,7 +28,6 @@
 #include <linux/list.h>
 #include <linux/kthread.h>
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 
 #include "fw-transaction.h"
 #include "fw-topology.h"
drivers/firmware/dcdbas.c +0 -1
index 1636806..d8822ee 100644
@@ -35,7 +35,6 @@
 #include <linux/types.h>
 #include <linux/mutex.h>
 #include <asm/io.h>
-#include <asm/semaphore.h>
 
 #include "dcdbas.h"
 
drivers/infiniband/hw/amso1100/c2.h +0 -1
index fa58200..dd5c889 100644
@@ -40,7 +40,6 @@
 #include <linux/pci.h>
 #include <linux/dma-mapping.h>
 #include <linux/idr.h>
-#include <asm/semaphore.h>
 
 #include "c2_provider.h"
 #include "c2_mq.h"
drivers/infiniband/hw/nes/nes.h +0 -1
index fd57e8a..0b10474 100644
@@ -43,7 +43,6 @@
 #include <linux/dma-mapping.h>
 #include <linux/workqueue.h>
 #include <linux/slab.h>
-#include <asm/semaphore.h>
 #include <linux/version.h>
 #include <asm/io.h>
 #include <linux/crc32c.h>
drivers/lguest/lg.h +0 -1
index 2337e1a..005bd04 100644
@@ -10,7 +10,6 @@
 #include <linux/wait.h>
 #include <linux/hrtimer.h>
 #include <linux/err.h>
-#include <asm/semaphore.h>
 
 #include <asm/lguest.h>
 
drivers/media/radio/radio-aimslab.c +0 -1
index f0a67e9..c69bde3 100644
@@ -36,7 +36,6 @@
 #include <asm/uaccess.h>	/* copy to/from user		*/
 #include <linux/videodev2.h>	/* kernel radio structs		*/
 #include <media/v4l2-common.h>
-#include <asm/semaphore.h>	/* Lock for the I/O 		*/
 
 #include <linux/version.h>	/* for KERNEL_VERSION MACRO	*/
 #define RADIO_VERSION KERNEL_VERSION(0,0,2)
drivers/media/video/ir-kbd-i2c.c +0 -1
index 9851987..dabafdf 100644
@@ -40,7 +40,6 @@
 #include <linux/i2c.h>
 #include <linux/i2c-id.h>
 #include <linux/workqueue.h>
-#include <asm/semaphore.h>
 
 #include <media/ir-common.h>
 #include <media/ir-kbd-i2c.h>
drivers/media/video/ov511.c +0 -1
index d55d580..6590058 100644
@@ -41,7 +41,6 @@
 #include <linux/slab.h>
 #include <linux/ctype.h>
 #include <linux/pagemap.h>
-#include <asm/semaphore.h>
 #include <asm/processor.h>
 #include <linux/mm.h>
 #include <linux/device.h>
drivers/media/video/pvrusb2/pvrusb2-context.c +0 -1
index 9d94aed..160437b 100644
@@ -26,7 +26,6 @@
 #include <linux/errno.h>
 #include <linux/string.h>
 #include <linux/slab.h>
-#include <asm/semaphore.h>
 
 
 static void pvr2_context_destroy(struct pvr2_context *mp)
drivers/media/video/pvrusb2/pvrusb2-hdw.c +0 -1
index 41ae980..763b562 100644
@@ -25,7 +25,6 @@
 #include <linux/firmware.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-common.h>
-#include <asm/semaphore.h>
 #include "pvrusb2.h"
 #include "pvrusb2-std.h"
 #include "pvrusb2-util.h"
drivers/media/video/pvrusb2/pvrusb2-sysfs.c +0 -1
index 7a1cd87..07f4eae 100644
@@ -21,7 +21,6 @@
 
 #include <linux/string.h>
 #include <linux/slab.h>
-#include <asm/semaphore.h>
 #include "pvrusb2-sysfs.h"
 #include "pvrusb2-hdw.h"
 #include "pvrusb2-debug.h"
drivers/mfd/ucb1x00-ts.c +0 -1
index fdbaa77..5e85948 100644
@@ -32,7 +32,6 @@
 #include <linux/kthread.h>
 
 #include <asm/dma.h>
-#include <asm/semaphore.h>
 #include <asm/arch/collie.h>
 #include <asm/mach-types.h>
 
drivers/s390/cio/ccwgroup.c +0 -1
index 03914fa..fe1ad17 100644
@@ -16,7 +16,6 @@
 #include <linux/ctype.h>
 #include <linux/dcache.h>
 
-#include <asm/semaphore.h>
 #include <asm/ccwdev.h>
 #include <asm/ccwgroup.h>
 
drivers/s390/net/qeth_main.c +0 -1
index 62606ce..df81259 100644
@@ -59,7 +59,6 @@
 #include <asm/io.h>
 #include <asm/qeth.h>
 #include <asm/timex.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 #include <asm/s390_rdev.h>
 
drivers/scsi/aacraid/aachba.c +0 -1
index c05092f..96903bc 100644
@@ -31,7 +31,6 @@
 #include <linux/slab.h>
 #include <linux/completion.h>
 #include <linux/blkdev.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 #include <linux/highmem.h> /* For flush_kernel_dcache_page */
 
drivers/scsi/aacraid/comminit.c +0 -1
index 89cc8b7..294a802 100644
@@ -39,7 +39,6 @@
 #include <linux/completion.h>
 #include <linux/mm.h>
 #include <scsi/scsi_host.h>
-#include <asm/semaphore.h>
 
 #include "aacraid.h"
 
drivers/scsi/aacraid/linit.c +0 -1
index ae5f74f..8372bf6 100644
@@ -42,7 +42,6 @@
 #include <linux/syscalls.h>
 #include <linux/delay.h>
 #include <linux/kthread.h>
-#include <asm/semaphore.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
drivers/scsi/aacraid/rx.c +0 -1
index 1f18b83..073208b 100644
@@ -39,7 +39,6 @@
 #include <linux/completion.h>
 #include <linux/time.h>
 #include <linux/interrupt.h>
-#include <asm/semaphore.h>
 
 #include <scsi/scsi_host.h>
 
drivers/scsi/aacraid/sa.c +0 -1
index cfc3410..fc1a557 100644
@@ -39,7 +39,6 @@
 #include <linux/completion.h>
 #include <linux/time.h>
 #include <linux/interrupt.h>
-#include <asm/semaphore.h>
 
 #include <scsi/scsi_host.h>
 
drivers/scsi/dpt/dpti_i2o.h +0 -1
index 100b49b..19406ce 100644
@@ -21,7 +21,6 @@
 
 #include <linux/i2o-dev.h>
 
-#include <asm/semaphore.h> /* Needed for MUTEX init macros */
 #include <linux/version.h>
 #include <linux/notifier.h>
 #include <asm/atomic.h>
drivers/scsi/megaraid/mega_common.h +0 -1
index fef9ac9..f62ed46 100644
@@ -28,7 +28,6 @@
 #include <linux/list.h>
 #include <linux/moduleparam.h>
 #include <linux/dma-mapping.h>
-#include <asm/semaphore.h>
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_device.h>
drivers/serial/mcfserial.c +0 -1
index 99af084..ddd3aa5 100644
@@ -40,7 +40,6 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/system.h>
-#include <asm/semaphore.h>
 #include <asm/delay.h>
 #include <asm/coldfire.h>
 #include <asm/mcfsim.h>
drivers/usb/atm/usbatm.h +0 -1
index ff8551e..fc6c2be 100644
@@ -24,7 +24,6 @@
 #ifndef	_USBATM_H_
 #define	_USBATM_H_
 
-#include <asm/semaphore.h>
 #include <linux/atm.h>
 #include <linux/atmdev.h>
 #include <linux/completion.h>
drivers/usb/core/hub.c +0 -1
index 68fc521..57aeca1 100644
@@ -23,7 +23,6 @@
 #include <linux/mutex.h>
 #include <linux/freezer.h>
 
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 #include <asm/byteorder.h>
 
drivers/usb/misc/appledisplay.c +0 -1
index 1cb56f2..a5e4c35 100644
@@ -29,7 +29,6 @@
 #include <linux/timer.h>
 #include <linux/workqueue.h>
 #include <asm/atomic.h>
-#include <asm/semaphore.h>
 
 #define APPLE_VENDOR_ID		0x05AC
 
drivers/usb/serial/io_ti.c +0 -1
index cd34059..e5ea5ef 100644
@@ -38,7 +38,6 @@
 #include <linux/serial.h>
 #include <linux/ioctl.h>
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 #include <linux/usb.h>
 #include <linux/usb/serial.h>
 
drivers/usb/serial/ti_usb_3410_5052.c +0 -1
index b517f93..959f768 100644
@@ -82,7 +82,6 @@
 #include <linux/circ_buf.h>
 #include <linux/mutex.h>
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 #include <linux/usb.h>
 #include <linux/usb/serial.h>
 
Signature · 1 line
1.5.4.1
#6 lore raw

PATCH 6/12 fs: Remove unnecessary inclusions of asm/semaphore.h

None of these files use any of the functionality promised by asm/semaphore.h.

---
 fs/9p/fid.c           |    1 -
 fs/cramfs/inode.c     |    1 -
 fs/dlm/dlm_internal.h |    1 -
 fs/locks.c            |    1 -
 fs/reiserfs/xattr.c   |    1 -
 5 files changed, 0 insertions(+), 5 deletions(-)
fs/9p/fid.c +0 -1
index dfebdbe..3031e32 100644
@@ -26,7 +26,6 @@
 #include <linux/fs.h>
 #include <linux/sched.h>
 #include <linux/idr.h>
-#include <asm/semaphore.h>
 #include <net/9p/9p.h>
 #include <net/9p/client.h>
 
fs/cramfs/inode.c +0 -1
index 350680f..0c3b618 100644
@@ -23,7 +23,6 @@
 #include <linux/buffer_head.h>
 #include <linux/vfs.h>
 #include <linux/mutex.h>
-#include <asm/semaphore.h>
 
 #include <asm/uaccess.h>
 
fs/dlm/dlm_internal.h +0 -1
index d30ea8b..7a8824f 100644
@@ -37,7 +37,6 @@
 #include <linux/jhash.h>
 #include <linux/miscdevice.h>
 #include <linux/mutex.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 #include <linux/dlm.h>
fs/locks.c +0 -1
index f36f0e6..1100df6 100644
@@ -127,7 +127,6 @@
 #include <linux/rcupdate.h>
 #include <linux/pid_namespace.h>
 
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 #define IS_POSIX(fl)	(fl->fl_flags & FL_POSIX)
fs/reiserfs/xattr.c +0 -1
index eba037b..736bc47 100644
@@ -44,7 +44,6 @@
 #include <net/checksum.h>
 #include <linux/smp_lock.h>
 #include <linux/stat.h>
-#include <asm/semaphore.h>
 
 #define FL_READONLY 128
 #define FL_DIR_SEM_HELD 256
Signature · 1 line
1.5.4.1
#7 lore raw

PATCH 7/12 include: Remove unnecessary inclusions of asm/semaphore.h

None of these files use any of the functionality promised by asm/semaphore.h. It's possible that they (or some user of them) rely on it dragging in some unrelated header file, but I can't build all these files, so we'll have to fix any build failures as they come up.

---
 include/asm-blackfin/dma.h    |    1 -
 include/asm-ia64/sn/nodepda.h |    1 -
 include/asm-ppc/ocp.h         |    1 -
 include/linux/cpu.h           |    1 -
 include/linux/ide.h           |    1 -
 include/linux/if_pppox.h      |    1 -
 include/linux/jbd.h           |    2 --
 include/linux/jbd2.h          |    2 --
 include/linux/kernelcapi.h    |    1 -
 include/linux/raid/md.h       |    1 -
 include/linux/sched.h         |    1 -
 include/linux/syscalls.h      |    1 -
 include/scsi/libsas.h         |    1 -
 13 files changed, 0 insertions(+), 15 deletions(-)
include/asm-blackfin/dma.h +0 -1
index 5abaa2c..16d4935 100644
@@ -33,7 +33,6 @@
 #include <linux/slab.h>
 #include <asm/irq.h>
 #include <asm/signal.h>
-#include <asm/semaphore.h>
 
 #include <linux/kernel.h>
 #include <asm/mach/dma.h>
include/asm-ia64/sn/nodepda.h +0 -1
index 6f6d69e..ee118b9 100644
@@ -9,7 +9,6 @@
 #define _ASM_IA64_SN_NODEPDA_H
 
 
-#include <asm/semaphore.h>
 #include <asm/irq.h>
 #include <asm/sn/arch.h>
 #include <asm/sn/intr.h>
include/asm-ppc/ocp.h +0 -1
index 1379a4f..3909a2e 100644
@@ -31,7 +31,6 @@
 
 #include <asm/mmu.h>
 #include <asm/ocp_ids.h>
-#include <asm/semaphore.h>
 
 #ifdef CONFIG_PPC_OCP
 
include/linux/cpu.h +0 -1
index 0be8d65..f212fa9 100644
@@ -23,7 +23,6 @@
 #include <linux/node.h>
 #include <linux/compiler.h>
 #include <linux/cpumask.h>
-#include <asm/semaphore.h>
 #include <linux/mutex.h>
 
 struct cpu {
include/linux/ide.h +0 -1
index a3b69c1..68510a0 100644
@@ -23,7 +23,6 @@
 #include <asm/byteorder.h>
 #include <asm/system.h>
 #include <asm/io.h>
-#include <asm/semaphore.h>
 #include <asm/mutex.h>
 
 #if defined(CRIS) || defined(FRV)
include/linux/if_pppox.h +0 -1
index 40743e0..6fb7f17 100644
@@ -24,7 +24,6 @@
 #include <linux/if_ether.h>
 #include <linux/if.h>
 #include <linux/netdevice.h>
-#include <asm/semaphore.h>
 #include <linux/ppp_channel.h>
 #endif /* __KERNEL__ */
 #include <linux/if_pppol2tp.h>
include/linux/jbd.h +0 -2
index b18fd3b..ec52d0b 100644
@@ -32,8 +32,6 @@
 #include <linux/timer.h>
 #include <linux/lockdep.h>
 
-#include <asm/semaphore.h>
-
 #define journal_oom_retry 1
 
 /*
include/linux/jbd2.h +0 -2
index 2cbf6fd..05e2b30 100644
@@ -30,8 +30,6 @@
 #include <linux/bit_spinlock.h>
 #include <linux/mutex.h>
 #include <linux/timer.h>
-
-#include <asm/semaphore.h>
 #endif
 
 #define journal_oom_retry 1
include/linux/kernelcapi.h +0 -1
index 8c4350a..a53e932 100644
@@ -48,7 +48,6 @@ typedef struct kcapi_carddef {
 #include <linux/list.h>
 #include <linux/skbuff.h>
 #include <linux/workqueue.h>
-#include <asm/semaphore.h>
 
 #define	KCI_CONTRUP	0	/* arg: struct capi_profile */
 #define	KCI_CONTRDOWN	1	/* arg: NULL */
include/linux/raid/md.h +0 -1
index fbaeda7..8ab630b 100644
@@ -19,7 +19,6 @@
 #define _MD_H
 
 #include <linux/blkdev.h>
-#include <asm/semaphore.h>
 #include <linux/major.h>
 #include <linux/ioctl.h>
 #include <linux/types.h>
include/linux/sched.h +0 -1
index 2c9621f..601d100 100644
@@ -61,7 +61,6 @@ struct sched_param {
 #include <linux/mm_types.h>
 
 #include <asm/system.h>
-#include <asm/semaphore.h>
 #include <asm/page.h>
 #include <asm/ptrace.h>
 #include <asm/cputime.h>
include/linux/syscalls.h +0 -1
index 4c2577b..8df6d13 100644
@@ -60,7 +60,6 @@ struct getcpu_cache;
 #include <linux/capability.h>
 #include <linux/list.h>
 #include <linux/sem.h>
-#include <asm/semaphore.h>
 #include <asm/siginfo.h>
 #include <asm/signal.h>
 #include <linux/quota.h>
include/scsi/libsas.h +0 -1
index 3ffd6b5..896db51 100644
@@ -32,7 +32,6 @@
 #include <scsi/sas.h>
 #include <linux/libata.h>
 #include <linux/list.h>
-#include <asm/semaphore.h>
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_transport_sas.h>
Signature · 1 line
1.5.4.1
#8 lore raw

PATCH 8/12 kernel: Remove unnecessary inclusions of asm/semaphore.h

None of these files use any of the functionality promised by asm/semaphore.h.

---
 kernel/kexec.c        |    1 -
 kernel/kthread.c      |    1 -
 kernel/module.c       |    3 +--
 kernel/posix-timers.c |    1 -
 kernel/profile.c      |    1 -
 kernel/stop_machine.c |    1 -
 6 files changed, 1 insertions(+), 7 deletions(-)
kernel/kexec.c +0 -1
index 06a0e27..6782dce 100644
@@ -29,7 +29,6 @@
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/system.h>
-#include <asm/semaphore.h>
 #include <asm/sections.h>
 
 /* Per cpu memory for storing cpu states in case of system crash. */
kernel/kthread.c +0 -1
index 0ac8878..92dd1bc 100644
@@ -13,7 +13,6 @@
 #include <linux/file.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
-#include <asm/semaphore.h>
 
 #define KTHREAD_NICE_LEVEL (-5)
 
kernel/module.c +1 -2
index 901cd6a..88092f7 100644
@@ -43,7 +43,6 @@
 #include <linux/mutex.h>
 #include <linux/unwind.h>
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 #include <asm/cacheflush.h>
 #include <linux/license.h>
 #include <asm/sections.h>
@@ -664,7 +663,7 @@ static void free_module(struct module *mod);
 
 static void wait_for_zero_refcount(struct module *mod)
 {
-	/* Since we might sleep for some time, drop the semaphore first */
+	/* Since we might sleep for some time, release the mutex first */
 	mutex_unlock(&module_mutex);
 	for (;;) {
 		DEBUGP("Looking at refcount...\n");
kernel/posix-timers.c +0 -1
index a9b0420..8476956 100644
@@ -37,7 +37,6 @@
 #include <linux/mutex.h>
 
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 #include <linux/list.h>
 #include <linux/init.h>
 #include <linux/compiler.h>
kernel/profile.c +0 -1
index 3b7a1b0..606d738 100644
@@ -23,7 +23,6 @@
 #include <linux/highmem.h>
 #include <linux/mutex.h>
 #include <asm/sections.h>
-#include <asm/semaphore.h>
 #include <asm/irq_regs.h>
 #include <asm/ptrace.h>
 
kernel/stop_machine.c +0 -1
index 6f4e0e1..3da3c2c 100644
@@ -11,7 +11,6 @@
 #include <linux/interrupt.h>
 
 #include <asm/atomic.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 /* Since we effect priority and affinity (both of which are visible
Signature · 1 line
1.5.4.1
#9 lore raw

PATCH 9/12 lib: Remove unnecessary inclusions of asm/semaphore.h

reed_solomon doesn't use any of the functionality promised by asm/semaphore.h.

---
 lib/reed_solomon/reed_solomon.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
lib/reed_solomon/reed_solomon.c +0 -1
index 3ea2db9..06d04cf 100644
@@ -45,7 +45,6 @@
 #include <linux/rslib.h>
 #include <linux/slab.h>
 #include <linux/mutex.h>
-#include <asm/semaphore.h>
 
 /* This list holds all currently allocated rs control structures */
 static LIST_HEAD (rslist);
Signature · 1 line
1.5.4.1
#10 lore raw

PATCH 10/12 security: Remove unnecessary inclusions of asm/semaphore.h

None of these files use any of the functionality promised by asm/semaphore.h.

---
 security/selinux/selinuxfs.c      |    1 -
 security/selinux/ss/conditional.c |    1 -
 security/selinux/xfrm.c           |    1 -
 3 files changed, 0 insertions(+), 3 deletions(-)
security/selinux/selinuxfs.c +0 -1
index 0341567..443cdac 100644
@@ -28,7 +28,6 @@
 #include <linux/percpu.h>
 #include <linux/audit.h>
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 
 /* selinuxfs pseudo filesystem for exporting the security policy API.
    Based on the proc code and the fs/nfsd/nfsctl.c code. */
security/selinux/ss/conditional.c +0 -1
index 50ad85d..a115892 100644
@@ -11,7 +11,6 @@
 #include <linux/errno.h>
 #include <linux/string.h>
 #include <linux/spinlock.h>
-#include <asm/semaphore.h>
 #include <linux/slab.h>
 
 #include "security.h"
security/selinux/xfrm.c +0 -1
index 7e15820..041d8d1 100644
@@ -45,7 +45,6 @@
 #include <net/xfrm.h>
 #include <net/checksum.h>
 #include <net/udp.h>
-#include <asm/semaphore.h>
 #include <asm/atomic.h>
 
 #include "avc.h"
Signature · 1 line
1.5.4.1
#11 lore raw

PATCH 11/12 Generic semaphore implementation

Semaphores are no longer performance-critical, so a generic C implementation is better for maintainability, debuggability and extensibility.

---
 arch/alpha/kernel/Makefile               |    2 +-
 arch/alpha/kernel/alpha_ksyms.c          |    9 -
 arch/alpha/kernel/semaphore.c            |  224 --------------------------
 arch/arm/kernel/Makefile                 |    2 +-
 arch/arm/kernel/semaphore.c              |  221 --------------------------
 arch/avr32/kernel/Makefile               |    2 +-
 arch/avr32/kernel/semaphore.c            |  148 -----------------
 arch/blackfin/Kconfig                    |    4 -
 arch/blackfin/kernel/bfin_ksyms.c        |    5 -
 arch/cris/kernel/Makefile                |    3 +-
 arch/cris/kernel/crisksyms.c             |    7 -
 arch/cris/kernel/semaphore.c             |  129 ---------------
 arch/frv/kernel/Makefile                 |    2 +-
 arch/frv/kernel/frv_ksyms.c              |    1 -
 arch/frv/kernel/semaphore.c              |  155 ------------------
 arch/h8300/kernel/Makefile               |    2 +-
 arch/h8300/kernel/h8300_ksyms.c          |    1 -
 arch/h8300/kernel/semaphore.c            |  132 ----------------
 arch/ia64/kernel/Makefile                |    2 +-
 arch/ia64/kernel/ia64_ksyms.c            |    6 -
 arch/ia64/kernel/semaphore.c             |  165 -------------------
 arch/m32r/kernel/Makefile                |    2 +-
 arch/m32r/kernel/m32r_ksyms.c            |    5 -
 arch/m32r/kernel/semaphore.c             |  185 ----------------------
 arch/m68k/kernel/Makefile                |    2 +-
 arch/m68k/kernel/m68k_ksyms.c            |    6 -
 arch/m68k/kernel/semaphore.c             |  132 ----------------
 arch/m68k/lib/Makefile                   |    2 +-
 arch/m68k/lib/semaphore.S                |   53 ------
 arch/m68knommu/kernel/Makefile           |    2 +-
 arch/m68knommu/kernel/m68k_ksyms.c       |    6 -
 arch/m68knommu/kernel/semaphore.c        |  133 ----------------
 arch/m68knommu/lib/Makefile              |    2 +-
 arch/m68knommu/lib/semaphore.S           |   66 --------
 arch/mips/kernel/Makefile                |    2 +-
 arch/mips/kernel/semaphore.c             |  168 --------------------
 arch/mn10300/kernel/Makefile             |    2 +-
 arch/mn10300/kernel/semaphore.c          |  149 -----------------
 arch/parisc/kernel/Makefile              |    2 +-
 arch/parisc/kernel/parisc_ksyms.c        |    5 -
 arch/parisc/kernel/semaphore.c           |  102 ------------
 arch/powerpc/kernel/Makefile             |    2 +-
 arch/powerpc/kernel/ppc_ksyms.c          |    1 -
 arch/powerpc/kernel/semaphore.c          |  135 ----------------
 arch/ppc/kernel/semaphore.c              |  131 ---------------
 arch/s390/kernel/Makefile                |    2 +-
 arch/s390/kernel/s390_ksyms.c            |    7 -
 arch/s390/kernel/semaphore.c             |  108 -------------
 arch/sh/kernel/Makefile_32               |    2 +-
 arch/sh/kernel/Makefile_64               |    2 +-
 arch/sh/kernel/semaphore.c               |  139 ----------------
 arch/sh/kernel/sh_ksyms_32.c             |    7 -
 arch/sh/kernel/sh_ksyms_64.c             |    4 -
 arch/sparc/kernel/Makefile               |    2 +-
 arch/sparc/kernel/semaphore.c            |  155 ------------------
 arch/sparc/kernel/sparc_ksyms.c          |    5 -
 arch/sparc64/kernel/Makefile             |    2 +-
 arch/sparc64/kernel/semaphore.c          |  254 ------------------------------
 arch/sparc64/kernel/sparc64_ksyms.c      |    6 -
 arch/um/Kconfig.i386                     |   39 +++++-
 arch/um/Kconfig.x86_64                   |    6 +-
 arch/um/sys-i386/ksyms.c                 |   12 --
 arch/um/sys-ppc/Makefile                 |    8 +-
 arch/um/sys-x86_64/ksyms.c               |   13 +--
 arch/v850/kernel/Makefile                |    2 +-
 arch/v850/kernel/semaphore.c             |  166 -------------------
 arch/v850/kernel/v850_ksyms.c            |    7 -
 arch/x86/Kconfig                         |    7 -
 arch/x86/kernel/i386_ksyms_32.c          |    5 -
 arch/x86/kernel/x8664_ksyms_64.c         |    6 -
 arch/x86/lib/semaphore_32.S              |   83 ----------
 arch/x86/lib/thunk_64.S                  |    5 -
 arch/xtensa/kernel/Makefile              |    2 +-
 arch/xtensa/kernel/semaphore.c           |  226 --------------------------
 arch/xtensa/kernel/xtensa_ksyms.c        |    9 -
 include/asm-alpha/semaphore.h            |  150 +-----------------
 include/asm-arm/semaphore-helper.h       |   84 ----------
 include/asm-arm/semaphore.h              |   99 +------------
 include/asm-avr32/semaphore.h            |  109 +-------------
 include/asm-blackfin/semaphore-helper.h  |   82 ----------
 include/asm-blackfin/semaphore.h         |  106 +------------
 include/asm-cris/semaphore-helper.h      |   78 ---------
 include/asm-cris/semaphore.h             |  134 +----------------
 include/asm-frv/semaphore.h              |  156 +------------------
 include/asm-h8300/semaphore-helper.h     |   85 ----------
 include/asm-h8300/semaphore.h            |  191 +----------------------
 include/asm-ia64/semaphore.h             |  100 +------------
 include/asm-m32r/semaphore.h             |  145 +-----------------
 include/asm-m68k/semaphore-helper.h      |  142 -----------------
 include/asm-m68k/semaphore.h             |  164 +-------------------
 include/asm-m68knommu/semaphore-helper.h |   82 ----------
 include/asm-m68knommu/semaphore.h        |  154 +------------------
 include/asm-mips/semaphore.h             |  109 +-------------
 include/asm-mn10300/semaphore.h          |  170 +--------------------
 include/asm-parisc/semaphore-helper.h    |   89 -----------
 include/asm-parisc/semaphore.h           |  146 +-----------------
 include/asm-powerpc/semaphore.h          |   95 +-----------
 include/asm-s390/semaphore.h             |  108 +-------------
 include/asm-sh/semaphore-helper.h        |   89 -----------
 include/asm-sh/semaphore.h               |  116 +--------------
 include/asm-sparc/semaphore.h            |  193 +----------------------
 include/asm-sparc64/semaphore.h          |   54 +------
 include/asm-um/semaphore.h               |    7 +-
 include/asm-v850/semaphore.h             |   85 +----------
 include/asm-x86/semaphore.h              |    6 +-
 include/asm-x86/semaphore_32.h           |  175 --------------------
 include/asm-x86/semaphore_64.h           |  180 ---------------------
 include/asm-xtensa/semaphore.h           |  100 +------------
 include/linux/semaphore.h                |   81 ++++++++++
 kernel/Makefile                          |    2 +-
 kernel/semaphore.c                       |  204 ++++++++++++++++++++++++
 lib/Makefile                             |    1 -
 lib/semaphore-sleepers.c                 |  176 ---------------------
 113 files changed, 374 insertions(+), 7681 deletions(-)
 delete mode 100644 arch/alpha/kernel/semaphore.c
 delete mode 100644 arch/arm/kernel/semaphore.c
 delete mode 100644 arch/avr32/kernel/semaphore.c
 delete mode 100644 arch/cris/kernel/semaphore.c
 delete mode 100644 arch/frv/kernel/semaphore.c
 delete mode 100644 arch/h8300/kernel/semaphore.c
 delete mode 100644 arch/ia64/kernel/semaphore.c
 delete mode 100644 arch/m32r/kernel/semaphore.c
 delete mode 100644 arch/m68k/kernel/semaphore.c
 delete mode 100644 arch/m68k/lib/semaphore.S
 delete mode 100644 arch/m68knommu/kernel/semaphore.c
 delete mode 100644 arch/m68knommu/lib/semaphore.S
 delete mode 100644 arch/mips/kernel/semaphore.c
 delete mode 100644 arch/mn10300/kernel/semaphore.c
 delete mode 100644 arch/parisc/kernel/semaphore.c
 delete mode 100644 arch/powerpc/kernel/semaphore.c
 delete mode 100644 arch/ppc/kernel/semaphore.c
 delete mode 100644 arch/s390/kernel/semaphore.c
 delete mode 100644 arch/sh/kernel/semaphore.c
 delete mode 100644 arch/sparc/kernel/semaphore.c
 delete mode 100644 arch/sparc64/kernel/semaphore.c
 delete mode 100644 arch/v850/kernel/semaphore.c
 delete mode 100644 arch/xtensa/kernel/semaphore.c
 delete mode 100644 include/asm-arm/semaphore-helper.h
 delete mode 100644 include/asm-blackfin/semaphore-helper.h
 delete mode 100644 include/asm-cris/semaphore-helper.h
 delete mode 100644 include/asm-h8300/semaphore-helper.h
 delete mode 100644 include/asm-m68k/semaphore-helper.h
 delete mode 100644 include/asm-m68knommu/semaphore-helper.h
 delete mode 100644 include/asm-parisc/semaphore-helper.h
 delete mode 100644 include/asm-sh/semaphore-helper.h
 delete mode 100644 include/asm-x86/semaphore_32.h
 delete mode 100644 include/asm-x86/semaphore_64.h
 create mode 100644 include/linux/semaphore.h
 create mode 100644 kernel/semaphore.c
 delete mode 100644 lib/semaphore-sleepers.c
arch/alpha/kernel/Makefile +1 -1
index dccf052..ac706c1 100644
@@ -7,7 +7,7 @@ EXTRA_AFLAGS	:= $(KBUILD_CFLAGS)
 EXTRA_CFLAGS	:= -Werror -Wno-sign-compare
 
 obj-y    := entry.o traps.o process.o init_task.o osf_sys.o irq.o \
-	    irq_alpha.o signal.o setup.o ptrace.o time.o semaphore.o \
+	    irq_alpha.o signal.o setup.o ptrace.o time.o \
 	    alpha_ksyms.o systbls.o err_common.o io.o
 
 obj-$(CONFIG_VGA_HOSE)	+= console.o
arch/alpha/kernel/alpha_ksyms.c +0 -9
index e9762a3..d96e742 100644
@@ -77,15 +77,6 @@ EXPORT_SYMBOL(__do_clear_user);
 EXPORT_SYMBOL(__strncpy_from_user);
 EXPORT_SYMBOL(__strnlen_user);
 
-/* Semaphore helper functions.  */
-EXPORT_SYMBOL(__down_failed);
-EXPORT_SYMBOL(__down_failed_interruptible);
-EXPORT_SYMBOL(__up_wakeup);
-EXPORT_SYMBOL(down);
-EXPORT_SYMBOL(down_interruptible);
-EXPORT_SYMBOL(down_trylock);
-EXPORT_SYMBOL(up);
-
 /* 
  * SMP-specific symbols.
  */
arch/alpha/kernel/semaphore.c deleted +0 -224

224 lines not on this page · raw message

arch/arm/kernel/Makefile +1 -1
index 00d44c6..6235f72 100644
@@ -7,7 +7,7 @@ AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
 # Object file lists.
 
 obj-y		:= compat.o entry-armv.o entry-common.o irq.o \
-		   process.o ptrace.o semaphore.o setup.o signal.o \
+		   process.o ptrace.o setup.o signal.o \
 		   sys_arm.o stacktrace.o time.o traps.o
 
 obj-$(CONFIG_ISA_DMA_API)	+= dma.o
arch/arm/kernel/semaphore.c deleted +0 -221

221 lines not on this page · raw message

arch/avr32/kernel/Makefile +1 -1
index e4b6d12..18229d0 100644
@@ -6,7 +6,7 @@ extra-y				:= head.o vmlinux.lds
 
 obj-$(CONFIG_SUBARCH_AVR32B)	+= entry-avr32b.o
 obj-y				+= syscall_table.o syscall-stubs.o irq.o
-obj-y				+= setup.o traps.o semaphore.o ocd.o ptrace.o
+obj-y				+= setup.o traps.o ocd.o ptrace.o
 obj-y				+= signal.o sys_avr32.o process.o time.o
 obj-y				+= init_task.o switch_to.o cpu.o
 obj-$(CONFIG_MODULES)		+= module.o avr32_ksyms.o
arch/avr32/kernel/semaphore.c deleted +0 -148

148 lines not on this page · raw message

arch/blackfin/Kconfig +0 -4
index 589c6ac..2dd1f30 100644
@@ -31,10 +31,6 @@ config ZONE_DMA
 	bool
 	default y
 
-config SEMAPHORE_SLEEPERS
-	bool
-	default y
-
 config GENERIC_FIND_NEXT_BIT
 	bool
 	default y
arch/blackfin/kernel/bfin_ksyms.c +0 -5
index 0bfbb26..053edff 100644
@@ -42,11 +42,6 @@ EXPORT_SYMBOL(ip_fast_csum);
 
 EXPORT_SYMBOL(kernel_thread);
 
-EXPORT_SYMBOL(__up);
-EXPORT_SYMBOL(__down);
-EXPORT_SYMBOL(__down_trylock);
-EXPORT_SYMBOL(__down_interruptible);
-
 EXPORT_SYMBOL(is_in_rom);
 EXPORT_SYMBOL(bfin_return_from_exception);
 
arch/cris/kernel/Makefile +1 -2
index c8e8ea5..ee7bcd4 100644
@@ -5,8 +5,7 @@
 
 extra-y	:= vmlinux.lds
 
-obj-y   := process.o traps.o irq.o ptrace.o setup.o \
-	   time.o sys_cris.o semaphore.o
+obj-y   := process.o traps.o irq.o ptrace.o setup.o time.o sys_cris.o
 
 obj-$(CONFIG_MODULES)    += crisksyms.o
 obj-$(CONFIG_MODULES)	 += module.o
arch/cris/kernel/crisksyms.c +0 -7
index 62f0e75..7ac000f 100644
@@ -9,7 +9,6 @@
 #include <linux/string.h>
 #include <linux/tty.h>
 
-#include <asm/semaphore.h>
 #include <asm/processor.h>
 #include <asm/uaccess.h>
 #include <asm/checksum.h>
@@ -49,12 +48,6 @@ EXPORT_SYMBOL(__negdi2);
 EXPORT_SYMBOL(__ioremap);
 EXPORT_SYMBOL(iounmap);
 
-/* Semaphore functions */
-EXPORT_SYMBOL(__up);
-EXPORT_SYMBOL(__down);
-EXPORT_SYMBOL(__down_interruptible);
-EXPORT_SYMBOL(__down_trylock);
-
 /* Userspace access functions */
 EXPORT_SYMBOL(__copy_user_zeroing);
 EXPORT_SYMBOL(__copy_user);
arch/cris/kernel/semaphore.c deleted +0 -129

129 lines not on this page · raw message

arch/frv/kernel/Makefile +1 -1
index e8f73ed..c36f70b 100644
@@ -9,7 +9,7 @@ extra-y:= head.o init_task.o vmlinux.lds
 
 obj-y := $(heads-y) entry.o entry-table.o break.o switch_to.o kernel_thread.o \
 	 kernel_execve.o process.o traps.o ptrace.o signal.o dma.o \
-	 sys_frv.o time.o semaphore.o setup.o frv_ksyms.o \
+	 sys_frv.o time.o setup.o frv_ksyms.o \
 	 debug-stub.o irq.o sleep.o uaccess.o
 
 obj-$(CONFIG_GDBSTUB)		+= gdb-stub.o gdb-io.o
arch/frv/kernel/frv_ksyms.c +0 -1
index f772704..0316b3c 100644
@@ -12,7 +12,6 @@
 #include <asm/pgalloc.h>
 #include <asm/irq.h>
 #include <asm/io.h>
-#include <asm/semaphore.h>
 #include <asm/checksum.h>
 #include <asm/hardirq.h>
 #include <asm/cacheflush.h>
arch/frv/kernel/semaphore.c deleted +0 -155

155 lines not on this page · raw message

arch/h8300/kernel/Makefile +1 -1
index 874f6ae..6c248c3 100644
@@ -5,7 +5,7 @@
 extra-y := vmlinux.lds
 
 obj-y := process.o traps.o ptrace.o irq.o \
-	 sys_h8300.o time.o semaphore.o signal.o \
+	 sys_h8300.o time.o signal.o \
          setup.o gpio.o init_task.o syscalls.o \
 	 entry.o
 
arch/h8300/kernel/h8300_ksyms.c +0 -1
index d1b1526..6866bd9 100644
@@ -12,7 +12,6 @@
 #include <asm/pgalloc.h>
 #include <asm/irq.h>
 #include <asm/io.h>
-#include <asm/semaphore.h>
 #include <asm/checksum.h>
 #include <asm/current.h>
 #include <asm/gpio.h>
arch/h8300/kernel/semaphore.c deleted +0 -132

132 lines not on this page · raw message

arch/ia64/kernel/Makefile +1 -1
index 33e5a59..13fd10e 100644
@@ -6,7 +6,7 @@ extra-y	:= head.o init_task.o vmlinux.lds
 
 obj-y := acpi.o entry.o efi.o efi_stub.o gate-data.o fsys.o ia64_ksyms.o irq.o irq_ia64.o	\
 	 irq_lsapic.o ivt.o machvec.o pal.o patch.o process.o perfmon.o ptrace.o sal.o		\
-	 salinfo.o semaphore.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o \
+	 salinfo.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o \
 	 unwind.o mca.o mca_asm.o topology.o
 
 obj-$(CONFIG_IA64_BRL_EMU)	+= brl_emu.o
arch/ia64/kernel/ia64_ksyms.c +0 -6
index 8e7193d..6da1f20 100644
@@ -19,12 +19,6 @@ EXPORT_SYMBOL_GPL(empty_zero_page);
 EXPORT_SYMBOL(ip_fast_csum);		/* hand-coded assembly */
 EXPORT_SYMBOL(csum_ipv6_magic);
 
-#include <asm/semaphore.h>
-EXPORT_SYMBOL(__down);
-EXPORT_SYMBOL(__down_interruptible);
-EXPORT_SYMBOL(__down_trylock);
-EXPORT_SYMBOL(__up);
-
 #include <asm/page.h>
 EXPORT_SYMBOL(clear_page);
 
arch/ia64/kernel/semaphore.c deleted +0 -165

165 lines not on this page · raw message

arch/m32r/kernel/Makefile +1 -1
index e97e26e..09200d4 100644
@@ -5,7 +5,7 @@
 extra-y	:= head.o init_task.o vmlinux.lds
 
 obj-y	:= process.o entry.o traps.o align.o irq.o setup.o time.o \
-	m32r_ksyms.o sys_m32r.o semaphore.o signal.o ptrace.o
+	m32r_ksyms.o sys_m32r.o signal.o ptrace.o
 
 obj-$(CONFIG_SMP)		+= smp.o smpboot.o
 obj-$(CONFIG_MODULES)		+= module.o
arch/m32r/kernel/m32r_ksyms.c +0 -5
index 41a4c95..e6709fe 100644
@@ -7,7 +7,6 @@
 #include <linux/interrupt.h>
 #include <linux/string.h>
 
-#include <asm/semaphore.h>
 #include <asm/processor.h>
 #include <asm/uaccess.h>
 #include <asm/checksum.h>
@@ -22,10 +21,6 @@ EXPORT_SYMBOL(dump_fpu);
 EXPORT_SYMBOL(__ioremap);
 EXPORT_SYMBOL(iounmap);
 EXPORT_SYMBOL(kernel_thread);
-EXPORT_SYMBOL(__down);
-EXPORT_SYMBOL(__down_interruptible);
-EXPORT_SYMBOL(__up);
-EXPORT_SYMBOL(__down_trylock);
 
 /* Networking helper routines. */
 /* Delay loops */
arch/m32r/kernel/semaphore.c deleted +0 -185

185 lines not on this page · raw message

arch/m68k/kernel/Makefile +1 -1
index a806208..7a62a71 100644
@@ -10,7 +10,7 @@ endif
 extra-y	+= vmlinux.lds
 
 obj-y	:= entry.o process.o traps.o ints.o signal.o ptrace.o module.o \
-	   sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o devres.o
+	   sys_m68k.o time.o setup.o m68k_ksyms.o devres.o
 
 devres-y = ../../../kernel/irq/devres.o
 
arch/m68k/kernel/m68k_ksyms.c +0 -6
index 6fc69c7..d900e77 100644
@@ -1,5 +1,4 @@
 #include <linux/module.h>
-#include <asm/semaphore.h>
 
 asmlinkage long long __ashldi3 (long long, int);
 asmlinkage long long __ashrdi3 (long long, int);
@@ -15,8 +14,3 @@ EXPORT_SYMBOL(__ashrdi3);
 EXPORT_SYMBOL(__lshrdi3);
 EXPORT_SYMBOL(__muldi3);
 
-EXPORT_SYMBOL(__down_failed);
-EXPORT_SYMBOL(__down_failed_interruptible);
-EXPORT_SYMBOL(__down_failed_trylock);
-EXPORT_SYMBOL(__up_wakeup);
-
arch/m68k/kernel/semaphore.c deleted +0 -132

132 lines not on this page · raw message

arch/m68k/lib/Makefile +1 -1
index 6bbf19f..a18af09 100644
@@ -5,4 +5,4 @@
 EXTRA_AFLAGS := -traditional
 
 lib-y	:= ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
-	   checksum.o string.o semaphore.o uaccess.o
+	   checksum.o string.o uaccess.o
arch/m68k/lib/semaphore.S deleted +0 -53

53 lines not on this page · raw message

arch/m68knommu/kernel/Makefile +1 -1
index 1524b39..f0eab3d 100644
@@ -5,7 +5,7 @@
 extra-y := vmlinux.lds
 
 obj-y += dma.o entry.o init_task.o irq.o m68k_ksyms.o process.o ptrace.o \
-	 semaphore.o setup.o signal.o syscalltable.o sys_m68k.o time.o traps.o
+	 setup.o signal.o syscalltable.o sys_m68k.o time.o traps.o
 
 obj-$(CONFIG_MODULES)	+= module.o
 obj-$(CONFIG_COMEMPCI)	+= comempci.o
arch/m68knommu/kernel/m68k_ksyms.c +0 -6
index 53fad14..39fe0a7 100644
@@ -13,7 +13,6 @@
 #include <asm/pgalloc.h>
 #include <asm/irq.h>
 #include <asm/io.h>
-#include <asm/semaphore.h>
 #include <asm/checksum.h>
 #include <asm/current.h>
 
@@ -39,11 +38,6 @@ EXPORT_SYMBOL(csum_partial_copy_nocheck);
 EXPORT_SYMBOL(memcpy);
 EXPORT_SYMBOL(memset);
 
-EXPORT_SYMBOL(__down_failed);
-EXPORT_SYMBOL(__down_failed_interruptible);
-EXPORT_SYMBOL(__down_failed_trylock);
-EXPORT_SYMBOL(__up_wakeup);
-
 /*
  * libgcc functions - functions that are used internally by the
  * compiler...  (prototypes are not correct though, but that
arch/m68knommu/kernel/semaphore.c deleted +0 -133

133 lines not on this page · raw message

arch/m68knommu/lib/Makefile +1 -1
index e051a79..d94d709 100644
@@ -4,4 +4,4 @@
 
 lib-y	:= ashldi3.o ashrdi3.o lshrdi3.o \
 	   muldi3.o mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o \
-	   checksum.o semaphore.o memcpy.o memset.o delay.o
+	   checksum.o memcpy.o memset.o delay.o
arch/m68knommu/lib/semaphore.S deleted +0 -66

66 lines not on this page · raw message

arch/mips/kernel/Makefile +1 -1
index ffa0836..6da8bbb 100644
@@ -5,7 +5,7 @@
 extra-y		:= head.o init_task.o vmlinux.lds
 
 obj-y		+= cpu-probe.o branch.o entry.o genex.o irq.o process.o \
-		   ptrace.o reset.o semaphore.o setup.o signal.o syscall.o \
+		   ptrace.o reset.o setup.o signal.o syscall.o \
 		   time.o topology.o traps.o unaligned.o
 
 obj-$(CONFIG_CEVT_BCM1480)	+= cevt-bcm1480.o
arch/mips/kernel/semaphore.c deleted +0 -168

168 lines not on this page · raw message

arch/mn10300/kernel/Makefile +1 -1
index ef07c95..23f2ab6 100644
@@ -3,7 +3,7 @@
 #
 extra-y := head.o init_task.o vmlinux.lds
 
-obj-y   := process.o semaphore.o signal.o entry.o fpu.o traps.o irq.o \
+obj-y   := process.o signal.o entry.o fpu.o traps.o irq.o \
 	   ptrace.o setup.o time.o sys_mn10300.o io.o kthread.o \
 	   switch_to.o mn10300_ksyms.o kernel_execve.o
 
arch/mn10300/kernel/semaphore.c deleted +0 -149

149 lines not on this page · raw message

arch/parisc/kernel/Makefile +1 -1
index 27827bc..1f6585a 100644
@@ -9,7 +9,7 @@ AFLAGS_pacache.o := -traditional
 
 obj-y	     	:= cache.o pacache.o setup.o traps.o time.o irq.o \
 		   pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \
-		   ptrace.o hardware.o inventory.o drivers.o semaphore.o \
+		   ptrace.o hardware.o inventory.o drivers.o \
 		   signal.o hpmc.o real2.o parisc_ksyms.o unaligned.o \
 		   process.o processor.o pdc_cons.o pdc_chassis.o unwind.o \
 		   topology.o
arch/parisc/kernel/parisc_ksyms.c +0 -5
index 7aca704..5b7fc4a 100644
@@ -69,11 +69,6 @@ EXPORT_SYMBOL(memcpy_toio);
 EXPORT_SYMBOL(memcpy_fromio);
 EXPORT_SYMBOL(memset_io);
 
-#include <asm/semaphore.h>
-EXPORT_SYMBOL(__up);
-EXPORT_SYMBOL(__down_interruptible);
-EXPORT_SYMBOL(__down);
-
 extern void $$divI(void);
 extern void $$divU(void);
 extern void $$remI(void);
arch/parisc/kernel/semaphore.c deleted +0 -102

102 lines not on this page · raw message

arch/powerpc/kernel/Makefile +1 -1
index c1baf9d..b9dbfff 100644
@@ -12,7 +12,7 @@ CFLAGS_prom_init.o      += -fPIC
 CFLAGS_btext.o		+= -fPIC
 endif
 
-obj-y				:= semaphore.o cputable.o ptrace.o syscalls.o \
+obj-y				:= cputable.o ptrace.o syscalls.o \
 				   irq.o align.o signal_32.o pmc.o vdso.o \
 				   init_task.o process.o systbl.o idle.o \
 				   signal.o
arch/powerpc/kernel/ppc_ksyms.c +0 -1
index aa9ff35..21c1ca2 100644
@@ -15,7 +15,6 @@
 #include <linux/bitops.h>
 
 #include <asm/page.h>
-#include <asm/semaphore.h>
 #include <asm/processor.h>
 #include <asm/cacheflush.h>
 #include <asm/uaccess.h>
arch/powerpc/kernel/semaphore.c deleted +0 -135

135 lines not on this page · raw message

arch/ppc/kernel/semaphore.c deleted +0 -131

131 lines not on this page · raw message

arch/s390/kernel/Makefile +1 -1
index b3b650a..d426c11 100644
@@ -6,7 +6,7 @@ EXTRA_AFLAGS	:= -traditional
 
 obj-y	:=  bitmap.o traps.o time.o process.o base.o early.o \
             setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \
-	    semaphore.o s390_ext.o debug.o irq.o ipl.o dis.o diag.o
+	    s390_ext.o debug.o irq.o ipl.o dis.o diag.o
 
 obj-y	+= $(if $(CONFIG_64BIT),entry64.o,entry.o)
 obj-y	+= $(if $(CONFIG_64BIT),reipl64.o,reipl.o)
arch/s390/kernel/s390_ksyms.c +0 -7
index 7234c73..48238a1 100644
@@ -27,13 +27,6 @@ EXPORT_SYMBOL(_zb_findmap);
 EXPORT_SYMBOL(_sb_findmap);
 
 /*
- * semaphore ops
- */
-EXPORT_SYMBOL(__up);
-EXPORT_SYMBOL(__down);
-EXPORT_SYMBOL(__down_interruptible);
-
-/*
  * binfmt_elf loader 
  */
 extern int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs);
arch/s390/kernel/semaphore.c deleted +0 -108

108 lines not on this page · raw message

arch/sh/kernel/Makefile_32 +1 -1
index 62bf373..4bbdce3 100644
@@ -5,7 +5,7 @@
 extra-y	:= head_32.o init_task.o vmlinux.lds
 
 obj-y	:= debugtraps.o io.o io_generic.o irq.o machvec.o process_32.o \
-	   ptrace_32.o semaphore.o setup.o signal_32.o sys_sh.o sys_sh32.o \
+	   ptrace_32.o setup.o signal_32.o sys_sh.o sys_sh32.o \
 	   syscalls_32.o time_32.o topology.o traps.o traps_32.o
 
 obj-y				+= cpu/ timers/
arch/sh/kernel/Makefile_64 +1 -1
index e01283d..6edf53b 100644
@@ -1,7 +1,7 @@
 extra-y	:= head_64.o init_task.o vmlinux.lds
 
 obj-y	:= debugtraps.o io.o io_generic.o irq.o machvec.o process_64.o \
-	   ptrace_64.o semaphore.o setup.o signal_64.o sys_sh.o sys_sh64.o \
+	   ptrace_64.o setup.o signal_64.o sys_sh.o sys_sh64.o \
 	   syscalls_64.o time_64.o topology.o traps.o traps_64.o
 
 obj-y				+= cpu/ timers/
arch/sh/kernel/semaphore.c deleted +0 -139

139 lines not on this page · raw message

arch/sh/kernel/sh_ksyms_32.c +0 -7
index e1a6de9..c011ad0 100644
@@ -9,7 +9,6 @@
 #include <linux/pci.h>
 #include <linux/irq.h>
 #include <asm/sections.h>
-#include <asm/semaphore.h>
 #include <asm/processor.h>
 #include <asm/uaccess.h>
 #include <asm/checksum.h>
@@ -48,12 +47,6 @@ EXPORT_SYMBOL(__copy_user);
 EXPORT_SYMBOL(get_vm_area);
 #endif
 
-/* semaphore exports */
-EXPORT_SYMBOL(__up);
-EXPORT_SYMBOL(__down);
-EXPORT_SYMBOL(__down_interruptible);
-EXPORT_SYMBOL(__down_trylock);
-
 EXPORT_SYMBOL(__udelay);
 EXPORT_SYMBOL(__ndelay);
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

arch/sh/kernel/sh_ksyms_64.c +0 -4
index 8004c38..c1a3555 100644

Lines of this file are not shown. View the raw message.

arch/sparc/kernel/Makefile +1 -1
index e795f28..9b16cd3 100644

Lines of this file are not shown. View the raw message.

arch/sparc/kernel/semaphore.c deleted +0 -155

155 lines not on this page · raw message

arch/sparc/kernel/sparc_ksyms.c +0 -5
index c1025e5..97b1de0 100644

Lines of this file are not shown. View the raw message.

arch/sparc64/kernel/Makefile +1 -1
index 1bf5b18..459462e 100644

Lines of this file are not shown. View the raw message.

arch/sparc64/kernel/semaphore.c deleted +0 -254

254 lines not on this page · raw message

arch/sparc64/kernel/sparc64_ksyms.c +0 -6
index 51fa773..051b8d9 100644

Lines of this file are not shown. View the raw message.

arch/um/Kconfig.i386 +36 -3
index 3cd8a04..e28b66c 100644

Lines of this file are not shown. View the raw message.

arch/um/Kconfig.x86_64 +3 -3
index 6533b34..9961e52 100644

Lines of this file are not shown. View the raw message.

arch/um/sys-i386/ksyms.c +0 -12
index 2a1eac1..bfbefd3 100644

Lines of this file are not shown. View the raw message.

arch/um/sys-ppc/Makefile +2 -6
index 0890152..b8bc844 100644

Lines of this file are not shown. View the raw message.

arch/um/sys-x86_64/ksyms.c +1 -12
index 12c5936..4d7d1a8 100644

Lines of this file are not shown. View the raw message.

arch/v850/kernel/Makefile +1 -1
index 3930482..da5889c 100644

Lines of this file are not shown. View the raw message.

arch/v850/kernel/semaphore.c deleted +0 -166

166 lines not on this page · raw message

arch/v850/kernel/v850_ksyms.c +0 -7
index 93575fd..8d386a5 100644

Lines of this file are not shown. View the raw message.

arch/x86/Kconfig +0 -7
index 4a88cf7..e975fe7 100644

Lines of this file are not shown. View the raw message.

arch/x86/kernel/i386_ksyms_32.c +0 -5
index 0616278..deb4378 100644

Lines of this file are not shown. View the raw message.

arch/x86/kernel/x8664_ksyms_64.c +0 -6
index a66e9c1..95a993e 100644

Lines of this file are not shown. View the raw message.

arch/x86/lib/semaphore_32.S +0 -83

83 lines not on this page · raw message

arch/x86/lib/thunk_64.S +0 -5
index 8b92d42..e009251 100644

Lines of this file are not shown. View the raw message.

arch/xtensa/kernel/Makefile +1 -1
index f582d6a..7419dbc 100644

Lines of this file are not shown. View the raw message.

arch/xtensa/kernel/semaphore.c deleted +0 -226

226 lines not on this page · raw message

arch/xtensa/kernel/xtensa_ksyms.c +0 -9
index 60dbdb4..6e52cdd 100644

Lines of this file are not shown. View the raw message.

include/asm-alpha/semaphore.h +1 -149

150 lines not on this page · raw message

include/asm-arm/semaphore-helper.h deleted +0 -84

84 lines not on this page · raw message

include/asm-arm/semaphore.h +1 -98

99 lines not on this page · raw message

include/asm-avr32/semaphore.h +1 -108

109 lines not on this page · raw message

include/asm-blackfin/semaphore-helper.h deleted +0 -82

82 lines not on this page · raw message

include/asm-blackfin/semaphore.h +1 -105

106 lines not on this page · raw message

include/asm-cris/semaphore-helper.h deleted +0 -78

78 lines not on this page · raw message

include/asm-cris/semaphore.h +1 -133

134 lines not on this page · raw message

include/asm-frv/semaphore.h +1 -155

156 lines not on this page · raw message

include/asm-h8300/semaphore-helper.h deleted +0 -85

85 lines not on this page · raw message

include/asm-h8300/semaphore.h +1 -190

191 lines not on this page · raw message

include/asm-ia64/semaphore.h +1 -99

100 lines not on this page · raw message

include/asm-m32r/semaphore.h +1 -144

145 lines not on this page · raw message

include/asm-m68k/semaphore-helper.h deleted +0 -142

142 lines not on this page · raw message

include/asm-m68k/semaphore.h +1 -163

164 lines not on this page · raw message

include/asm-m68knommu/semaphore-helper.h deleted +0 -82

82 lines not on this page · raw message

include/asm-m68knommu/semaphore.h +1 -153

154 lines not on this page · raw message

include/asm-mips/semaphore.h +1 -108

109 lines not on this page · raw message

include/asm-mn10300/semaphore.h +1 -169

170 lines not on this page · raw message

include/asm-parisc/semaphore-helper.h deleted +0 -89

89 lines not on this page · raw message

include/asm-parisc/semaphore.h +1 -145

146 lines not on this page · raw message

include/asm-powerpc/semaphore.h +1 -94

95 lines not on this page · raw message

include/asm-s390/semaphore.h +1 -107

108 lines not on this page · raw message

include/asm-sh/semaphore-helper.h deleted +0 -89

89 lines not on this page · raw message

include/asm-sh/semaphore.h +1 -115

116 lines not on this page · raw message

include/asm-sparc/semaphore.h +1 -192

193 lines not on this page · raw message

include/asm-sparc64/semaphore.h +1 -53

54 lines not on this page · raw message

include/asm-um/semaphore.h +1 -6
index ff13c34..d9b2034 100644

Lines of this file are not shown. View the raw message.

include/asm-v850/semaphore.h +1 -84

85 lines not on this page · raw message

include/asm-x86/semaphore.h +1 -5
index 572c0b6..d9b2034 100644

Lines of this file are not shown. View the raw message.

include/asm-x86/semaphore_32.h deleted +0 -175

175 lines not on this page · raw message

include/asm-x86/semaphore_64.h deleted +0 -180

180 lines not on this page · raw message

include/asm-xtensa/semaphore.h +1 -99

100 lines not on this page · raw message

include/linux/semaphore.h new file +81 -0

81 lines not on this page · raw message

kernel/Makefile +1 -1
index 6c584c5..f45c69e 100644

Lines of this file are not shown. View the raw message.

kernel/semaphore.c new file +204 -0

204 lines not on this page · raw message

lib/Makefile +0 -1
index 23de261..28dba90 100644

Lines of this file are not shown. View the raw message.

lib/semaphore-sleepers.c deleted +0 -176

176 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.5.4.1

Part of the diff is not shown here. View the raw message.

#12 lore raw

PATCH 12/12 Convert asm/semaphore.h users to linux/semaphore.h

Also deprecate the asm/semaphore.h files in feature-removal-schedule.

---
 Documentation/DocBook/kernel-locking.tmpl  |    6 +++---
 Documentation/feature-removal-schedule.txt |    8 ++++++++
 arch/ia64/kernel/salinfo.c                 |    2 +-
 drivers/base/core.c                        |    2 +-
 drivers/char/snsc.h                        |    2 +-
 drivers/char/xilinx_hwicap/xilinx_hwicap.c |    2 +-
 drivers/firewire/fw-device.c               |    2 +-
 drivers/i2c/i2c-core.c                     |    2 +-
 drivers/ieee1394/nodemgr.c                 |    2 +-
 drivers/infiniband/core/user_mad.c         |    2 +-
 drivers/infiniband/hw/mthca/mthca_dev.h    |    3 +--
 drivers/input/serio/hp_sdc_mlc.c           |    2 +-
 drivers/macintosh/adb.c                    |    2 +-
 drivers/macintosh/windfarm_smu_sat.c       |    2 +-
 drivers/net/3c527.c                        |    2 +-
 drivers/net/hamradio/6pack.c               |    2 +-
 drivers/s390/cio/qdio.c                    |    2 +-
 drivers/scsi/aacraid/commctrl.c            |    2 +-
 drivers/scsi/aacraid/commsup.c             |    2 +-
 drivers/scsi/aacraid/dpcsup.c              |    2 +-
 drivers/scsi/megaraid/megaraid_ioctl.h     |    2 +-
 drivers/scsi/qla2xxx/qla_def.h             |    2 +-
 drivers/watchdog/sc1200wdt.c               |    2 +-
 fs/jffs2/jffs2_fs_i.h                      |    2 +-
 fs/jffs2/jffs2_fs_sb.h                     |    2 +-
 fs/reiserfs/journal.c                      |    2 +-
 fs/xfs/linux-2.6/sema.h                    |    2 +-
 include/linux/device.h                     |    2 +-
 include/linux/fs.h                         |    2 +-
 include/linux/hil_mlc.h                    |    2 +-
 include/linux/i2o.h                        |    2 +-
 include/linux/memory.h                     |    3 +--
 include/linux/parport.h                    |    2 +-
 lib/kernel_lock.c                          |    2 +-
 net/tipc/socket.c                          |    2 +-
 35 files changed, 44 insertions(+), 38 deletions(-)
Documentation/DocBook/kernel-locking.tmpl +3 -3
index 2e9d6b4..b1ab442 100644
@@ -241,7 +241,7 @@
    </para>
    <para>
      The third type is a semaphore
-     (<filename class="headerfile">include/asm/semaphore.h</filename>): it
+     (<filename class="headerfile">include/linux/semaphore.h</filename>): it
      can have more than one holder at any time (the number decided at
      initialization time), although it is most commonly used as a
      single-holder lock (a mutex).  If you can't get a semaphore, your
@@ -290,7 +290,7 @@
      <para>
        If you have a data structure which is only ever accessed from
        user context, then you can use a simple semaphore
-       (<filename>linux/asm/semaphore.h</filename>) to protect it.  This 
+       (<filename>linux/linux/semaphore.h</filename>) to protect it.  This 
        is the most trivial case: you initialize the semaphore to the number 
        of resources available (usually 1), and call
        <function>down_interruptible()</function> to grab the semaphore, and 
@@ -1656,7 +1656,7 @@ the amount of locking which needs to be done.
  #include &lt;linux/slab.h&gt;
  #include &lt;linux/string.h&gt;
 +#include &lt;linux/rcupdate.h&gt;
- #include &lt;asm/semaphore.h&gt;
+ #include &lt;linux/semaphore.h&gt;
  #include &lt;asm/errno.h&gt;
 
  struct object
Documentation/feature-removal-schedule.txt +8 -0
index 4d3aa51..c43cba9 100644
@@ -306,3 +306,11 @@ Why:	Largely unmaintained and almost entirely unused.  File system
 	is largely pointless as without a lot of work only the most
 	trivial of Solaris binaries can work with the emulation code.
 Who:	David S. Miller <[email protected]>
+
+---------------------------
+
+What:	asm/semaphore.h
+When:	2.6.26
+Why:	Implementation became generic; users should now include
+	linux/semaphore.h instead.
+Who:	Matthew Wilcox <[email protected]>
arch/ia64/kernel/salinfo.c +1 -1
index 779c3cc..b11bb50 100644
@@ -44,8 +44,8 @@
 #include <linux/smp.h>
 #include <linux/timer.h>
 #include <linux/vmalloc.h>
+#include <linux/semaphore.h>
 
-#include <asm/semaphore.h>
 #include <asm/sal.h>
 #include <asm/uaccess.h>
 
drivers/base/core.c +1 -1
index 9c0070b..1a37406 100644
@@ -19,7 +19,7 @@
 #include <linux/kdev_t.h>
 #include <linux/notifier.h>
 #include <linux/genhd.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 
 #include "base.h"
 #include "power/power.h"
drivers/char/snsc.h +1 -1
index 8a98169..4be62ed 100644
@@ -22,8 +22,8 @@
 #include <linux/kobject.h>
 #include <linux/fs.h>
 #include <linux/cdev.h>
+#include <linux/semaphore.h>
 #include <asm/sn/types.h>
-#include <asm/semaphore.h>
 
 #define CHUNKSIZE 127
 
drivers/char/xilinx_hwicap/xilinx_hwicap.c +1 -1
index 24f6aef..68df07f 100644
@@ -84,7 +84,7 @@
 #include <linux/init.h>
 #include <linux/poll.h>
 #include <linux/proc_fs.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 #include <linux/sysctl.h>
 #include <linux/version.h>
 #include <linux/fs.h>
drivers/firewire/fw-device.c +1 -1
index 2ab13e0..79fb504 100644
@@ -26,7 +26,7 @@
 #include <linux/delay.h>
 #include <linux/idr.h>
 #include <linux/rwsem.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 #include <asm/system.h>
 #include <linux/ctype.h>
 #include "fw-transaction.h"
drivers/i2c/i2c-core.c +1 -1
index 96da22e..d8de1b0 100644
@@ -35,8 +35,8 @@
 #include <linux/completion.h>
 #include <linux/hardirq.h>
 #include <linux/irqflags.h>
+#include <linux/semaphore.h>
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 
 #include "i2c-core.h"
 
drivers/ieee1394/nodemgr.c +1 -1
index 511e432..a6183e5 100644
@@ -18,8 +18,8 @@
 #include <linux/moduleparam.h>
 #include <linux/mutex.h>
 #include <linux/freezer.h>
+#include <linux/semaphore.h>
 #include <asm/atomic.h>
-#include <asm/semaphore.h>
 
 #include "csr.h"
 #include "highlevel.h"
drivers/infiniband/core/user_mad.c +1 -1
index 4e91510..be953e8 100644
@@ -46,9 +46,9 @@
 #include <linux/mutex.h>
 #include <linux/kref.h>
 #include <linux/compat.h>
+#include <linux/semaphore.h>
 
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 
 #include <rdma/ib_mad.h>
 #include <rdma/ib_user_mad.h>
drivers/infiniband/hw/mthca/mthca_dev.h +1 -2
index 7bbdd1f..ad8861a 100644
@@ -46,8 +46,7 @@
 #include <linux/timer.h>
 #include <linux/mutex.h>
 #include <linux/list.h>
-
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 
 #include "mthca_provider.h"
 #include "mthca_doorbell.h"
drivers/input/serio/hp_sdc_mlc.c +1 -1
index c45ea74..f1fd3b6 100644
@@ -40,7 +40,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/string.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 
 #define PREFIX "HP SDC MLC: "
 
drivers/macintosh/adb.c +1 -1
index 2895810..2097820 100644
@@ -37,9 +37,9 @@
 #include <linux/device.h>
 #include <linux/kthread.h>
 #include <linux/platform_device.h>
+#include <linux/semaphore.h>
 
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 #ifdef CONFIG_PPC
 #include <asm/prom.h>
 #include <asm/machdep.h>
drivers/macintosh/windfarm_smu_sat.c +1 -1
index f449d77..797918d 100644
@@ -13,7 +13,7 @@
 #include <linux/init.h>
 #include <linux/wait.h>
 #include <linux/i2c.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 #include <asm/prom.h>
 #include <asm/smu.h>
 #include <asm/pmac_low_i2c.h>
drivers/net/3c527.c +1 -1
index b72b89d..fae295b 100644
@@ -103,8 +103,8 @@ DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " Richard Procter <[email protected].
 #include <linux/ethtool.h>
 #include <linux/completion.h>
 #include <linux/bitops.h>
+#include <linux/semaphore.h>
 
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 #include <asm/system.h>
 #include <asm/io.h>
drivers/net/hamradio/6pack.c +1 -1
index 0a9b751..1da55dd 100644
@@ -33,7 +33,7 @@
 #include <linux/init.h>
 #include <linux/ip.h>
 #include <linux/tcp.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 #include <asm/atomic.h>
 
 #define SIXPACK_VERSION    "Revision: 0.3.0"
drivers/s390/cio/qdio.c +1 -1
index 2b5bfb7..9a85422 100644
@@ -38,11 +38,11 @@
 #include <linux/proc_fs.h>
 #include <linux/timer.h>
 #include <linux/mempool.h>
+#include <linux/semaphore.h>
 
 #include <asm/ccwdev.h>
 #include <asm/io.h>
 #include <asm/atomic.h>
-#include <asm/semaphore.h>
 #include <asm/timex.h>
 
 #include <asm/debug.h>
drivers/scsi/aacraid/commctrl.c +1 -1
index abef051..5fd83de 100644
@@ -39,7 +39,7 @@
 #include <linux/blkdev.h>
 #include <linux/delay.h> /* ssleep prototype */
 #include <linux/kthread.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 #include <asm/uaccess.h>
 
 #include "aacraid.h"
drivers/scsi/aacraid/commsup.c +1 -1
index 4743449..3753835 100644
@@ -41,11 +41,11 @@
 #include <linux/delay.h>
 #include <linux/kthread.h>
 #include <linux/interrupt.h>
+#include <linux/semaphore.h>
 #include <scsi/scsi.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_cmnd.h>
-#include <asm/semaphore.h>
 
 #include "aacraid.h"
 
drivers/scsi/aacraid/dpcsup.c +1 -1
index d1163de..933f208 100644
@@ -36,7 +36,7 @@
 #include <linux/slab.h>
 #include <linux/completion.h>
 #include <linux/blkdev.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 
 #include "aacraid.h"
 
drivers/scsi/megaraid/megaraid_ioctl.h +1 -1
index 706fa05..05f6e4e 100644
@@ -18,7 +18,7 @@
 #define _MEGARAID_IOCTL_H_
 
 #include <linux/types.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 
 #include "mbox_defs.h"
 
drivers/scsi/qla2xxx/qla_def.h +1 -1
index 3750319..97aa48d 100644
@@ -24,7 +24,7 @@
 #include <linux/workqueue.h>
 #include <linux/firmware.h>
 #include <linux/aer.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_host.h>
drivers/watchdog/sc1200wdt.c +1 -1
index 32ccd7c..35cddff 100644
@@ -38,8 +38,8 @@
 #include <linux/init.h>
 #include <linux/pnp.h>
 #include <linux/fs.h>
+#include <linux/semaphore.h>
 
-#include <asm/semaphore.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
 
fs/jffs2/jffs2_fs_i.h +1 -1
index 0b78fdc..a841f49 100644
@@ -15,7 +15,7 @@
 #include <linux/version.h>
 #include <linux/rbtree.h>
 #include <linux/posix_acl.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 
 struct jffs2_inode_info {
 	/* We need an internal mutex similar to inode->i_mutex.
fs/jffs2/jffs2_fs_sb.h +1 -1
index 3a2197f..18fca2b 100644
@@ -16,7 +16,7 @@
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
 #include <linux/completion.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 #include <linux/timer.h>
 #include <linux/wait.h>
 #include <linux/list.h>
fs/reiserfs/journal.c +1 -1
index bb05a3e..060eb3f 100644
@@ -38,7 +38,7 @@
 #include <asm/system.h>
 
 #include <linux/time.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 
 #include <linux/vmalloc.h>
 #include <linux/reiserfs_fs.h>
fs/xfs/linux-2.6/sema.h +1 -1
index 2009e6d..3abe7e9 100644
@@ -20,8 +20,8 @@
 
 #include <linux/time.h>
 #include <linux/wait.h>
+#include <linux/semaphore.h>
 #include <asm/atomic.h>
-#include <asm/semaphore.h>
 
 /*
  * sema_t structure just maps to struct semaphore in Linux kernel.
include/linux/device.h +1 -1
index 2258d89..c79b93e 100644
@@ -20,7 +20,7 @@
 #include <linux/types.h>
 #include <linux/module.h>
 #include <linux/pm.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 #include <asm/atomic.h>
 #include <asm/device.h>
 
include/linux/fs.h +1 -1
index b84b848..91e8dec 100644
@@ -287,9 +287,9 @@ extern int dir_notify_enable;
 #include <linux/pid.h>
 #include <linux/mutex.h>
 #include <linux/capability.h>
+#include <linux/semaphore.h>
 
 #include <asm/atomic.h>
-#include <asm/semaphore.h>
 #include <asm/byteorder.h>
 
 struct export_operations;
include/linux/hil_mlc.h +1 -1
index 8df29ca..394a840 100644
@@ -34,7 +34,7 @@
 #include <linux/hil.h>
 #include <linux/time.h>
 #include <linux/interrupt.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 #include <linux/serio.h>
 #include <linux/list.h>
 
include/linux/i2o.h +1 -1
index 7da5b98..e92170d 100644
@@ -33,9 +33,9 @@
 #include <linux/mempool.h>
 #include <linux/mutex.h>
 #include <linux/scatterlist.h>
+#include <linux/semaphore.h>	/* Needed for MUTEX init macros */
 
 #include <asm/io.h>
-#include <asm/semaphore.h>	/* Needed for MUTEX init macros */
 
 /* message queue empty */
 #define I2O_QUEUE_EMPTY		0xffffffff
include/linux/memory.h +1 -2
index 33f0ff0..54d7866 100644
@@ -18,8 +18,7 @@
 #include <linux/sysdev.h>
 #include <linux/node.h>
 #include <linux/compiler.h>
-
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 
 struct memory_block {
 	unsigned long phys_index;
include/linux/parport.h +1 -1
index d1ad546..dcb9e01 100644
@@ -101,9 +101,9 @@ typedef enum {
 #include <linux/spinlock.h>
 #include <linux/wait.h>
 #include <linux/irqreturn.h>
+#include <linux/semaphore.h>
 #include <asm/system.h>
 #include <asm/ptrace.h>
-#include <asm/semaphore.h>
 
 /* Define this later. */
 struct parport;
lib/kernel_lock.c +1 -1
index fbc11a3..cd3e825 100644
@@ -8,7 +8,7 @@
 #include <linux/smp_lock.h>
 #include <linux/module.h>
 #include <linux/kallsyms.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 
 /*
  * The 'big kernel semaphore'
net/tipc/socket.c +1 -1
index 2290903..6e3f0d3 100644
@@ -43,7 +43,7 @@
 #include <linux/slab.h>
 #include <linux/poll.h>
 #include <linux/fcntl.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
 #include <asm/string.h>
 #include <asm/atomic.h>
 #include <net/sock.h>
Signature · 1 line
1.5.4.1
#14 lore raw

Re: [PATCH 11/12] Generic semaphore implementation

Quoted 3 lines · Ingo Molnar

very nice work!

Thanks!

Stephen, I've put the semaphore patches into a git tree; can you add it to linux-next?

http://git.kernel.org/?p=linux/kernel/git/willy/misc.git;a=shortlog;h=semaphore

Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
#15 lore raw

Re: [PATCH 11/12] Generic semaphore implementation

Quoted 12 lines · Matthew Wilcox
Quoted 3 lines · Ingo Molnar

very nice work!

Thanks!

Stephen, I've put the semaphore patches into a git tree; can you add it to linux-next?

http://git.kernel.org/?p=linux/kernel/git/willy/misc.git;a=shortlog;h=semaphore

The gitweb links aren't so useful for people to grab your tree, the format usually preferred is <url> <branchname>

ie:
git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc.git semaphore

Cheers,

Harvey

maintainer
#16 lore raw

Re: [PATCH 11/12] Generic semaphore implementation

In reply to Matthew Wilcox
Quoted 12 lines · On Thu, 28 Feb 2008 17:39:54 -0700 Matthew Wilcox <[email protected]> wrote:
Quoted 3 lines · Ingo Molnar

very nice work!

Thanks!

Stephen, I've put the semaphore patches into a git tree; can you add it to linux-next?

http://git.kernel.org/?p=linux/kernel/git/willy/misc.git;a=shortlog;h=semaphore

err, we'd better tell the arch maintainers than we just deleted all their sempahore code.

edited list:

 arch/alpha/kernel/semaphore.c                    |  224 --------------------
 arch/arm/kernel/semaphore.c                      |  221 --------------------
 arch/avr32/kernel/semaphore.c                    |  148 -------------
 arch/cris/kernel/semaphore.c                     |  129 -----------
 arch/frv/kernel/semaphore.c                      |  155 --------------
 arch/h8300/kernel/semaphore.c                    |  132 -----------
 arch/ia64/kernel/semaphore.c                     |  165 --------------
 arch/m32r/kernel/semaphore.c                     |  185 ----------------
 arch/m68k/kernel/semaphore.c                     |  132 -----------
 arch/m68k/lib/semaphore.S                        |   53 ----
 arch/m68knommu/kernel/semaphore.c                |  133 ------------
 arch/m68knommu/lib/semaphore.S                   |   66 -----
 arch/mips/kernel/semaphore.c                     |  168 ---------------
 arch/mn10300/kernel/semaphore.c                  |  149 -------------
 arch/parisc/kernel/semaphore.c                   |  102 ---------
 arch/powerpc/kernel/semaphore.c                  |  135 ------------
 arch/ppc/kernel/semaphore.c                      |  131 -----------
 arch/s390/kernel/semaphore.c                     |  108 ---------
 arch/sh/kernel/semaphore.c                       |  139 ------------
 arch/sparc/kernel/semaphore.c                    |  155 --------------
 arch/sparc64/kernel/semaphore.c                  |  254 -----------------------
 arch/v850/kernel/semaphore.c                     |  166 ---------------
 arch/xtensa/kernel/semaphore.c                   |  226 --------------------
 b/arch/x86/lib/semaphore_32.S                    |   83 -------
 b/include/asm-alpha/semaphore.h                  |  150 -------------
 b/include/asm-arm/semaphore.h                    |   99 --------
 b/include/asm-avr32/semaphore.h                  |  109 ---------
 b/include/asm-blackfin/semaphore.h               |  106 ---------
 b/include/asm-cris/semaphore.h                   |  134 ------------
 b/include/asm-frv/semaphore.h                    |  156 --------------
 b/include/asm-h8300/semaphore.h                  |  191 -----------------
 b/include/asm-ia64/semaphore.h                   |  100 ---------
 b/include/asm-m32r/semaphore.h                   |  145 -------------
 b/include/asm-m68k/semaphore.h                   |  164 --------------
 b/include/asm-m68knommu/semaphore.h              |  154 -------------
 b/include/asm-mips/semaphore.h                   |  109 ---------
 b/include/asm-mn10300/semaphore.h                |  170 ---------------
 b/include/asm-parisc/semaphore.h                 |  146 -------------
 b/include/asm-powerpc/semaphore.h                |   95 --------
 b/include/asm-s390/semaphore.h                   |  108 ---------
 b/include/asm-sh/semaphore.h                     |  116 ----------
 b/include/asm-sparc/semaphore.h                  |  193 -----------------
 b/include/asm-sparc64/semaphore.h                |   54 ----
 b/include/asm-v850/semaphore.h                   |   85 -------
 b/include/asm-xtensa/semaphore.h                 |  100 ---------
 b/include/linux/semaphore.h                      |   81 +++++++
 b/kernel/semaphore.c                             |  204 ++++++++++++++++++
 include/asm-arm/semaphore-helper.h               |   84 -------
 include/asm-blackfin/semaphore-helper.h          |   82 -------
 include/asm-cris/semaphore-helper.h              |   78 -------
 include/asm-h8300/semaphore-helper.h             |   85 -------
 include/asm-m68k/semaphore-helper.h              |  142 ------------
 include/asm-m68knommu/semaphore-helper.h         |   82 -------
 include/asm-parisc/semaphore-helper.h            |   89 --------
 include/asm-sh/semaphore-helper.h                |   89 --------
 include/asm-x86/semaphore_32.h                   |  175 ---------------
 include/asm-x86/semaphore_64.h                   |  180 ----------------
 lib/semaphore-sleepers.c                         |  176 ---------------

yummy summary:

 254 files changed, 386 insertions(+), 7827 deletions(-)

The only major conflict is with avr32 which seems to have just done a major revamp of that architecture's semaphore implementation. Oh well.

There are a couple of small #include rejects here and there, nothing at all major.

Yes, let's get this into linux-next if poss please. If mainline later breaks for some architecture, well, we did our best..

#17 lore raw

Re: [PATCH 11/12] Generic semaphore implementation

Quoted 2 lines · Andrew Morton

err, we'd better tell the arch maintainers than we just deleted all their sempahore code.

^^ I'm so glad it's not just me who makes that typo. I actually
grepped for it before sending the patches out.

I did already send it to linux-arch back in January or so. But a reminder won't hurt.

Quoted 3 lines

yummy summary:

 254 files changed, 386 insertions(+), 7827 deletions(-)

Yeah, that's quite attractive ;-)

Quoted 2 lines

Yes, let's get this into linux-next if poss please. If mainline later breaks for some architecture, well, we did our best..

It _should_ only be build breakage. I guess we'll see.

Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
#18 lore raw

Re: [PATCH 11/12] Generic semaphore implementation

In reply to Andrew Morton
Quoted 2 lines · On Thu, 28 Feb 2008 17:43:49 -0800 Andrew Morton <[email protected]>…

The only major conflict is with avr32 which seems to have just done a major revamp of that architecture's semaphore implementation. Oh well.

Not anymore. It was a pure spaces-to-tabs conversion, so I dropped it.

Haavard

#19 lore raw

Re: [PATCH 11/12] Generic semaphore implementation

In reply to Andrew Morton
Quoted 8 lines · Andrew Morton

yummy summary:

 254 files changed, 386 insertions(+), 7827 deletions(-)

The only major conflict is with avr32 which seems to have just done a major revamp of that architecture's semaphore implementation. Oh well.

Quoted 5 lines

There are a couple of small #include rejects here and there, nothing at all major.

Yes, let's get this into linux-next if poss please. If mainline later breaks for some architecture, well, we did our best..

a better approach would be to send the core bits to Linus right now - as long as it's Kconfig isolated and inactive code - hence it is eligible as a cleanup.

That means arch maintainers could start applying the patches at their own pace, starting right now, in their own work-flow and test-flow. (obviously, the first such patches would hit mainline starting in the next merge window)

And all the linux-next integration trouble down the line is avoided, and each architecture can do a concentrated effort of: 'get rid of semaphore code'.

Please!

Ingo

#20 lore raw

Re: [PATCH 11/12] Generic semaphore implementation

In reply to Matthew Wilcox
Quoted 5 lines · On Thu, 28 Feb 2008 17:39:54 -0700 Matthew Wilcox <[email protected]> wrote:

Stephen, I've put the semaphore patches into a git tree; can you add it to linux-next?

http://git.kernel.org/?p=linux/kernel/git/willy/misc.git;a=shortlog;h=semaphore

I have put this in for toady's build (but using the git URL). This tree is in the "too many conflicts and its out until fixed" category ... However, it is also a candidate for Linus' "next" branch (if he is going to run one ...).

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
maintainer
#21 lore raw

Re: [PATCH 11/12] Generic semaphore implementation

Quoted 9 lines · On Fri, 29 Feb 2008 13:00:19 +1100 Stephen Rothwell <[email protected]>…
Quoted 5 lines · On Thu, 28 Feb 2008 17:39:54 -0700 Matthew Wilcox <[email protected]> wrote:

Stephen, I've put the semaphore patches into a git tree; can you add it to linux-next?

http://git.kernel.org/?p=linux/kernel/git/willy/misc.git;a=shortlog;h=semaphore

I have put this in for toady's build (but using the git URL). This tree is in the "too many conflicts and its out until fixed" category ...

A shame.

Most of the conflicts will be due to all the

-#include <asm/semaphore.h>
+#include <linux/semaphore.h>

but they're all optional anyway, because include/asm-*/semaphore.h is

#include <linux/semaphore.h>

so either a) you just ignore all those conflicts or b) we ask Willy to remove all that stuff and we can trickle it in via subsystems later.

#22 lore raw

Re: [PATCH 11/12] Generic semaphore implementation

Quoted 11 lines · Andrew Morton

Most of the conflicts will be due to all the

(quoted diff) +1 -1
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>

but they're all optional anyway, because include/asm-*/semaphore.h is

#include <linux/semaphore.h>

so either a) you just ignore all those conflicts or b) we ask Willy to remove all that stuff and we can trickle it in via subsystems later.

Yeah, we can trickle that in later. Fine by me.

I think rather more conflict is likely with the 105 files where I just removed the asm/semaphore.h include. I'd like it if we could get Linus to merge those at this stage. Since it passes an x86 allmodconfig build, I'd like to think the breakage would be minimal.

Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
#23 lore raw

Re: [PATCH 11/12] Generic semaphore implementation

In reply to Andrew Morton
Quoted 11 lines · On Thu, 28 Feb 2008 18:10:54 -0800 Andrew Morton <[email protected]>…
Quoted 3 lines

I have put this in for toady's build (but using the git URL). This tree is in the "too many conflicts and its out until fixed" category ...

A shame.

Most of the conflicts will be due to all the

(quoted diff) +1 -1
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
Quoted 6 lines

but they're all optional anyway, because include/asm-*/semaphore.h is

#include <linux/semaphore.h>

so either a) you just ignore all those conflicts or b) we ask Willy to remove all that stuff and we can trickle it in via subsystems later.

My conflict tolerance is already rising. i.e. I will fix up such trivial to fix conflicts. I am more concerned with complexity of conflicts than mere number (so "too many conflicts" should be read as "too many conflicts that I can't figure out in a shortish period of time").

If it gets too bad, it falls into Linus' "the person who changes the APIs bears the pain" basket. :-)

Signature · 2 lines
Cheers,
Stephen Rothwell                    [email protected]
#24 lore raw

Re: [PATCH 11/12] Generic semaphore implementation

In reply to Stephen Rothwell
Quoted 6 lines · Stephen Rothwell
Quoted 4 lines · On Thu, 28 Feb 2008 17:39:54 -0700 Matthew Wilcox <[email protected]> wrote:

Stephen, I've put the semaphore patches into a git tree; can you add it to linux-next?

Quoted 6 lines
Quoted 1 line

http://git.kernel.org/?p=linux/kernel/git/willy/misc.git;a=shortlog;h=semaphore

I have put this in for toady's build (but using the git URL). This tree is in the "too many conflicts and its out until fixed" category ... However, it is also a candidate for Linus' "next" branch (if he is going to run one ...).

I'm not going to do a "next" branch just for stupid syntactic merge errors that are trivially fixed due to some include-file moving. If submaintainers can fix it up trivially, it's really not worth it.

Linus

maintainer
#25 lore raw

Re: [PATCH 11/12] Generic semaphore implementation

In reply to Matthew Wilcox
Quoted 4 lines · On Thu, 28 Feb 2008 01:34:00 -0500 Matthew Wilcox <[email protected]> wrote:

Semaphores are no longer performance-critical, so a generic C implementation is better for maintainability, debuggability and extensibility.

This make all architectures use the lib/semaphore-sleepers.c implementation. The major difference is that down() and up() will now unconditionally do a spin_lock_irq[save]() on the not-contended fastpath, whereas the hand-optimised arch-specific implementations would avoid that.

Yes, hopefully not many sempahores are used on fastpaths any more, and a suitable fix for any which _are_ so used is usually convert-to-mutex.

And spin_lock_irqsave() probably isn't hugely slower than an atomic-dec anyway.

A few nits, most or all of which pertain to the old code:

Quoted 31 lines
kernel/semaphore.c new file +28 -0
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2008 Intel Corporation
+ * Author: Matthew Wilcox <[email protected]>
+ *
+ * Distributed under the terms of the GNU GPL, version 2
+ */
+
+#include <linux/compiler.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/semaphore.h>
+#include <linux/spinlock.h>
+
+/*
+ * Some notes on the implementation:
+ *
+ * down_trylock() and up() can be called from interrupt context.
+ * So we have to disable interrupts when taking the lock.
+ *
+ * The ->count variable, if positive, defines how many more tasks can
+ * acquire the semaphore.  If negative, it represents how many tasks are
+ * waiting on the semaphore (*).  If zero, no tasks are waiting, and no more
+ * tasks can acquire the semaphore.
+ *
+ * (*) Except for the window between one task calling up() and the task
+ * sleeping in a __down_common() waking up.  In order to avoid a third task
+ * coming in and stealing the second task's wakeup, we leave the ->count

kernel/semaphore.c line 38

Quoted 10 lines
kernel/semaphore.c new file +10 -0
+ * negative.  If we have a more complex situation, the ->count may become
+ * zero or negative (eg a semaphore with count = 2, three tasks attempt to
+ * acquire it, one sleeps, two finish and call up(), the second task to call
+ * up() notices that the list is empty and just increments count).
+ */
+
+static void noinline __down(struct semaphore *sem);
+static int noinline __down_interruptible(struct semaphore *sem);
+static int noinline __down_killable(struct semaphore *sem);
+static void noinline __up(struct semaphore *sem);

We conventionally do static inline void' rather than static void inline', so I guess we should do `static noinline void' too.

kernel/semaphore.c line 60

Quoted 11 lines
kernel/semaphore.c new file +11 -0
+int down_interruptible(struct semaphore *sem)
+{
+	int result = 0;
+	might_sleep();
+	spin_lock_irq(&sem->lock);
+	if (unlikely(sem->count-- <= 0))
+		result = __down_interruptible(sem);
+	spin_unlock_irq(&sem->lock);
+	return result;
+}
+EXPORT_SYMBOL(down_interruptible);

Some functions leave no blank line between end-of-locals and start-of-code...

Quoted 28 lines
kernel/semaphore.c new file +28 -0
+int down_killable(struct semaphore *sem)
+{
+	int result = 0;
+	might_sleep();
+	spin_lock_irq(&sem->lock);
+	if (unlikely(sem->count-- <= 0))
+		result = __down_killable(sem);
+	spin_unlock_irq(&sem->lock);
+	return result;
+}
+EXPORT_SYMBOL(down_killable);
+
+/**
+ * down_trylock - try to acquire the semaphore, without waiting
+ * @sem: the semaphore to be acquired
+ *
+ * Try to acquire the semaphore atomically.  Returns 0 if the mutex has
+ * been acquired successfully and 1 if it is contended.
+ *
+ * NOTE: This return value is inverted from both spin_trylock and
+ * mutex_trylock!  Be careful about this when converting code.
+ *
+ * Unlike mutex_trylock, this function can be used from interrupt context,
+ * and the semaphore can be released by any task or interrupt.
+ */
+int down_trylock(struct semaphore *sem)
+{
+	unsigned long flags;

kernel/semaphore.c line 99

Quoted 10 lines
kernel/semaphore.c new file +10 -0
+	int count;
+
+	spin_lock_irqsave(&sem->lock, flags);
+	count = sem->count - 1;
+	if (likely(count >= 0))
+		sem->count = count;
+	spin_unlock_irqrestore(&sem->lock, flags);
+	return (count < 0);
+}
+EXPORT_SYMBOL(down_trylock);

whereas some others do leave a blank line.

I think the 51% consensus is that the latter form is preferred.

Quoted 24 lines
kernel/semaphore.c new file +24 -0
+void up(struct semaphore *sem)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&sem->lock, flags);
+	if (likely(sem->count >= 0))
+		sem->count++;
+	else
+		__up(sem);
+	spin_unlock_irqrestore(&sem->lock, flags);
+}
+EXPORT_SYMBOL(up);
+
+/* Functions for the contended case */
+
+struct semaphore_waiter {
+	struct list_head list;
+	struct task_struct *task;
+	int up;
+};
+
+/*
+ * Wake up a process waiting on a semaphore.  We need to call this from both
+ * __up and __down_common as it's possible to race a task into the semaphore

kernel/semaphore.c line 134

Quoted 10 lines
kernel/semaphore.c new file +10 -0
+ * if it comes in at just the right time between two tasks calling up() and
+ * a third task waking up.  This function assumes the wait_list is already
+ * checked for being non-empty.
+ */
+static void noinline __sched __up_down_common(struct semaphore *sem)
+{
+	struct semaphore_waiter *waiter = list_first_entry(&sem->wait_list,
+						struct semaphore_waiter, list);
+	list_del(&waiter->list);
+	waiter->up = 1;

hm. Do we need a barrier here?

Quoted 37 lines
kernel/semaphore.c new file +37 -0
+	wake_up_process(waiter->task);
+}
+
+/*
+ * Because this function is inlined, the 'state' parameter will be constant,
+ * and thus optimised away by the compiler.
+ */
+static inline int __sched __down_common(struct semaphore *sem, long state)
+{
+	int result = 0;
+	struct task_struct *task = current;
+	struct semaphore_waiter waiter;
+
+	list_add_tail(&waiter.list, &sem->wait_list);
+	waiter.task = task;
+	waiter.up = 0;
+
+	for (;;) {
+		if (unlikely((state == TASK_INTERRUPTIBLE &&
+					signal_pending(task)) ||
+			     (state == TASK_KILLABLE &&
+					fatal_signal_pending(task))))
+			goto interrupted;
+		__set_task_state(task, state);
+		spin_unlock_irq(&sem->lock);
+		schedule();
+		spin_lock_irq(&sem->lock);
+		if (waiter.up)
+			goto woken;
+	}
+
+ interrupted:
+	list_del(&waiter.list);
+	result = -EINTR;
+ woken:
+	/*
+	 * Account for the process which woke us up.  For the case where

kernel/semaphore.c line 181

Quoted 10 lines
kernel/semaphore.c new file +10 -0
+	 * we're interrupted, we need to increment the count on our own
+	 * behalf.  I don't believe we can hit the case where the
+	 * sem->count hits zero, *and* there's a second task sleeping,
+	 * but it doesn't hurt, that's not a commonly exercised path and
+	 * it's not a performance path either.
+	 */
+	if (unlikely((++sem->count >= 0) && !list_empty(&sem->wait_list)))
+		__up_down_common(sem);
+	return result;
+}

That is one huuuuuuuge inline. Are we sure it's justified?

Quoted 23 lines
kernel/semaphore.c new file +22 -0
+static void noinline __sched __down(struct semaphore *sem)
+{
+	__down_common(sem, TASK_UNINTERRUPTIBLE);
+}
+
+static int noinline __sched __down_interruptible(struct semaphore *sem)
+{
+	return __down_common(sem, TASK_INTERRUPTIBLE);
+}
+
+static int noinline __sched __down_killable(struct semaphore *sem)
+{
+	return __down_common(sem, TASK_KILLABLE);
+}
+
+static void noinline __sched __up(struct semaphore *sem)
+{
+	if (unlikely(list_empty(&sem->wait_list)))
+		sem->count++;
+	else
+		__up_down_common(sem);
+}

Please read the FAQ at http://www.tux.org/lkml/

#26 lore raw

Re: [PATCH 11/12] Generic semaphore implementation

Quoted 2 lines · Andrew Morton

This make all architectures use the lib/semaphore-sleepers.c implementation.

It's slightly different -- I didn't use any existing semaphore implementation for inspiration (though I did write the parisc one, so I couldn't help but be influenced). I was much more influenced by mutex.c. After I'd posted it the first time, dhowells pointed out it was essentially the same as FRV's implementation.

Quoted 9 lines

The major difference is that down() and up() will now unconditionally do a spin_lock_irq[save]() on the not-contended fastpath, whereas the hand-optimised arch-specific implementations would avoid that.

Yes, hopefully not many sempahores are used on fastpaths any more, and a suitable fix for any which _are_ so used is usually convert-to-mutex.

And spin_lock_irqsave() probably isn't hugely slower than an atomic-dec anyway.

As always, the major cost is getting the cacheline exclusive on this CPU. I'd be surprised if you can measure the difference.

Quoted 1 line

A few nits, most or all of which pertain to the old code:

Thanks for the review.

Quoted 7 lines

kernel/semaphore.c line 38

Quoted 4 lines
kernel/semaphore.c new file +4 -0
+static void noinline __down(struct semaphore *sem);
+static int noinline __down_interruptible(struct semaphore *sem);
+static int noinline __down_killable(struct semaphore *sem);
+static void noinline __up(struct semaphore *sem);

We conventionally do static inline void' rather than static void inline', so I guess we should do `static noinline void' too.

I can change that. I'll modify the git tree, unless anyone has any complaints. We should fix mutex.c at the same time:

static void noinline __sched
__mutex_lock_slowpath(atomic_t *lock_count);

Quoted 5 lines
Quoted 5 lines
kernel/semaphore.c new file +5 -0
+int down_interruptible(struct semaphore *sem)
+{
+	int result = 0;
+	might_sleep();
+	spin_lock_irq(&sem->lock);
Quoted 8 lines

kernel/semaphore.c line 60

Quoted 6 lines
kernel/semaphore.c new file +6 -0
+	if (unlikely(sem->count-- <= 0))
+		result = __down_interruptible(sem);
+	spin_unlock_irq(&sem->lock);
+	return result;
+}
+EXPORT_SYMBOL(down_interruptible);

Some functions leave no blank line between end-of-locals and start-of-code...

It's not something I feel strongly about ;-)

Quoted 3 lines

whereas some others do leave a blank line.

I think the 51% consensus is that the latter form is preferred.

Fine.

Quoted 8 lines

kernel/semaphore.c line 134

Quoted 6 lines
kernel/semaphore.c new file +6 -0
+static void noinline __sched __up_down_common(struct semaphore *sem)
+{
+	struct semaphore_waiter *waiter = list_first_entry(&sem->wait_list,
+						struct semaphore_waiter, list);
+	list_del(&waiter->list);
+	waiter->up = 1;

hm. Do we need a barrier here?

__up_down_common is always called while holding the spinlock. The spinlock is acquired by the waiter before it checks the flag. If there's a race here, I question the value of spinlocks at all.

Quoted 8 lines

kernel/semaphore.c line 141

Quoted 6 lines
kernel/semaphore.c new file +4 -0
+	wake_up_process(waiter->task);
 
 
+ * Because this function is inlined, the 'state' parameter will be constant,
+ * and thus optimised away by the compiler.
+ */

That is one huuuuuuuge inline. Are we sure it's justified?

It's a mirror of __mutex_lock_common ... I don't believe it's justified in one case and not the other.

Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
#27 lore raw

Re: [PATCH 11/12] Generic semaphore implementation

In reply to Matthew Wilcox
Quoted 4 lines

+/*
+ * Because this function is inlined, the 'state' parameter will be constant,
+ * and thus optimised away by the compiler.
+ */

If so, is unlikely() still needed?

Quoted 6 lines
kernel/semaphore.c new file +6 -0
+static inline int __sched __down_common(struct semaphore *sem, long state)
+{
+	int result = 0;
+	struct task_struct *task = current;
+	struct semaphore_waiter waiter;
+

kernel/semaphore.c line 157

Quoted 10 lines
kernel/semaphore.c new file +10 -0
+	list_add_tail(&waiter.list, &sem->wait_list);
+	waiter.task = task;
+	waiter.up = 0;
+
+	for (;;) {
+		if (unlikely((state == TASK_INTERRUPTIBLE &&
+					signal_pending(task)) ||
+			     (state == TASK_KILLABLE &&
+					fatal_signal_pending(task))))
+			goto interrupted;
		if (state == TASK_INTERRUPTIBLE && signal_pending(task))
			goto interrupted;
		if (state == TASK_KILLABLE && fatal_signal_pending(task))
			goto interrupted;

Other than that small bit, looks great, any thoughts to getting rid of all the likely/unlikely as well? If they're no longer performance critical, it would be nice to have it that little bit cleaner.

Harvey

#28 lore raw

PATCH 1/1 semaphore: remove likely/unlikely annotations

Also some small codingstyle changes, empty line after declarations, separate an if statement.

---
I know it's a small thing, feel free to take it or not.

 kernel/semaphore.c |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)
kernel/semaphore.c +15 -13
index 32934f2..f4aeeda 100644
@@ -41,7 +41,7 @@ void down(struct semaphore *sem)
 {
 	might_sleep();
 	spin_lock_irq(&sem->lock);
-	if (unlikely(sem->count-- <= 0))
+	if (sem->count-- <= 0)
 		__down(sem);
 	spin_unlock_irq(&sem->lock);
 }
@@ -50,9 +50,10 @@ EXPORT_SYMBOL(down);
 int down_interruptible(struct semaphore *sem)
 {
 	int result = 0;
+
 	might_sleep();
 	spin_lock_irq(&sem->lock);
-	if (unlikely(sem->count-- <= 0))
+	if (sem->count-- <= 0)
 		result = __down_interruptible(sem);
 	spin_unlock_irq(&sem->lock);
 	return result;
@@ -62,9 +63,10 @@ EXPORT_SYMBOL(down_interruptible);
 int down_killable(struct semaphore *sem)
 {
 	int result = 0;
+
 	might_sleep();
 	spin_lock_irq(&sem->lock);
-	if (unlikely(sem->count-- <= 0))
+	if (sem->count-- <= 0)
 		result = __down_killable(sem);
 	spin_unlock_irq(&sem->lock);
 	return result;
@@ -91,7 +93,7 @@ int down_trylock(struct semaphore *sem)
 
 	spin_lock_irqsave(&sem->lock, flags);
 	count = sem->count - 1;
-	if (likely(count >= 0))
+	if (count >= 0)
 		sem->count = count;
 	spin_unlock_irqrestore(&sem->lock, flags);
 	return (count < 0);
@@ -103,7 +105,7 @@ void up(struct semaphore *sem)
 	unsigned long flags;
 
 	spin_lock_irqsave(&sem->lock, flags);
-	if (likely(sem->count >= 0))
+	if (sem->count >= 0)
 		sem->count++;
 	else
 		__up(sem);
@@ -128,8 +130,9 @@ struct semaphore_waiter {
  */
 static void noinline __sched __up_down_common(struct semaphore *sem)
 {
-	struct semaphore_waiter *waiter = list_first_entry(&sem->wait_list,
-						struct semaphore_waiter, list);
+	struct semaphore_waiter *waiter;
+
+	waiter = list_first_entry(&sem->wait_list, struct semaphore_waiter, list);
 	list_del(&waiter->list);
 	waiter->up = 1;
 	wake_up_process(waiter->task);
@@ -150,10 +153,9 @@ static inline int __sched __down_common(struct semaphore *sem, long state)
 	waiter.up = 0;
 
 	for (;;) {
-		if (unlikely((state == TASK_INTERRUPTIBLE &&
-					signal_pending(task)) ||
-			     (state == TASK_KILLABLE &&
-					fatal_signal_pending(task))))
+		if (state == TASK_INTERRUPTIBLE && signal_pending(task))
+			goto interrupted;
+		if (state == TASK_KILLABLE && fatal_signal_pending(task))
 			goto interrupted;
 		__set_task_state(task, state);
 		spin_unlock_irq(&sem->lock);
@@ -175,7 +177,7 @@ static inline int __sched __down_common(struct semaphore *sem, long state)
 	 * but it doesn't hurt, that's not a commonly exercised path and
 	 * it's not a performance path either.
 	 */
-	if (unlikely((++sem->count >= 0) && !list_empty(&sem->wait_list)))
+	if (++sem->count >= 0 && !list_empty(&sem->wait_list))
 		__up_down_common(sem);
 	return result;
 }
@@ -197,7 +199,7 @@ static int noinline __sched __down_killable(struct semaphore *sem)
 
 static void noinline __sched __up(struct semaphore *sem)
 {
-	if (unlikely(list_empty(&sem->wait_list)))
+	if (list_empty(&sem->wait_list))
 		sem->count++;
 	else
 		__up_down_common(sem);
Signature · 1 line
1.5.4.3.342.g99e8
#29 lore raw

Re: [PATCH 11/12] Generic semaphore implementation

In reply to Harvey Harrison
Quoted 6 lines · Harvey Harrison
Quoted 4 lines

+/*
+ * Because this function is inlined, the 'state' parameter will be constant,
+ * and thus optimised away by the compiler.
+ */

If so, is unlikely() still needed?

It's needed for the case where the function is inlined into __down_interruptible / __down_killable.

Quoted 3 lines

Other than that small bit, looks great, any thoughts to getting rid of all the likely/unlikely as well? If they're no longer performance critical, it would be nice to have it that little bit cleaner.

I'd rather keep it as close to mutex.c as possible.

Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."