diff options
author | 2022-04-28 11:58:18 +0100 | |
---|---|---|
committer | 2022-05-01 12:19:01 +0100 | |
commit | 052ada096842a910327936b4ed203048906eb2c3 (patch) | |
tree | 531ce98d0886f25915c1be699660ad04a0bfd31f /drivers/net/phy/phy.c | |
parent | sock: dedup sock_def_write_space wmem_alloc checks (diff) | |
download | wireguard-linux-052ada096842a910327936b4ed203048906eb2c3.tar.xz wireguard-linux-052ada096842a910327936b4ed203048906eb2c3.zip |
sock: optimise UDP sock_wfree() refcounting
For non SOCK_USE_WRITE_QUEUE sockets, sock_wfree() (atomically) puts
->sk_wmem_alloc twice. It's needed to keep the socket alive while
calling ->sk_write_space() after the first put.
However, some sockets, such as UDP, are freed by RCU
(i.e. SOCK_RCU_FREE) and use already RCU-safe sock_def_write_space().
Carve a fast path for such sockets, put down all refs in one go before
calling sock_def_write_space() but guard the socket from being freed
by an RCU read section.
note: because TCP sockets are marked with SOCK_USE_WRITE_QUEUE it
doesn't add extra checks in its path.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/phy.c')
0 files changed, 0 insertions, 0 deletions