]> 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)
commita65b73ad5d81fe4e593362835ea75689fb303576
tree302aa22bccfe80a580cc74cb1000bcce3f1ab516
parent2a16281a429b06c6d52c1de4bbcdc7dba5309bf5
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