[LWN Logo]

Date:	Fri, 21 Apr 2000 14:35:54 -0700 (PDT)
From:	Linus Torvalds <torvalds@transmeta.com>
To:	"David S. Miller" <davem@redhat.com>
Subject: Re: [PATCH] f_op->poll() without lock_kernel()



On Fri, 21 Apr 2000, David S. Miller wrote:
>    From: Alan Cox <alan@lxorguk.ukuu.org.uk>
> 
>    This is not a good idea if we are trying to stabilise 2.4.
> 
> I completely disagree.

I decided to take a look at the actual functions, and having looked at
them I definitely think that poll() should run without the kernel lock. 

Getting rid of the kernel lock makes the networking poll() cleaner, and of
the 25 other poll functions I looked at, every single one seemed safe. I'm
told the ISDN one is SMP-unsafe, but that the ISDN code is not SMP-safe
for read() or write() either. I didn't look at that one.

The sound drivers, for example, already did all the locking they needed,
simply because they needed the locking against their own interrupts
anyway. And they obviously didn't use the kernel lock for that.. Some of
the bad ones used the global irq lock, which also works but isn't as nice
as having your own spinlock.

Most of the other things just didn't need any locking at all (just test a
flag and add the poll-queue entry).

The only questionable entry I found was usb_device_poll() which I fixed up
with a lock_kernel()/unlock_kernel() pair. 

I probably missed one or two. I added comments to the ones I went through,
and I definitely think it is worth doing at this point.

		Linus


-
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/