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>
Attachment:
signature.asc
Description: Digital signature