Linux-kernel mailing list archive 1999-20,: Re: [PATCH][2.3.0] Read-write locks instead semaphores on UTS structures

# Re: [PATCH][2.3.0] Read-write locks instead semaphores on UTS structures

Manfred Spraul (manfreds@colorfullife.com)
Sun, 16 May 1999 13:24:19 +0200

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Jelle Foks: "Re: Silent freezes with kernels through 2.2.9. No Oops. - Same here"
- Previous message: Patrick Jordan: "Problem with lp.h"

Jan-Simon wrote:
> read-write locks are a variant of spin locks.

what about implementing read-write semaphores?

> ideally the spinlock code (spin_lock and read_lock et al)
> would have debug versions that counted how many locks were
> held (in some per-cpu data structure), and have schedule()
> check that this number was zero before putting the process
> to sleep.
IMHO, several debug-checks should be added to the 2.3 kernels.
(everything based on CONFIG_??):
- count spinlocks

- every function that _could_ sleep should call schedule().
(copy_from_user, kmalloc(GFP_WAIT) etc.)
--> rare problems become frequent, easier to find.

- functions that assume that a certain spinlock is locked
should check that [eg. (current->lock_depth >= 0)].
--> missing synchronization can be detected immediately, and
a simple 'grep' finds these functions. Since the compiler
enforces the spelling, you don't need to 'grep "kernel.lock"',
'grep "kernel.flag"', ...

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

- Next message: Jelle Foks: "Re: Silent freezes with kernels through 2.2.9. No Oops. - Same here"
- Previous message: Patrick Jordan: "Problem with lp.h"