Re: Can request_irq be called under spinlock?

From: Ingo Molnar
Date: Fri Feb 13 2009 - 04:52:54 EST



* Johannes Weiner <hannes@xxxxxxxxxxx> wrote:

> From: Johannes Weiner <hannes@xxxxxxxxxxx>
> Subject: irq: use GFP_KERNEL for action allocation in request_irq()
>
> request_irq() calls into proc code via __setup_irq() which is not safe
> in an atomic context, so request_irq() can itself use the more
> reliable GFP_KERNEL allocation for the action descriptor.
>
> Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx>
> ---
>
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index 291f036..0f2b3b6 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -709,7 +709,7 @@ int request_irq(unsigned int irq, irq_handler_t handler,
> if (!handler)
> return -EINVAL;
>
> - action = kmalloc(sizeof(struct irqaction), GFP_ATOMIC);
> + action = kmalloc(sizeof(struct irqaction), GFP_KERNEL);
> if (!action)
> return -ENOMEM;

Good catch - applied to tip:irq/genirq, thanks Johannes!

Ingo
--
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/