tcp: replace hard coded GFP_KERNEL with sk_allocation
This fixed a lockdep warning which appeared when doing stress memory tests over NFS: inconsistent {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-W} usage. page reclaim => nfs_writepage => tcp_sendmsg => lock sk_lock mount_root => nfs_root_data => tcp_close => lock sk_lock => tcp_send_fin => alloc_skb_fclone => page reclaim David raised a concern that if the allocation fails in tcp_send_fin(), and it's GFP_ATOMIC, we are going to yield() (which sleeps) and loop endlessly waiting for the allocation to succeed. But fact is, the original GFP_KERNEL also sleeps. GFP_ATOMIC+yield() looks weird, but it is no worse the implicit sleep inside GFP_KERNEL. Both could loop endlessly under memory pressure. CC: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> CC: David S. Miller <davem@davemloft.net> CC: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by:Wu Fengguang <fengguang.wu@intel.com> Signed-off-by:
David S. Miller <davem@davemloft.net>
Showing
- include/net/tcp.h 1 addition, 1 deletioninclude/net/tcp.h
- net/ipv4/tcp.c 5 additions, 5 deletionsnet/ipv4/tcp.c
- net/ipv4/tcp_ipv4.c 4 additions, 3 deletionsnet/ipv4/tcp_ipv4.c
- net/ipv4/tcp_minisocks.c 1 addition, 1 deletionnet/ipv4/tcp_minisocks.c
- net/ipv4/tcp_output.c 3 additions, 2 deletionsnet/ipv4/tcp_output.c
- net/ipv6/tcp_ipv6.c 1 addition, 1 deletionnet/ipv6/tcp_ipv6.c
Loading
Please register or sign in to comment