Re: [PATCH 03/25] add dyn_array support

From: Yinghai Lu
Date: Sun Aug 03 2008 - 01:04:43 EST


On Sat, Aug 2, 2008 at 9:55 PM, Johannes Weiner <hannes@xxxxxxxxxxxx> wrote:
> Hi,
>
> "Yinghai Lu" <yhlu.kernel@xxxxxxxxx> writes:
>
>> On Sat, Aug 2, 2008 at 9:03 PM, Johannes Weiner <hannes@xxxxxxxxxxxx> wrote:
>>> Hi,
>>>
>>> Yinghai Lu <yhlu.kernel@xxxxxxxxx> writes:
>>>
>>>> could have crazy big arrays and allocate them in bootmem at init stage.
>>>> also also to allocate array according to size we need to use to avoid wasting
>>>> memory
>>>> use CONFIG_HAVE_DYN_ARRAY to enable it or not
>>>>
>>>> usage:
>>>>
>>>> |static struct irq_desc irq_desc_init __initdata = {
>>>> | .status = IRQ_DISABLED,
>>>> | .chip = &no_irq_chip,
>>>> | .handle_irq = handle_bad_irq,
>>>> | .depth = 1,
>>>> | .lock = __SPIN_LOCK_UNLOCKED(irq_desc->lock),
>>>> |#ifdef CONFIG_SMP
>>>> | .affinity = CPU_MASK_ALL
>>>> |#endif
>>>> |};
>>>> |
>>>> |static void __init init_work(void *data)
>>>> |{
>>>> | struct dyn_array *da = data;
>>>> | struct irq_desc *desc;
>>>> | int i;
>>>> |
>>>> | desc = *da->name;
>>>
>>> Where *da->name might be NULL...

*da->name = __alloc_bootmem_nopanic(size, da->align, phys);

YH
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/