On 5/29/19 3:15 PM, Sebastian Andrzej Siewior wrote:
> netdev_alloc_frag() can be used from any context and is used by NAPI
> and non-NAPI drivers. Non-NAPI drivers use it in interrupt context
> and NAPI drivers use it during initial allocation (->ndo_open() or
> ->ndo_change_mtu()). Some NAPI drivers share the same function for the
> initial allocation and the allocation in their NAPI callback.

...

> +
> +     fragsz = SKB_DATA_ALIGN(fragsz);
> +     if (irqs_disabled()) {


What is the difference between this prior test, and the following ?

if (in_irq() || irqs_disabled())

I am asking because I see the latter being used in __dev_kfree_skb_any()


> +             nc = this_cpu_ptr(&netdev_alloc_cache);
> +             data = page_frag_alloc(nc, fragsz, GFP_ATOMIC);
> +     } else {
> +             local_bh_disable();
> +             data = __napi_alloc_frag(fragsz, GFP_ATOMIC);
> +             local_bh_enable();
> +     }
> +     return data;
> +}
> +EXPORT_SYMBOL(netdev_alloc_frag);
> +
>  /**
>   *   __netdev_alloc_skb - allocate an skbuff for rx on a specific device
>   *   @dev: network device to receive on
> 

Reply via email to