Re: [RFC] New locking primitive for 2.5

yodaiken
2002-02-08T20:41:00Z

On Fri, Feb 08, 2002 at 08:14:32PM +0000, Anton Altaparmakov wrote:
> At 16:51 08/02/02, Nigel Gamble wrote:
> >Read-write semaphores should never be used. As others have pointed out,
> >they cause really intractable priority inversion problems (because a
...
>
> Read-write semaphores have their use and the current Linux implementation

Here's the context: the preemption patch puts pressure on Linux to move
from BKL to semaphores and then it will be seen that semaphores need
to have dynamic priority inherit to sort-of-work, and then it will be seen
that read/write lock is a problem!

> The value of allowing multiple cpus to read the same data simultaneously by
> far offsets the priority problems IMVHO. At least the way I am using rw
> semaphores in ntfs it is. Readlocks are grabbed loads and loads of times to
> serialize meta data access in the page cache while writelocks are a minute
> number in comparison and because the data required to be accessed may not

this is absolutely correct. However, once the decision has been made or
fallen into to go to a priority inherit scheme, Linux will find itself
in the same bind as Solaris.

> be cached in memory (page cache page is not read in, is swapped out,
> whatever) a disk access may be required which means a rw spin lock is no
> good. In fact ntfs would be the perfect candidate for automatic rw combi
> locks where the locking switches from spinning to sleeping if the code path
> reaches a disk access. I can't use a manually controlled lock as the page

Seem like the lock is simply grabbed way to far up.

--
---------------------------------------------------------
Victor Yodaiken
Finite State Machine Labs: The RTLinux Company.
www.fsmlabs.com www.rtlinux.com