Re: [PATCH] /proc/locks bugfix

From: willy@thepuffingroup.com
Date: Fri Apr 21 2000 - 16:03:05 EST


On Fri, Apr 21, 2000 at 08:19:36PM +0200, Manfred Spraul wrote:
> willy@thepuffingroup.com wrote:
> >
> > I've fixed this in
> > my tree by putting all accesses to the lock data structures under its
> > own semaphore.
> >
>
> It's dangerous to replace lock_kernel() with a single semaphore:
> lock_kernel() means one cpu, down() means one thread.
>
> Did you double check that you don't cause a major slowdown/reschedules,
> e.g. if kmalloc() sleeps?

The file locking code isn't performance critical. But yes, the code only
sleeps in very specific places, which are while the semaphore either
isn't held, or is dropped while we sleep, and the code then restarts
its scan if we did have to block.

> I've always replaced lock_kernel() with one spinlock.

or, presumably, a lot of spinlocks -- I did think about making the
locking more finegrained here, but I really don't think it's worth it.
I'm ambivalent whether the sempahore should be a spinlock; I think I'm
holding it for long enough (on occasion) that it should be a semaphore,
but you could argue me into making it a spinlock. Would you like to
see a snapshot of the code I've written?

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



This archive was generated by hypermail 2b29 : Sun Apr 23 2000 - 21:00:19 EST