On Fri, Sep 23, 2011 at 06:38:14PM +0200, Julian Andres Klode wrote: > Allow TX buffers to be allocated only in the lower 75% of the pool > to avoid a completely filled buffer preventing the driver from > processing responses. Looking a second time at it, it makes more sense to reserve the lower 25% for received things and have the upper 75% shared. This keeps 16 events free for events and responses, and we can thus often find the response slot in O(1) instead of O(2): 0=request => [0 is not free] [1 is free] 17=request => [0 is free] I also reduces the complexity a bit. Something like: int i = (category == NVEC_MSG_TX) ? (NVEC_POOL_SIZE / 4) : 0; for (; i < NVEC_POOL_SIZE; i++) { if (atomic_xchg(&nvec->msg_pool[i].used, 1) == 0) { dev_vdbg(nvec->dev, "INFO: Alloc %i\n", i); return &nvec->msg_pool[i]; } } I might be more readable if I invert he condition and use a continue though. -- Julian Andres Klode - Debian Developer, Ubuntu Member See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/. _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel