Re: [patch] schedule_timeout()

Andrea Arcangeli (andrea@e-mind.com)
Sat, 24 Oct 1998 20:15:49 +0200 (CEST)


On Tue, 20 Oct 1998, Andrea Arcangeli wrote:

>Everything still perfect here (and last night I had a load of 3 for one
>hour without problems).

Today I catched a bug, usleep(0) was stalling forever. This show that the
right implementation of schedule_timeout() has to be the obvious
strightforward semantic to avoid future mistakes:

schedule_timeout(0); -> do nothing of special threat 0 as other timeout,
do a schedule() with the timer pending.
schedule_timeout(MAX_SCHEDULE_TIMEOUT) -> stall forever wating for a
signal or a wakeup.
schedule_timeout(n) -> wait for n jiffies

Doing that the driver code got more simplyfied too. I just updated all my
drivers to the new policy. The core patch is and was perfectly stable
under any kind of load, the bug infact was in one of the updates to the
new schedule_timeout() (and I preferred to fix schedule_timeout() for the
reason explained above). And now it' s fine also usleep(0) ;-).

ftp://e-mind.com/pub/linux/kernel-patches/jiffies-13-2.1.126.diff.gz

arch/i386/kernel/irq.c | 2
arch/i386/kernel/mtrr.c | 3
arch/i386/kernel/time.c | 3
arch/mips/kernel/time.c | 16 ++!
arch/sparc/kernel/process.c | 2
drivers/block/acsi.c | 4
drivers/block/ataflop.c | 4
drivers/block/ide-cd.c | 3
drivers/block/pdc4030.c | 8 !
drivers/block/ps2esdi.c | 6 !
drivers/block/xd.c | 2
drivers/char/cyclades.c | 8 !
drivers/char/esp.c | 2
drivers/char/istallion.c | 2
drivers/char/lp.c | 18 !!!
drivers/char/msp3400.c | 9 !!
drivers/char/n_tty.c | 16 !!!
drivers/char/riscom8.c | 4
drivers/char/saa5249.c | 2
drivers/char/serial.c | 6 !
drivers/char/specialix.c | 6 !
drivers/char/stallion.c | 2
drivers/char/tty_io.c | 3
drivers/char/tty_ioctl.c | 19 !!!!
drivers/char/tuner.c | 3
drivers/misc/parport_ieee1284.c | 3
drivers/net/3c505.c | 54 !!!!!!!!!!!!
drivers/net/3c523.c | 2
drivers/net/atp.c | 2
drivers/net/dgrs.c | 4
drivers/net/hp100.c | 26 !!!!!
drivers/net/ibmtr.c | 2
drivers/net/ltpc.c | 18 !!!!
drivers/net/ppp.c | 1
drivers/net/rrunner.c | 4
drivers/net/sdla.c | 6 !
drivers/net/seeq8005.c | 8 !
drivers/net/shaper.c | 4
drivers/net/sktr.c | 4
drivers/scsi/53c7,8xx.c | 6 !
drivers/scsi/53c7xx.c | 6 !
drivers/scsi/NCR5380.c | 24 !!!!!
drivers/scsi/NCR53c406a.c | 8 !
drivers/scsi/aha152x.c | 4
drivers/scsi/aic7xxx.c | 4
drivers/scsi/atari_NCR5380.c | 8 !
drivers/scsi/atari_scsi.c | 2
drivers/scsi/eata_dma.c | 4
drivers/scsi/eata_pio.c | 2
drivers/scsi/imm.c | 4
drivers/scsi/mac_NCR5380.c | 8 !
drivers/scsi/mac_scsi.c | 2
drivers/scsi/ncr53c8xx.c | 2
drivers/scsi/pci2000.c | 2
drivers/scsi/pci2220i.c | 4
drivers/scsi/ppa.c | 4
drivers/scsi/psi240i.c | 4
drivers/scsi/qlogicfas.c | 8 !
drivers/scsi/scsi.c | 4
drivers/scsi/scsi_obsolete.c | 3
drivers/scsi/sd.c | 12 !!
drivers/scsi/seagate.c | 8 !
drivers/scsi/wd7000.c | 8 !
drivers/sound/dmabuf.c | 54 !!!!!!!!!!!
drivers/sound/midibuf.c | 15 !!!
drivers/sound/sequencer.c | 33 !!!!!!!
fs/lockd/clntlock.c | 6 !
fs/lockd/clntproc.c | 14 !!
fs/lockd/svc.c | 9 !!
fs/nfs/inode.c | 6 !
fs/proc/array.c | 2
fs/select.c | 50 +-!!!!!!!!!
include/linux/arcdevice.h | 2
include/linux/lp.h | 5 !
include/linux/poll.h | 2
include/linux/sched.h | 12 +!
include/linux/sunrpc/svcsock.h | 2
include/linux/timer.h | 10 ++
include/linux/tty.h | 2
include/net/sock.h | 2
include/net/tcp.h | 2
kernel/itimer.c | 9 !
kernel/ksyms.c | 2
kernel/sched.c | 177 ++++++++++++++++++----!!!!!!!!!!!!!!!!!!
kernel/signal.c | 19 !!!
net/ipv4/af_inet.c | 15 !!!
net/ipv4/ip_masq_autofw.c | 2
net/ipv4/ipconfig.c | 2
net/ipv4/tcp.c | 10 !
net/ipv4/tcp_output.c | 2
net/sunrpc/sched.c | 14 !!
net/sunrpc/svcsock.c | 6 !
92 files changed, 123 insertions, 41 deletions, 754 modifications

Andrea Arcangeli

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