2000-12-18 23:25:32

by Eli Carter

[permalink] [raw]
Subject: generic sleeping locks?

Allow me to display my ignorance a moment.

Are there blocking lock primitives already defined somewhere in the
kernel?

It just seems that

while( lockvar )
sleep_on( &lockwaitq );

along with its various permutations would be commonly used and worthy of
being made into a generic sleep lock. A few blind greps through the
source didn't find anything that caught my eye.

If there aren't, would a patch to add them be of interest to anyone?
Input on design details welcome.

TIA,

Eli
--------------------. "To the systems programmer, users and applications
Eli Carter | serve only to provide a test load."
[email protected] `---------------------------------- (random fortune)


2000-12-18 23:30:34

by Alan

[permalink] [raw]
Subject: Re: generic sleeping locks?

> Are there blocking lock primitives already defined somewhere in the
> kernel?

down and up are normally appropriate for this

2000-12-18 23:39:24

by Eli Carter

[permalink] [raw]
Subject: Re: generic sleeping locks?

Alan Cox wrote:
>
> > Are there blocking lock primitives already defined somewhere in the
> > kernel?
>
> down and up are normally appropriate for this

Ungh. Forest. Trees. *sigh* Sorry for the dumb question.
Thanks for the reply Alan. :)

Ok, second part of the question: What about blocking read/write locks
(with _interruptible variants)?

TIA,

Eli
--------------------. "To the systems programmer, users and applications
Eli Carter | serve only to provide a test load."
[email protected] `---------------------------------- (random fortune)

2000-12-19 00:39:44

by Rusty Russell

[permalink] [raw]
Subject: Re: generic sleeping locks?

In message <[email protected]> you write:
> Alan Cox wrote:
> >
> > > Are there blocking lock primitives already defined somewhere in the
> > > kernel?
> >
> > down and up are normally appropriate for this
>
> Ungh. Forest. Trees. *sigh* Sorry for the dumb question.
> Thanks for the reply Alan. :)
>
> Ok, second part of the question: What about blocking read/write locks
> (with _interruptible variants)?

Documentation/DocBook/kernel-locking*

Rusty.
--
Hacking time.

2000-12-19 15:51:44

by Eli Carter

[permalink] [raw]
Subject: Re: generic sleeping locks?

Rusty Russell wrote:
>
> In message <[email protected]> you write:
> > Alan Cox wrote:
> > >
> > > > Are there blocking lock primitives already defined somewhere in the
> > > > kernel?
> > >
> > > down and up are normally appropriate for this
> >
> > Ungh. Forest. Trees. *sigh* Sorry for the dumb question.
> > Thanks for the reply Alan. :)
> >
> > Ok, second part of the question: What about blocking read/write locks
> > (with _interruptible variants)?
>
> Documentation/DocBook/kernel-locking*
>
> Rusty.
> --
> Hacking time.

Perhaps I should have specified that I'm working with 2.2.xy....
I'll d/l a 2.4.0-test and look at the docbook in that. Thanks for the
pointer.

Eli
--------------------. "To the systems programmer, users and applications
Eli Carter | serve only to provide a test load."
[email protected] `---------------------------------- (random fortune)