[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how not to write a search algorithm



William Lee Irwin III wrote:
>> (2) only needs the reservation bits from the preceding post if it's
>>         just dealing with kmem_cache_alloc() returning NULL.

On Sun, Aug 04, 2002 at 08:00:27PM -0700, Andrew Morton wrote:
> Well I think we'll need a per-cpu-pages thing to amortise zone->lock
> contention anyway.  So what we can do is:
> 	fill_up_the_per_cpu_buffer(GFP_KERNEL);	/* disables preemption */
> 	spin_lock(lock);
> 	allocate(GFP_ATOMIC);
> 	spin_unlock(lock);
> 	preempt_enable();
> We also prevent interrupt-time allocations from
> stealing the final four pages from the per-cpu buffer.
> The allocation is guaranteed to succeed, yes?   Can use
> it for ratnodes as well.

NFI how this is supposed to work with slab caches and/or get around the
GFP_ATOMIC failing. I understand how to bomb out of loops & return
-ENOMEM though. I also think it best to let this sleep, as it's not
happening in interrupt context. Or maybe I'm missing something.

Better ideas are of course welcome.

Cheers,
Bill
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/