From: Jens Axboe <[email protected]>
To: [email protected], [email protected]
Cc: Jens Axboe <[email protected]>
Subject: [PATCH 1/4] net: add sock 'sk_no_lock' member
Date: Tue, 12 Apr 2022 14:26:10 -0600 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
In preparation for allowing lockless access to the socket for specialized
use cases, add a member denoting that the socket supports this.
No functional changes in this patch.
Signed-off-by: Jens Axboe <[email protected]>
---
include/net/sock.h | 3 +++
net/core/sock.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/include/net/sock.h b/include/net/sock.h
index c4b91fc19b9c..e8283a65b757 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -131,6 +131,7 @@ typedef __u64 __bitwise __addrpair;
* @skc_reuseport: %SO_REUSEPORT setting
* @skc_ipv6only: socket is IPV6 only
* @skc_net_refcnt: socket is using net ref counting
+ * @skc_no_lock: socket is private, no locking needed
* @skc_bound_dev_if: bound device index if != 0
* @skc_bind_node: bind hash linkage for various protocol lookup tables
* @skc_portaddr_node: second hash linkage for UDP/UDP-Lite protocol
@@ -190,6 +191,7 @@ struct sock_common {
unsigned char skc_reuseport:1;
unsigned char skc_ipv6only:1;
unsigned char skc_net_refcnt:1;
+ unsigned char skc_no_lock:1;
int skc_bound_dev_if;
union {
struct hlist_node skc_bind_node;
@@ -382,6 +384,7 @@ struct sock {
#define sk_reuseport __sk_common.skc_reuseport
#define sk_ipv6only __sk_common.skc_ipv6only
#define sk_net_refcnt __sk_common.skc_net_refcnt
+#define sk_no_lock __sk_common.skc_no_lock
#define sk_bound_dev_if __sk_common.skc_bound_dev_if
#define sk_bind_node __sk_common.skc_bind_node
#define sk_prot __sk_common.skc_prot
diff --git a/net/core/sock.c b/net/core/sock.c
index 1180a0cb0110..fec892b384a4 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2101,6 +2101,7 @@ EXPORT_SYMBOL(sk_free);
static void sk_init_common(struct sock *sk)
{
+ sk->sk_no_lock = false;
skb_queue_head_init(&sk->sk_receive_queue);
skb_queue_head_init(&sk->sk_write_queue);
skb_queue_head_init(&sk->sk_error_queue);
--
2.35.1
next prev parent reply other threads:[~2022-04-12 23:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-12 20:26 [PATCHSET 0/4] Add support for no-lock sockets Jens Axboe
2022-04-12 20:26 ` Jens Axboe [this message]
2022-04-12 20:26 ` [PATCH 2/4] net: allow sk_prot->release_cb() without sock lock held Jens Axboe
2022-04-12 20:26 ` [PATCH 3/4] net: add support for socket no-lock Jens Axboe
2022-04-12 20:26 ` [PATCH 4/4] io_uring: mark accept direct socket as no-lock Jens Axboe
2022-04-13 0:40 ` [PATCHSET 0/4] Add support for no-lock sockets Eric Dumazet
2022-04-13 1:26 ` Jens Axboe
2022-04-13 1:54 ` Eric Dumazet
2022-04-13 2:01 ` Jens Axboe
2022-04-13 2:05 ` Eric Dumazet
2022-04-13 2:12 ` Jens Axboe
2022-04-13 2:19 ` Eric Dumazet
2022-04-13 2:26 ` Eric Dumazet
2022-04-13 2:27 ` Jens Axboe
2022-04-13 2:32 ` Eric Dumazet
2022-04-13 2:38 ` Jens Axboe
2022-04-13 5:23 ` dust.li
2022-04-13 7:53 ` Paolo Abeni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox