mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-29 07:34:06 +08:00
mptcp: open code mptcp variant for lock_sock
This allows invoking an additional callback under the socket spin lock. Will be used by the next patches to avoid additional spin lock contention. Acked-by: Florian Westphal <fw@strlen.de> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
be5724240b
commit
ad80b0fc6e
@ -1590,6 +1590,7 @@ static inline void lock_sock(struct sock *sk)
|
||||
lock_sock_nested(sk, 0);
|
||||
}
|
||||
|
||||
void __lock_sock(struct sock *sk);
|
||||
void __release_sock(struct sock *sk);
|
||||
void release_sock(struct sock *sk);
|
||||
|
||||
|
@ -2486,7 +2486,7 @@ bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag)
|
||||
}
|
||||
EXPORT_SYMBOL(sk_page_frag_refill);
|
||||
|
||||
static void __lock_sock(struct sock *sk)
|
||||
void __lock_sock(struct sock *sk)
|
||||
__releases(&sk->sk_lock.slock)
|
||||
__acquires(&sk->sk_lock.slock)
|
||||
{
|
||||
|
@ -253,6 +253,19 @@ struct mptcp_sock {
|
||||
} rcvq_space;
|
||||
};
|
||||
|
||||
#define mptcp_lock_sock(___sk, cb) do { \
|
||||
struct sock *__sk = (___sk); /* silence macro reuse warning */ \
|
||||
might_sleep(); \
|
||||
spin_lock_bh(&__sk->sk_lock.slock); \
|
||||
if (__sk->sk_lock.owned) \
|
||||
__lock_sock(__sk); \
|
||||
cb; \
|
||||
__sk->sk_lock.owned = 1; \
|
||||
spin_unlock(&__sk->sk_lock.slock); \
|
||||
mutex_acquire(&__sk->sk_lock.dep_map, 0, 0, _RET_IP_); \
|
||||
local_bh_enable(); \
|
||||
} while (0)
|
||||
|
||||
#define mptcp_for_each_subflow(__msk, __subflow) \
|
||||
list_for_each_entry(__subflow, &((__msk)->conn_list), node)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user