[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-kernel
Subject:    Re: [Patch] shm bug introduced with pagecache in 2.3.11
From:       "Manfred" <manfreds () colorfullife ! com>
Date:       1999-11-21 13:07:55
[Download RAW message or body]

Linus wrote:
> But hey, I haven't actually done the full implementaion. I'm pretty
> confident it can be done, but...
>
> Anyway, if your point was that two "trylocks" can race and neither get the
> lock, then yes, you're right. That's what "trylock" is all about - it
> won't schedule, it just will fail.
That's obvious, I only used "write_lock_trylock()" as a shorthand for
"lock;btrl RWL;jc, test ;jnz".

My pseudo-code describes a possible race if 1 CPU calls "down_exclusive()"
and the second CPU calls "down_shared()", the lock is free.
Boths CPU's could to enter the "slow" path, and unless you are really
careful, then both CPU's could  schedule(), and noone will wake them up.

I think the first reader must starve a sleeping writer, or we risk a
lock-up.

--
    Manfred




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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic