Hi Michael.. On Fri, Dec 10, 2010 at 00:17, Michael Blizek <michi1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote: > The problem is something like this: I want to allocate a buffer and then > receive some data. To prevent out-of-memory when the sender is slow, there is > a limit on how much buffer can be allocated. This limit is global. If it is > reached, the caller will be put into a "queue" and then go to sleep. If data > is consumed and bufferspace is freeed, the first task in the queue (if not > empty) will resume. During the kmalloc and copy process, there is no need to > keep the buffer space accounting part locked. > > If the small lock is released between the reserving and the copying, a > different thread might come and unreserve in the mean time. I am surely not the best data structure guy in kernelnewbies, but I guess the main problem here lies in the buffer representation..which is I guess is a list? Then, how about making a circular list? And insertion/deletion is done via RCU? Regarding the counter, I think we can create a counter specific lock... CMIIW -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ