Re: single copy pipe/fifo

Manfred Spraul (manfred@colorfullife.com)
Wed, 07 Feb 2001 22:10:32 +0100


"David S. Miller" wrote:
>
> Manfred Spraul writes:
> > * if you run 2 instances on a dual cpu P II/350 it's a big win, but if
> > you run only one instance, then the bw_pipe processes will jump from one
> > cpu to the other and it's only a small improvement (~+15%).
>
> wake_up_interruptible_sync is meant specifically to avoid
> this cpu hopping behavior.
>
I use it whereever possible, but in this case it's not possible:
pipe is empty.

process 1 (on cpu 1)
write(fd,buf,64kB).
* creates kiobuf
* sleeps.

process 2 (on cpu 1)
read(fd,buf,64kB).
* reads the data
* now it must wake up, but it will return from the syscall, thus
wake_up_interruptible().
* wakeup notices that cpu1 is busy and sends process 1 to cpu 2
* read returns
read(fd, buf, 64kB)
* no data waiting, sleeps.

process 1 (on cpu 2)
* write returns
write(fd, buf, 64 kB)
* creates kiobuf
* wake_up_interruptible_sync(), since it will schedule
* schedule()
but now schedule will pull process 2 to cpu 2

I haven't verified the sequence with kdb, but I'm certain that this
happens.

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