Re: [PATCH v2] um: net: replace GFP_KERNEL with GFP_ATOMIC when spinlock is held

From: Richard Weinberger
Date: Thu Oct 29 2015 - 04:47:49 EST


Am 29.10.2015 um 08:27 schrieb Saurabh Sengar:
> replace GFP_KERNEL with GFP_ATOMIC while spinlock is held,
> as code while holding a spinlock should be atomic.
> GFP_KERNEL may sleep and can cause deadlock,
> where as GFP_ATOMIC may fail but certainly avoids deadlock

As UML does not support SMP nor PREEMPT this is a non issue,
spinlocks are a NOP.
But for the sake of completeness you are right, the code needs
fixing.

> Signed-off-by: Saurabh Sengar <saurabh.truth@xxxxxxxxx>
> ---
> v2: correcting the subject
>
> arch/um/drivers/net_kern.c | 31 +++++++++++++++++++++++--------
> 1 file changed, 23 insertions(+), 8 deletions(-)
>
> diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
> index f70dd54..7d4b709 100644
> --- a/arch/um/drivers/net_kern.c
> +++ b/arch/um/drivers/net_kern.c
> @@ -388,16 +388,22 @@ static const struct net_device_ops uml_netdev_ops = {
> static int driver_registered;
>
> static void eth_configure(int n, void *init, char *mac,
> - struct transport *transport)
> + struct transport *transport, bool atomic)

Why do you need this atomic variable? Can't you just pass gfp_mask around?

Thanks,
//richard
--
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/