diff options
| author | Paolo Bonzini <[email protected]> | 2015-11-24 18:34:40 +0000 |
|---|---|---|
| committer | Paolo Bonzini <[email protected]> | 2015-11-24 18:34:40 +0000 |
| commit | 8bd142c01648cdb33e9bcafa0448ba2c20ed814c (patch) | |
| tree | 9197c60d3f9d4036f38f281a183e94750ceea1d7 /include/net/sock.h | |
| parent | Merge tag 'kvm-s390-master-4.4-1' of git://git.kernel.org/pub/scm/linux/kerne... (diff) | |
| parent | arm64: kvm: report original PAR_EL1 upon panic (diff) | |
| download | kernel-8bd142c01648cdb33e9bcafa0448ba2c20ed814c.tar.gz kernel-8bd142c01648cdb33e9bcafa0448ba2c20ed814c.zip | |
Merge tag 'kvm-arm-for-v4.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into kvm-master
KVM/ARM Fixes for v4.4-rc3.
Includes some timer fixes, properly unmapping PTEs, an errata fix, and two
tweaks to the EL2 panic code.
Diffstat (limited to 'include/net/sock.h')
| -rw-r--r-- | include/net/sock.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index bbf7c2cf15b4..7f89e4ba18d1 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2226,6 +2226,31 @@ static inline bool sk_listener(const struct sock *sk) return (1 << sk->sk_state) & (TCPF_LISTEN | TCPF_NEW_SYN_RECV); } +/** + * sk_state_load - read sk->sk_state for lockless contexts + * @sk: socket pointer + * + * Paired with sk_state_store(). Used in places we do not hold socket lock : + * tcp_diag_get_info(), tcp_get_info(), tcp_poll(), get_tcp4_sock() ... + */ +static inline int sk_state_load(const struct sock *sk) +{ + return smp_load_acquire(&sk->sk_state); +} + +/** + * sk_state_store - update sk->sk_state + * @sk: socket pointer + * @newstate: new state + * + * Paired with sk_state_load(). Should be used in contexts where + * state change might impact lockless readers. + */ +static inline void sk_state_store(struct sock *sk, int newstate) +{ + smp_store_release(&sk->sk_state, newstate); +} + void sock_enable_timestamp(struct sock *sk, int flag); int sock_get_timestamp(struct sock *, struct timeval __user *); int sock_get_timestampns(struct sock *, struct timespec __user *); |
