On Thu, 13 Jul 2006 18:08:17 -0700 Roland Dreier <[email protected]> wrote: > > Good point, a try-again loop would work. Do we really need the caller to > > maintain a cache? I suspect something like > > > > drat: > > if (idr_pre_get(GFP_KERNEL) == ENOMEM) > > give_up(); > > spin_lock(); > > ret = idr_get_new(); > > spin_unlock(); > > if (ret == ENOMEM) > > goto drat; > > > > would do it. > > The problem (for my tiny brain at least) is that I don't know where > idr_pre_get() can put the memory it allocates if there's no lock in > the idr structure -- how do you maintain internal consistency if no > locks are held when filling the cache? argh. Aren't you supposed to be on vacation or something? > 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. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [PATCH] Convert idr's internal locking to _irqsave variant
- From: Andrew Morton <[email protected]>
- Re: [PATCH] Convert idr's internal locking to _irqsave variant
- References:
- ipoib lockdep warning
- From: Zach Brown <[email protected]>
- Re: [openib-general] ipoib lockdep warning
- From: Roland Dreier <[email protected]>
- Re: [openib-general] ipoib lockdep warning
- From: Zach Brown <[email protected]>
- Re: [openib-general] ipoib lockdep warning
- From: Roland Dreier <[email protected]>
- Re: [openib-general] ipoib lockdep warning
- From: Ingo Molnar <[email protected]>
- [PATCH] Convert idr's internal locking to _irqsave variant
- From: Roland Dreier <[email protected]>
- Re: [PATCH] Convert idr's internal locking to _irqsave variant
- From: Andrew Morton <[email protected]>
- Re: [PATCH] Convert idr's internal locking to _irqsave variant
- From: Roland Dreier <[email protected]>
- Re: [PATCH] Convert idr's internal locking to _irqsave variant
- From: Andrew Morton <[email protected]>
- Re: [PATCH] Convert idr's internal locking to _irqsave variant
- From: Roland Dreier <[email protected]>
- Re: [PATCH] Convert idr's internal locking to _irqsave variant
- From: Andrew Morton <[email protected]>
- Re: [PATCH] Convert idr's internal locking to _irqsave variant
- From: Roland Dreier <[email protected]>
- ipoib lockdep warning
- Prev by Date: Re: [PATCH] Convert idr's internal locking to _irqsave variant
- Next by Date: Re: [PATCH] Convert idr's internal locking to _irqsave variant
- Previous by thread: Re: [PATCH] Convert idr's internal locking to _irqsave variant
- Next by thread: Re: [PATCH] Convert idr's internal locking to _irqsave variant
- Index(es):