Messages in this thread | | | Date | Thu, 13 Jul 2006 18:30:47 -0700 | From | Andrew Morton <> | Subject | Re: [PATCH] Convert idr's internal locking to _irqsave variant |
| |
On Thu, 13 Jul 2006 18:18:35 -0700 Andrew Morton <akpm@osdl.org> wrote:
> > Having the caller hold a chunk of memory in a stack variable was the > > trick I came up with to get around that. > > Yes, that certainly works.
Problem is, I think, you'll need to preallocate IDR_FREE_MAX items. And then free them all again when none of them were consumed (usual).
Yes, storing the preallocated nodes in the idr itself requires locking. But that locking is 100% private to the IDR implementation. It locks only the preload list and not the user's stuff.
radix_tree_preload() effectively does this. Except the preload list is kernel-wide. It's split across CPUs and uses local_irq_disable/preempt_disable locking tricks as a performance optimisation. But conceptually it's the same.
Simply copying that would give something which is known to work... It seems like a large amount of fuss, but when you think about it the problem isn't simple. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |