diff options
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index bfa7d20e6646..81198632ac2a 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -659,6 +659,21 @@ static inline bool sock_flag(const struct sock *sk, enum sock_flags flag) | |||
659 | return test_bit(flag, &sk->sk_flags); | 659 | return test_bit(flag, &sk->sk_flags); |
660 | } | 660 | } |
661 | 661 | ||
662 | #ifdef CONFIG_NET | ||
663 | extern struct static_key memalloc_socks; | ||
664 | static inline int sk_memalloc_socks(void) | ||
665 | { | ||
666 | return static_key_false(&memalloc_socks); | ||
667 | } | ||
668 | #else | ||
669 | |||
670 | static inline int sk_memalloc_socks(void) | ||
671 | { | ||
672 | return 0; | ||
673 | } | ||
674 | |||
675 | #endif | ||
676 | |||
662 | static inline gfp_t sk_gfp_atomic(struct sock *sk, gfp_t gfp_mask) | 677 | static inline gfp_t sk_gfp_atomic(struct sock *sk, gfp_t gfp_mask) |
663 | { | 678 | { |
664 | return GFP_ATOMIC | (sk->sk_allocation & __GFP_MEMALLOC); | 679 | return GFP_ATOMIC | (sk->sk_allocation & __GFP_MEMALLOC); |