On 3/13/06, Jan Hudec <bulb@xxxxxx> wrote:
thanks Jan .. i'm gonna do it this way. (and this sentence ended with no exclamation mark :-)
MHD.Tayseer
On Sun, Mar 12, 2006 at 23:43:16 +0200, MHD.Tayseer Alquoatli wrote:
> Hi All
> i'm developing a driver, each request to this driver will have a request id,
> and once the response to this request will be available to the driver it
> must awake the exact same requesting process "using the request id"
> i've thought of a list or "req_id, wait_queue, data" .. for each new request
> a new entry with req_id will be added and the requesting process will sleep
> on the corresponding wait_queue till the data arrive
> what is am afraid of:
> 1- what about if there was too many requests !! this means too many
(please, use less exclamation marks -- none is quite enough here)
> wait_queues are declared .. is this a problem ?
No, it can't be a problem. Wait queue is under the cover of semaphores and
completions, so eg. there's two of them in each inode. Wait queue is really
just a list of pointers to tasks, so really no big deal.
> another thing:
> 2- what about if that "req_id, wait_queue, data" where allocated using a
> lookaside cache "kmem_cache_t" ?? will this cause a problem "in case the
> cache decided to create a bulk of those objects !!"
It must be allocated by kmem_cache_t (in fact, kmalloc does that as well,
only using a generic kmem cache - there is one for each power of two from 32
to 64kB or so (differs between platforms IIRC)). You /want/ the cache to
create a bulk of those objects. It will speed things up greatly, especially
if you can make use of those ctor/dtor callbacks.
> 3- am i solving the problem the right way ??
I think yes.
--
Jan 'Bulb' Hudec <bulb@xxxxxx>
thanks Jan .. i'm gonna do it this way. (and this sentence ended with no exclamation mark :-)
MHD.Tayseer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
iD8DBQFEFcIlRel1vVwhjGURAt1tAJ4seUzaXYD0UKZsQHKSCDoTeuAfwQCfTmg+
/GXZJQTyrQJLTu/GG6vwzq0=
=yoF9
-----END PGP SIGNATURE-----