]> git.baikalelectronics.ru Git - kernel.git/commit
net: Don't disable interrupts in __netdev_alloc_skb()
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Fri, 7 Jun 2019 19:20:35 +0000 (21:20 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 Jun 2019 02:40:09 +0000 (19:40 -0700)
commit9bc14b1ef5c0c7c8a532b5f4033e96341d82afef
tree302aa22bccfe80a580cc74cb1000bcce3f1ab516
parentc641dad5c097c43e8996cd4067fc65f83d2fa9a3
net: Don't disable interrupts in __netdev_alloc_skb()

__netdev_alloc_skb() 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.

The interrupts are disabled in order to ensure locked access from every
context to `netdev_alloc_cache'.

Let __netdev_alloc_skb() check if interrupts are disabled. If they are, use
`netdev_alloc_cache'. Otherwise disable BH and use `napi_alloc_cache.page'.
The IRQ check is cheaper compared to disabling & enabling interrupts and
memory allocation with disabled interrupts does not work on -RT.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/skbuff.c