* [PATCH v2 net-next 0/6] af_unix: Introduce per-netns socket hash table.
@ 2022-06-20 18:51 Kuniyuki Iwashima
2022-06-20 18:51 ` [PATCH v2 net-next 1/6] af_unix: Clean up some sock_net() uses Kuniyuki Iwashima
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Kuniyuki Iwashima @ 2022-06-20 18:51 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Amit Shah, Kuniyuki Iwashima, Kuniyuki Iwashima, netdev
This series replaces unix_socket_table with a per-netns hash table and
reduces lock contention and time on iterating over the list.
Note the 3rd-6th patches can be a single patch, but for ease of review,
they are split into small changes without breakage.
Changes:
v2:
3rd:
* Update changelog
* Remove holes from per-netns hash table structure
* Use kvmalloc_array() instead of kmalloc() (Eric Dumazet)
* Remove unnecessary parts in af_unix_init() (Eric Dumazet)
* Move `err_sysctl` label into ifdef block (kernel test robot)
* Remove struct netns_unix from struct net if CONFIG_UNIX is disabled
4th:
* Use spin_lock_nested() (kernel test robot)
v1: https://lore.kernel.org/netdev/20220616234714.4291-1-kuniyu@amazon.com/
Kuniyuki Iwashima (6):
af_unix: Clean up some sock_net() uses.
af_unix: Include the whole hash table size in UNIX_HASH_SIZE.
af_unix: Define a per-netns hash table.
af_unix: Acquire/Release per-netns hash table's locks.
af_unix: Put a socket into a per-netns hash table.
af_unix: Remove unix_table_locks.
include/net/af_unix.h | 5 +-
include/net/net_namespace.h | 2 +
include/net/netns/unix.h | 6 +
net/unix/af_unix.c | 216 +++++++++++++++++++-----------------
net/unix/diag.c | 46 ++++----
5 files changed, 145 insertions(+), 130 deletions(-)
--
2.30.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 net-next 1/6] af_unix: Clean up some sock_net() uses.
2022-06-20 18:51 [PATCH v2 net-next 0/6] af_unix: Introduce per-netns socket hash table Kuniyuki Iwashima
@ 2022-06-20 18:51 ` Kuniyuki Iwashima
2022-06-20 18:51 ` [PATCH v2 net-next 2/6] af_unix: Include the whole hash table size in UNIX_HASH_SIZE Kuniyuki Iwashima
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Kuniyuki Iwashima @ 2022-06-20 18:51 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Amit Shah, Kuniyuki Iwashima, Kuniyuki Iwashima, netdev
Some functions define a net pointer only for one-shot use. Others call
sock_net() redundantly even when a net pointer is available. Let's fix
these and make the code simpler.
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
net/unix/af_unix.c | 33 ++++++++++++++-------------------
net/unix/diag.c | 3 +--
2 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 3453e0053f76..990257f02e7c 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -932,7 +932,7 @@ static struct sock *unix_create1(struct net *net, struct socket *sock, int kern,
memset(&u->scm_stat, 0, sizeof(struct scm_stat));
unix_insert_unbound_socket(sk);
- sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
+ sock_prot_inuse_add(net, sk->sk_prot, 1);
return sk;
@@ -1293,9 +1293,8 @@ static void unix_state_double_unlock(struct sock *sk1, struct sock *sk2)
static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
int alen, int flags)
{
- struct sock *sk = sock->sk;
- struct net *net = sock_net(sk);
struct sockaddr_un *sunaddr = (struct sockaddr_un *)addr;
+ struct sock *sk = sock->sk;
struct sock *other;
int err;
@@ -1316,7 +1315,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
}
restart:
- other = unix_find_other(net, sunaddr, alen, sock->type);
+ other = unix_find_other(sock_net(sk), sunaddr, alen, sock->type);
if (IS_ERR(other)) {
err = PTR_ERR(other);
goto out;
@@ -1404,15 +1403,13 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
int addr_len, int flags)
{
struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr;
- struct sock *sk = sock->sk;
- struct net *net = sock_net(sk);
+ struct sock *sk = sock->sk, *newsk = NULL, *other = NULL;
struct unix_sock *u = unix_sk(sk), *newu, *otheru;
- struct sock *newsk = NULL;
- struct sock *other = NULL;
+ struct net *net = sock_net(sk);
struct sk_buff *skb = NULL;
- int st;
- int err;
long timeo;
+ int err;
+ int st;
err = unix_validate_addr(sunaddr, addr_len);
if (err)
@@ -1432,7 +1429,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
*/
/* create new sock for complete connection */
- newsk = unix_create1(sock_net(sk), NULL, 0, sock->type);
+ newsk = unix_create1(net, NULL, 0, sock->type);
if (IS_ERR(newsk)) {
err = PTR_ERR(newsk);
newsk = NULL;
@@ -1840,17 +1837,15 @@ static void scm_stat_del(struct sock *sk, struct sk_buff *skb)
static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg,
size_t len)
{
- struct sock *sk = sock->sk;
- struct net *net = sock_net(sk);
- struct unix_sock *u = unix_sk(sk);
DECLARE_SOCKADDR(struct sockaddr_un *, sunaddr, msg->msg_name);
- struct sock *other = NULL;
- int err;
- struct sk_buff *skb;
- long timeo;
+ struct sock *sk = sock->sk, *other = NULL;
+ struct unix_sock *u = unix_sk(sk);
struct scm_cookie scm;
+ struct sk_buff *skb;
int data_len = 0;
int sk_locked;
+ long timeo;
+ int err;
wait_for_unix_gc();
err = scm_send(sock, msg, &scm, false);
@@ -1917,7 +1912,7 @@ static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg,
if (sunaddr == NULL)
goto out_free;
- other = unix_find_other(net, sunaddr, msg->msg_namelen,
+ other = unix_find_other(sock_net(sk), sunaddr, msg->msg_namelen,
sk->sk_type);
if (IS_ERR(other)) {
err = PTR_ERR(other);
diff --git a/net/unix/diag.c b/net/unix/diag.c
index bb0b5ea1655f..4e3dc8179fa4 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -308,7 +308,6 @@ static int unix_diag_get_exact(struct sk_buff *in_skb,
static int unix_diag_handler_dump(struct sk_buff *skb, struct nlmsghdr *h)
{
int hdrlen = sizeof(struct unix_diag_req);
- struct net *net = sock_net(skb->sk);
if (nlmsg_len(h) < hdrlen)
return -EINVAL;
@@ -317,7 +316,7 @@ static int unix_diag_handler_dump(struct sk_buff *skb, struct nlmsghdr *h)
struct netlink_dump_control c = {
.dump = unix_diag_dump,
};
- return netlink_dump_start(net->diag_nlsk, skb, h, &c);
+ return netlink_dump_start(sock_net(skb->sk)->diag_nlsk, skb, h, &c);
} else
return unix_diag_get_exact(skb, h, nlmsg_data(h));
}
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 net-next 2/6] af_unix: Include the whole hash table size in UNIX_HASH_SIZE.
2022-06-20 18:51 [PATCH v2 net-next 0/6] af_unix: Introduce per-netns socket hash table Kuniyuki Iwashima
2022-06-20 18:51 ` [PATCH v2 net-next 1/6] af_unix: Clean up some sock_net() uses Kuniyuki Iwashima
@ 2022-06-20 18:51 ` Kuniyuki Iwashima
2022-06-20 18:51 ` [PATCH v2 net-next 3/6] af_unix: Define a per-netns hash table Kuniyuki Iwashima
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Kuniyuki Iwashima @ 2022-06-20 18:51 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Amit Shah, Kuniyuki Iwashima, Kuniyuki Iwashima, netdev
Currently, the size of AF_UNIX hash table is UNIX_HASH_SIZE * 2,
the first half for bind()ed sockets and the second half for unbound
ones. UNIX_HASH_SIZE * 2 is used to define the table and iterate
over it.
In some places, we use ARRAY_SIZE(unix_socket_table) instead of
UNIX_HASH_SIZE * 2. However, we cannot use it anymore because we
will allocate the hash table dynamically. Then, we would have to
add UNIX_HASH_SIZE * 2 in many places, which would be troublesome.
This patch adapts the UNIX_HASH_SIZE definition to include bound
and unbound sockets and defines a new UNIX_HASH_MOD macro to ease
calculations.
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
include/net/af_unix.h | 7 ++++---
net/unix/af_unix.c | 18 +++++++++---------
net/unix/diag.c | 6 ++----
3 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index a7ef624ed726..acb56e463db1 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -16,12 +16,13 @@ void wait_for_unix_gc(void);
struct sock *unix_get_socket(struct file *filp);
struct sock *unix_peer_get(struct sock *sk);
-#define UNIX_HASH_SIZE 256
+#define UNIX_HASH_MOD (256 - 1)
+#define UNIX_HASH_SIZE (256 * 2)
#define UNIX_HASH_BITS 8
extern unsigned int unix_tot_inflight;
-extern spinlock_t unix_table_locks[2 * UNIX_HASH_SIZE];
-extern struct hlist_head unix_socket_table[2 * UNIX_HASH_SIZE];
+extern spinlock_t unix_table_locks[UNIX_HASH_SIZE];
+extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE];
struct unix_address {
refcount_t refcnt;
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 990257f02e7c..c0804ae9c96a 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -118,9 +118,9 @@
#include "scm.h"
-spinlock_t unix_table_locks[2 * UNIX_HASH_SIZE];
+spinlock_t unix_table_locks[UNIX_HASH_SIZE];
EXPORT_SYMBOL_GPL(unix_table_locks);
-struct hlist_head unix_socket_table[2 * UNIX_HASH_SIZE];
+struct hlist_head unix_socket_table[UNIX_HASH_SIZE];
EXPORT_SYMBOL_GPL(unix_socket_table);
static atomic_long_t unix_nr_socks;
@@ -137,12 +137,12 @@ static unsigned int unix_unbound_hash(struct sock *sk)
hash ^= hash >> 8;
hash ^= sk->sk_type;
- return UNIX_HASH_SIZE + (hash & (UNIX_HASH_SIZE - 1));
+ return UNIX_HASH_MOD + 1 + (hash & UNIX_HASH_MOD);
}
static unsigned int unix_bsd_hash(struct inode *i)
{
- return i->i_ino & (UNIX_HASH_SIZE - 1);
+ return i->i_ino & UNIX_HASH_MOD;
}
static unsigned int unix_abstract_hash(struct sockaddr_un *sunaddr,
@@ -155,14 +155,14 @@ static unsigned int unix_abstract_hash(struct sockaddr_un *sunaddr,
hash ^= hash >> 8;
hash ^= type;
- return hash & (UNIX_HASH_SIZE - 1);
+ return hash & UNIX_HASH_MOD;
}
static void unix_table_double_lock(unsigned int hash1, unsigned int hash2)
{
/* hash1 and hash2 is never the same because
- * one is between 0 and UNIX_HASH_SIZE - 1, and
- * another is between UNIX_HASH_SIZE and UNIX_HASH_SIZE * 2.
+ * one is between 0 and UNIX_HASH_MOD, and
+ * another is between UNIX_HASH_MOD + 1 and UNIX_HASH_SIZE - 1.
*/
if (hash1 > hash2)
swap(hash1, hash2);
@@ -3239,7 +3239,7 @@ static struct sock *unix_get_first(struct seq_file *seq, loff_t *pos)
unsigned long bucket = get_bucket(*pos);
struct sock *sk;
- while (bucket < ARRAY_SIZE(unix_socket_table)) {
+ while (bucket < UNIX_HASH_SIZE) {
spin_lock(&unix_table_locks[bucket]);
sk = unix_from_bucket(seq, pos);
@@ -3666,7 +3666,7 @@ static int __init af_unix_init(void)
BUILD_BUG_ON(sizeof(struct unix_skb_parms) > sizeof_field(struct sk_buff, cb));
- for (i = 0; i < 2 * UNIX_HASH_SIZE; i++)
+ for (i = 0; i < UNIX_HASH_SIZE; i++)
spin_lock_init(&unix_table_locks[i]);
rc = proto_register(&unix_dgram_proto, 1);
diff --git a/net/unix/diag.c b/net/unix/diag.c
index 4e3dc8179fa4..c5d1cca72aa5 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -204,9 +204,7 @@ static int unix_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
s_slot = cb->args[0];
num = s_num = cb->args[1];
- for (slot = s_slot;
- slot < ARRAY_SIZE(unix_socket_table);
- s_num = 0, slot++) {
+ for (slot = s_slot; slot < UNIX_HASH_SIZE; s_num = 0, slot++) {
struct sock *sk;
num = 0;
@@ -242,7 +240,7 @@ static struct sock *unix_lookup_by_ino(unsigned int ino)
struct sock *sk;
int i;
- for (i = 0; i < ARRAY_SIZE(unix_socket_table); i++) {
+ for (i = 0; i < UNIX_HASH_SIZE; i++) {
spin_lock(&unix_table_locks[i]);
sk_for_each(sk, &unix_socket_table[i])
if (ino == sock_i_ino(sk)) {
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 net-next 3/6] af_unix: Define a per-netns hash table.
2022-06-20 18:51 [PATCH v2 net-next 0/6] af_unix: Introduce per-netns socket hash table Kuniyuki Iwashima
2022-06-20 18:51 ` [PATCH v2 net-next 1/6] af_unix: Clean up some sock_net() uses Kuniyuki Iwashima
2022-06-20 18:51 ` [PATCH v2 net-next 2/6] af_unix: Include the whole hash table size in UNIX_HASH_SIZE Kuniyuki Iwashima
@ 2022-06-20 18:51 ` Kuniyuki Iwashima
2022-06-20 18:51 ` [PATCH v2 net-next 4/6] af_unix: Acquire/Release per-netns hash table's locks Kuniyuki Iwashima
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Kuniyuki Iwashima @ 2022-06-20 18:51 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Amit Shah, Kuniyuki Iwashima, Kuniyuki Iwashima, netdev
This commit adds a per netns hash table for AF_UNIX, which size is fixed
as UNIX_HASH_SIZE for now.
The first implementation defines a per-netns hash table as a single array
of lock and list:
struct unix_hashbucket {
spinlock_t lock;
struct hlist_head head;
};
struct netns_unix {
struct unix_hashbucket *hash;
...
};
But, Eric pointed out memory cost that the structure has holes because of
sizeof(spinlock_t), which is 4 (or more if LOCKDEP is enabled). [0] It
could be expensive on a host with thousands of netns and few AF_UNIX
sockets. For this reason, a per-netns hash table uses two dense arrays.
struct unix_table {
spinlock_t *locks;
struct hlist_head *buckets;
};
struct netns_unix {
struct unix_table table;
...
};
Note the length of the list has a significant impact rather than lock
contention, so having shared locks can be an option. But, per-netns
locks and lists still perform better than the global locks and per-netns
lists. [1]
Also, this patch adds a change so that struct netns_unix disappears from
struct net if CONFIG_UNIX is disabled.
[0]: https://lore.kernel.org/netdev/CANn89iLVxO5aqx16azNU7p7Z-nz5NrnM5QTqOzueVxEnkVTxyg@mail.gmail.com/
[1]: https://lore.kernel.org/netdev/20220617175215.1769-1-kuniyu@amazon.com/
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
include/net/net_namespace.h | 2 ++
include/net/netns/unix.h | 6 ++++++
net/unix/af_unix.c | 38 +++++++++++++++++++++++++++++++------
3 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index c4f5601f6e32..20a2992901c2 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -120,7 +120,9 @@ struct net {
struct netns_core core;
struct netns_mib mib;
struct netns_packet packet;
+#if IS_ENABLED(CONFIG_UNIX)
struct netns_unix unx;
+#endif
struct netns_nexthop nexthop;
struct netns_ipv4 ipv4;
#if IS_ENABLED(CONFIG_IPV6)
diff --git a/include/net/netns/unix.h b/include/net/netns/unix.h
index 91a3d7e39198..6f1a33df061d 100644
--- a/include/net/netns/unix.h
+++ b/include/net/netns/unix.h
@@ -5,8 +5,14 @@
#ifndef __NETNS_UNIX_H__
#define __NETNS_UNIX_H__
+struct unix_table {
+ spinlock_t *locks;
+ struct hlist_head *buckets;
+};
+
struct ctl_table_header;
struct netns_unix {
+ struct unix_table table;
int sysctl_max_dgram_qlen;
struct ctl_table_header *ctl;
};
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index c0804ae9c96a..cdd12881a39d 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -3559,7 +3559,7 @@ static const struct net_proto_family unix_family_ops = {
static int __net_init unix_net_init(struct net *net)
{
- int error = -ENOMEM;
+ int i;
net->unx.sysctl_max_dgram_qlen = 10;
if (unix_sysctl_register(net))
@@ -3567,18 +3567,44 @@ static int __net_init unix_net_init(struct net *net)
#ifdef CONFIG_PROC_FS
if (!proc_create_net("unix", 0, net->proc_net, &unix_seq_ops,
- sizeof(struct seq_net_private))) {
- unix_sysctl_unregister(net);
- goto out;
+ sizeof(struct seq_net_private)))
+ goto err_sysctl;
+#endif
+
+ net->unx.table.locks = kvmalloc_array(UNIX_HASH_SIZE,
+ sizeof(spinlock_t), GFP_KERNEL);
+ if (!net->unx.table.locks)
+ goto err_proc;
+
+ net->unx.table.buckets = kvmalloc_array(UNIX_HASH_SIZE,
+ sizeof(struct hlist_head),
+ GFP_KERNEL);
+ if (!net->unx.table.buckets)
+ goto free_locks;
+
+ for (i = 0; i < UNIX_HASH_SIZE; i++) {
+ spin_lock_init(&net->unx.table.locks[i]);
+ INIT_HLIST_HEAD(&net->unx.table.buckets[i]);
}
+
+ return 0;
+
+free_locks:
+ kvfree(net->unx.table.locks);
+err_proc:
+#ifdef CONFIG_PROC_FS
+ remove_proc_entry("unix", net->proc_net);
+err_sysctl:
#endif
- error = 0;
+ unix_sysctl_unregister(net);
out:
- return error;
+ return -ENOMEM;
}
static void __net_exit unix_net_exit(struct net *net)
{
+ kvfree(net->unx.table.buckets);
+ kvfree(net->unx.table.locks);
unix_sysctl_unregister(net);
remove_proc_entry("unix", net->proc_net);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 net-next 4/6] af_unix: Acquire/Release per-netns hash table's locks.
2022-06-20 18:51 [PATCH v2 net-next 0/6] af_unix: Introduce per-netns socket hash table Kuniyuki Iwashima
` (2 preceding siblings ...)
2022-06-20 18:51 ` [PATCH v2 net-next 3/6] af_unix: Define a per-netns hash table Kuniyuki Iwashima
@ 2022-06-20 18:51 ` Kuniyuki Iwashima
2022-06-20 18:51 ` [PATCH v2 net-next 5/6] af_unix: Put a socket into a per-netns hash table Kuniyuki Iwashima
2022-06-20 18:51 ` [PATCH v2 net-next 6/6] af_unix: Remove unix_table_locks Kuniyuki Iwashima
5 siblings, 0 replies; 10+ messages in thread
From: Kuniyuki Iwashima @ 2022-06-20 18:51 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Amit Shah, Kuniyuki Iwashima, Kuniyuki Iwashima, netdev
This commit adds extra spin_lock/spin_unlock() for a per-netns
hash table inside the existing ones for unix_table_locks.
As of this commit, sockets are still linked in the global hash
table. After putting sockets in a per-netns hash table and
removing the old one in the next patch, we remove the global
locks in the last patch.
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
net/unix/af_unix.c | 75 +++++++++++++++++++++++++++++++---------------
net/unix/diag.c | 23 +++++++++-----
2 files changed, 66 insertions(+), 32 deletions(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index cdd12881a39d..79f8fc5cdce8 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -158,7 +158,8 @@ static unsigned int unix_abstract_hash(struct sockaddr_un *sunaddr,
return hash & UNIX_HASH_MOD;
}
-static void unix_table_double_lock(unsigned int hash1, unsigned int hash2)
+static void unix_table_double_lock(struct net *net,
+ unsigned int hash1, unsigned int hash2)
{
/* hash1 and hash2 is never the same because
* one is between 0 and UNIX_HASH_MOD, and
@@ -169,10 +170,17 @@ static void unix_table_double_lock(unsigned int hash1, unsigned int hash2)
spin_lock(&unix_table_locks[hash1]);
spin_lock_nested(&unix_table_locks[hash2], SINGLE_DEPTH_NESTING);
+
+ spin_lock(&net->unx.table.locks[hash1]);
+ spin_lock_nested(&net->unx.table.locks[hash2], SINGLE_DEPTH_NESTING);
}
-static void unix_table_double_unlock(unsigned int hash1, unsigned int hash2)
+static void unix_table_double_unlock(struct net *net,
+ unsigned int hash1, unsigned int hash2)
{
+ spin_unlock(&net->unx.table.locks[hash1]);
+ spin_unlock(&net->unx.table.locks[hash2]);
+
spin_unlock(&unix_table_locks[hash1]);
spin_unlock(&unix_table_locks[hash2]);
}
@@ -316,17 +324,21 @@ static void __unix_set_addr_hash(struct sock *sk, struct unix_address *addr,
__unix_insert_socket(sk);
}
-static void unix_remove_socket(struct sock *sk)
+static void unix_remove_socket(struct net *net, struct sock *sk)
{
spin_lock(&unix_table_locks[sk->sk_hash]);
+ spin_lock(&net->unx.table.locks[sk->sk_hash]);
__unix_remove_socket(sk);
+ spin_unlock(&net->unx.table.locks[sk->sk_hash]);
spin_unlock(&unix_table_locks[sk->sk_hash]);
}
-static void unix_insert_unbound_socket(struct sock *sk)
+static void unix_insert_unbound_socket(struct net *net, struct sock *sk)
{
spin_lock(&unix_table_locks[sk->sk_hash]);
+ spin_lock(&net->unx.table.locks[sk->sk_hash]);
__unix_insert_socket(sk);
+ spin_unlock(&net->unx.table.locks[sk->sk_hash]);
spin_unlock(&unix_table_locks[sk->sk_hash]);
}
@@ -356,28 +368,33 @@ static inline struct sock *unix_find_socket_byname(struct net *net,
struct sock *s;
spin_lock(&unix_table_locks[hash]);
+ spin_lock(&net->unx.table.locks[hash]);
s = __unix_find_socket_byname(net, sunname, len, hash);
if (s)
sock_hold(s);
+ spin_unlock(&net->unx.table.locks[hash]);
spin_unlock(&unix_table_locks[hash]);
return s;
}
-static struct sock *unix_find_socket_byinode(struct inode *i)
+static struct sock *unix_find_socket_byinode(struct net *net, struct inode *i)
{
unsigned int hash = unix_bsd_hash(i);
struct sock *s;
spin_lock(&unix_table_locks[hash]);
+ spin_lock(&net->unx.table.locks[hash]);
sk_for_each(s, &unix_socket_table[hash]) {
struct dentry *dentry = unix_sk(s)->path.dentry;
if (dentry && d_backing_inode(dentry) == i) {
sock_hold(s);
+ spin_unlock(&net->unx.table.locks[hash]);
spin_unlock(&unix_table_locks[hash]);
return s;
}
}
+ spin_unlock(&net->unx.table.locks[hash]);
spin_unlock(&unix_table_locks[hash]);
return NULL;
}
@@ -576,12 +593,12 @@ static void unix_sock_destructor(struct sock *sk)
static void unix_release_sock(struct sock *sk, int embrion)
{
struct unix_sock *u = unix_sk(sk);
- struct path path;
struct sock *skpair;
struct sk_buff *skb;
+ struct path path;
int state;
- unix_remove_socket(sk);
+ unix_remove_socket(sock_net(sk), sk);
/* Clear state */
unix_state_lock(sk);
@@ -930,7 +947,7 @@ static struct sock *unix_create1(struct net *net, struct socket *sock, int kern,
init_waitqueue_head(&u->peer_wait);
init_waitqueue_func_entry(&u->peer_wake, unix_dgram_peer_wake_relay);
memset(&u->scm_stat, 0, sizeof(struct scm_stat));
- unix_insert_unbound_socket(sk);
+ unix_insert_unbound_socket(net, sk);
sock_prot_inuse_add(net, sk->sk_prot, 1);
@@ -1015,7 +1032,7 @@ static struct sock *unix_find_bsd(struct net *net, struct sockaddr_un *sunaddr,
if (!S_ISSOCK(inode->i_mode))
goto path_put;
- sk = unix_find_socket_byinode(inode);
+ sk = unix_find_socket_byinode(net, inode);
if (!sk)
goto path_put;
@@ -1074,6 +1091,7 @@ static int unix_autobind(struct sock *sk)
{
unsigned int new_hash, old_hash = sk->sk_hash;
struct unix_sock *u = unix_sk(sk);
+ struct net *net = sock_net(sk);
struct unix_address *addr;
u32 lastnum, ordernum;
int err;
@@ -1102,11 +1120,10 @@ static int unix_autobind(struct sock *sk)
sprintf(addr->name->sun_path + 1, "%05x", ordernum);
new_hash = unix_abstract_hash(addr->name, addr->len, sk->sk_type);
- unix_table_double_lock(old_hash, new_hash);
+ unix_table_double_lock(net, old_hash, new_hash);
- if (__unix_find_socket_byname(sock_net(sk), addr->name, addr->len,
- new_hash)) {
- unix_table_double_unlock(old_hash, new_hash);
+ if (__unix_find_socket_byname(net, addr->name, addr->len, new_hash)) {
+ unix_table_double_unlock(net, old_hash, new_hash);
/* __unix_find_socket_byname() may take long time if many names
* are already in use.
@@ -1124,7 +1141,7 @@ static int unix_autobind(struct sock *sk)
}
__unix_set_addr_hash(sk, addr, new_hash);
- unix_table_double_unlock(old_hash, new_hash);
+ unix_table_double_unlock(net, old_hash, new_hash);
err = 0;
out: mutex_unlock(&u->bindlock);
@@ -1138,6 +1155,7 @@ static int unix_bind_bsd(struct sock *sk, struct sockaddr_un *sunaddr,
(SOCK_INODE(sk->sk_socket)->i_mode & ~current_umask());
unsigned int new_hash, old_hash = sk->sk_hash;
struct unix_sock *u = unix_sk(sk);
+ struct net *net = sock_net(sk);
struct user_namespace *ns; // barf...
struct unix_address *addr;
struct dentry *dentry;
@@ -1178,11 +1196,11 @@ static int unix_bind_bsd(struct sock *sk, struct sockaddr_un *sunaddr,
goto out_unlock;
new_hash = unix_bsd_hash(d_backing_inode(dentry));
- unix_table_double_lock(old_hash, new_hash);
+ unix_table_double_lock(net, old_hash, new_hash);
u->path.mnt = mntget(parent.mnt);
u->path.dentry = dget(dentry);
__unix_set_addr_hash(sk, addr, new_hash);
- unix_table_double_unlock(old_hash, new_hash);
+ unix_table_double_unlock(net, old_hash, new_hash);
mutex_unlock(&u->bindlock);
done_path_create(&parent, dentry);
return 0;
@@ -1205,6 +1223,7 @@ static int unix_bind_abstract(struct sock *sk, struct sockaddr_un *sunaddr,
{
unsigned int new_hash, old_hash = sk->sk_hash;
struct unix_sock *u = unix_sk(sk);
+ struct net *net = sock_net(sk);
struct unix_address *addr;
int err;
@@ -1222,19 +1241,18 @@ static int unix_bind_abstract(struct sock *sk, struct sockaddr_un *sunaddr,
}
new_hash = unix_abstract_hash(addr->name, addr->len, sk->sk_type);
- unix_table_double_lock(old_hash, new_hash);
+ unix_table_double_lock(net, old_hash, new_hash);
- if (__unix_find_socket_byname(sock_net(sk), addr->name, addr->len,
- new_hash))
+ if (__unix_find_socket_byname(net, addr->name, addr->len, new_hash))
goto out_spin;
__unix_set_addr_hash(sk, addr, new_hash);
- unix_table_double_unlock(old_hash, new_hash);
+ unix_table_double_unlock(net, old_hash, new_hash);
mutex_unlock(&u->bindlock);
return 0;
out_spin:
- unix_table_double_unlock(old_hash, new_hash);
+ unix_table_double_unlock(net, old_hash, new_hash);
err = -EADDRINUSE;
out_mutex:
mutex_unlock(&u->bindlock);
@@ -3237,15 +3255,18 @@ static struct sock *unix_from_bucket(struct seq_file *seq, loff_t *pos)
static struct sock *unix_get_first(struct seq_file *seq, loff_t *pos)
{
unsigned long bucket = get_bucket(*pos);
+ struct net *net = seq_file_net(seq);
struct sock *sk;
while (bucket < UNIX_HASH_SIZE) {
spin_lock(&unix_table_locks[bucket]);
+ spin_lock(&net->unx.table.locks[bucket]);
sk = unix_from_bucket(seq, pos);
if (sk)
return sk;
+ spin_unlock(&net->unx.table.locks[bucket]);
spin_unlock(&unix_table_locks[bucket]);
*pos = set_bucket_offset(++bucket, 1);
@@ -3258,11 +3279,13 @@ static struct sock *unix_get_next(struct seq_file *seq, struct sock *sk,
loff_t *pos)
{
unsigned long bucket = get_bucket(*pos);
+ struct net *net = seq_file_net(seq);
for (sk = sk_next(sk); sk; sk = sk_next(sk))
- if (sock_net(sk) == seq_file_net(seq))
+ if (sock_net(sk) == net)
return sk;
+ spin_unlock(&net->unx.table.locks[bucket]);
spin_unlock(&unix_table_locks[bucket]);
*pos = set_bucket_offset(++bucket, 1);
@@ -3292,8 +3315,10 @@ static void unix_seq_stop(struct seq_file *seq, void *v)
{
struct sock *sk = v;
- if (sk)
+ if (sk) {
+ spin_unlock(&seq_file_net(seq)->unx.table.locks[sk->sk_hash]);
spin_unlock(&unix_table_locks[sk->sk_hash]);
+ }
}
static int unix_seq_show(struct seq_file *seq, void *v)
@@ -3381,6 +3406,7 @@ static int bpf_iter_unix_hold_batch(struct seq_file *seq, struct sock *start_sk)
{
struct bpf_unix_iter_state *iter = seq->private;
+ struct net *net = seq_file_net(seq);
unsigned int expected = 1;
struct sock *sk;
@@ -3388,7 +3414,7 @@ static int bpf_iter_unix_hold_batch(struct seq_file *seq, struct sock *start_sk)
iter->batch[iter->end_sk++] = start_sk;
for (sk = sk_next(start_sk); sk; sk = sk_next(sk)) {
- if (sock_net(sk) != seq_file_net(seq))
+ if (sock_net(sk) != net)
continue;
if (iter->end_sk < iter->max_sk) {
@@ -3399,6 +3425,7 @@ static int bpf_iter_unix_hold_batch(struct seq_file *seq, struct sock *start_sk)
expected++;
}
+ spin_unlock(&net->unx.table.locks[start_sk->sk_hash]);
spin_unlock(&unix_table_locks[start_sk->sk_hash]);
return expected;
diff --git a/net/unix/diag.c b/net/unix/diag.c
index c5d1cca72aa5..7fc377435114 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -195,9 +195,9 @@ static int sk_diag_dump(struct sock *sk, struct sk_buff *skb, struct unix_diag_r
static int unix_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
{
- struct unix_diag_req *req;
- int num, s_num, slot, s_slot;
struct net *net = sock_net(skb->sk);
+ int num, s_num, slot, s_slot;
+ struct unix_diag_req *req;
req = nlmsg_data(cb->nlh);
@@ -209,6 +209,7 @@ static int unix_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
num = 0;
spin_lock(&unix_table_locks[slot]);
+ spin_lock(&net->unx.table.locks[slot]);
sk_for_each(sk, &unix_socket_table[slot]) {
if (!net_eq(sock_net(sk), net))
continue;
@@ -220,12 +221,14 @@ static int unix_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq,
NLM_F_MULTI) < 0) {
+ spin_unlock(&net->unx.table.locks[slot]);
spin_unlock(&unix_table_locks[slot]);
goto done;
}
next:
num++;
}
+ spin_unlock(&net->unx.table.locks[slot]);
spin_unlock(&unix_table_locks[slot]);
}
done:
@@ -235,19 +238,22 @@ static int unix_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
return skb->len;
}
-static struct sock *unix_lookup_by_ino(unsigned int ino)
+static struct sock *unix_lookup_by_ino(struct net *net, unsigned int ino)
{
struct sock *sk;
int i;
for (i = 0; i < UNIX_HASH_SIZE; i++) {
spin_lock(&unix_table_locks[i]);
+ spin_lock(&net->unx.table.locks[i]);
sk_for_each(sk, &unix_socket_table[i])
if (ino == sock_i_ino(sk)) {
sock_hold(sk);
+ spin_unlock(&net->unx.table.locks[i]);
spin_unlock(&unix_table_locks[i]);
return sk;
}
+ spin_unlock(&net->unx.table.locks[i]);
spin_unlock(&unix_table_locks[i]);
}
return NULL;
@@ -257,16 +263,17 @@ static int unix_diag_get_exact(struct sk_buff *in_skb,
const struct nlmsghdr *nlh,
struct unix_diag_req *req)
{
- int err = -EINVAL;
- struct sock *sk;
- struct sk_buff *rep;
- unsigned int extra_len;
struct net *net = sock_net(in_skb->sk);
+ unsigned int extra_len;
+ struct sk_buff *rep;
+ struct sock *sk;
+ int err;
+ err = -EINVAL;
if (req->udiag_ino == 0)
goto out_nosk;
- sk = unix_lookup_by_ino(req->udiag_ino);
+ sk = unix_lookup_by_ino(net, req->udiag_ino);
err = -ENOENT;
if (sk == NULL)
goto out_nosk;
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 net-next 5/6] af_unix: Put a socket into a per-netns hash table.
2022-06-20 18:51 [PATCH v2 net-next 0/6] af_unix: Introduce per-netns socket hash table Kuniyuki Iwashima
` (3 preceding siblings ...)
2022-06-20 18:51 ` [PATCH v2 net-next 4/6] af_unix: Acquire/Release per-netns hash table's locks Kuniyuki Iwashima
@ 2022-06-20 18:51 ` Kuniyuki Iwashima
2022-06-20 18:51 ` [PATCH v2 net-next 6/6] af_unix: Remove unix_table_locks Kuniyuki Iwashima
5 siblings, 0 replies; 10+ messages in thread
From: Kuniyuki Iwashima @ 2022-06-20 18:51 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Amit Shah, Kuniyuki Iwashima, Kuniyuki Iwashima, netdev
This commit replaces the global hash table with a per-netns one and removes
the global one.
We now link a socket in each netns's hash table so we can save some netns
comparisons when iterating through a hash bucket.
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
include/net/af_unix.h | 1 -
net/unix/af_unix.c | 50 +++++++++++++++++--------------------------
net/unix/diag.c | 9 +++-----
3 files changed, 23 insertions(+), 37 deletions(-)
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index acb56e463db1..b1748c9b6db2 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -22,7 +22,6 @@ struct sock *unix_peer_get(struct sock *sk);
extern unsigned int unix_tot_inflight;
extern spinlock_t unix_table_locks[UNIX_HASH_SIZE];
-extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE];
struct unix_address {
refcount_t refcnt;
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 79f8fc5cdce8..9d0b07235dbc 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -120,8 +120,6 @@
spinlock_t unix_table_locks[UNIX_HASH_SIZE];
EXPORT_SYMBOL_GPL(unix_table_locks);
-struct hlist_head unix_socket_table[UNIX_HASH_SIZE];
-EXPORT_SYMBOL_GPL(unix_socket_table);
static atomic_long_t unix_nr_socks;
/* SMP locking strategy:
@@ -308,20 +306,20 @@ static void __unix_remove_socket(struct sock *sk)
sk_del_node_init(sk);
}
-static void __unix_insert_socket(struct sock *sk)
+static void __unix_insert_socket(struct net *net, struct sock *sk)
{
DEBUG_NET_WARN_ON_ONCE(!sk_unhashed(sk));
- sk_add_node(sk, &unix_socket_table[sk->sk_hash]);
+ sk_add_node(sk, &net->unx.table.buckets[sk->sk_hash]);
}
-static void __unix_set_addr_hash(struct sock *sk, struct unix_address *addr,
- unsigned int hash)
+static void __unix_set_addr_hash(struct net *net, struct sock *sk,
+ struct unix_address *addr, unsigned int hash)
{
__unix_remove_socket(sk);
smp_store_release(&unix_sk(sk)->addr, addr);
sk->sk_hash = hash;
- __unix_insert_socket(sk);
+ __unix_insert_socket(net, sk);
}
static void unix_remove_socket(struct net *net, struct sock *sk)
@@ -337,7 +335,7 @@ static void unix_insert_unbound_socket(struct net *net, struct sock *sk)
{
spin_lock(&unix_table_locks[sk->sk_hash]);
spin_lock(&net->unx.table.locks[sk->sk_hash]);
- __unix_insert_socket(sk);
+ __unix_insert_socket(net, sk);
spin_unlock(&net->unx.table.locks[sk->sk_hash]);
spin_unlock(&unix_table_locks[sk->sk_hash]);
}
@@ -348,12 +346,9 @@ static struct sock *__unix_find_socket_byname(struct net *net,
{
struct sock *s;
- sk_for_each(s, &unix_socket_table[hash]) {
+ sk_for_each(s, &net->unx.table.buckets[hash]) {
struct unix_sock *u = unix_sk(s);
- if (!net_eq(sock_net(s), net))
- continue;
-
if (u->addr->len == len &&
!memcmp(u->addr->name, sunname, len))
return s;
@@ -384,7 +379,7 @@ static struct sock *unix_find_socket_byinode(struct net *net, struct inode *i)
spin_lock(&unix_table_locks[hash]);
spin_lock(&net->unx.table.locks[hash]);
- sk_for_each(s, &unix_socket_table[hash]) {
+ sk_for_each(s, &net->unx.table.buckets[hash]) {
struct dentry *dentry = unix_sk(s)->path.dentry;
if (dentry && d_backing_inode(dentry) == i) {
@@ -1140,7 +1135,7 @@ static int unix_autobind(struct sock *sk)
goto retry;
}
- __unix_set_addr_hash(sk, addr, new_hash);
+ __unix_set_addr_hash(net, sk, addr, new_hash);
unix_table_double_unlock(net, old_hash, new_hash);
err = 0;
@@ -1199,7 +1194,7 @@ static int unix_bind_bsd(struct sock *sk, struct sockaddr_un *sunaddr,
unix_table_double_lock(net, old_hash, new_hash);
u->path.mnt = mntget(parent.mnt);
u->path.dentry = dget(dentry);
- __unix_set_addr_hash(sk, addr, new_hash);
+ __unix_set_addr_hash(net, sk, addr, new_hash);
unix_table_double_unlock(net, old_hash, new_hash);
mutex_unlock(&u->bindlock);
done_path_create(&parent, dentry);
@@ -1246,7 +1241,7 @@ static int unix_bind_abstract(struct sock *sk, struct sockaddr_un *sunaddr,
if (__unix_find_socket_byname(net, addr->name, addr->len, new_hash))
goto out_spin;
- __unix_set_addr_hash(sk, addr, new_hash);
+ __unix_set_addr_hash(net, sk, addr, new_hash);
unix_table_double_unlock(net, old_hash, new_hash);
mutex_unlock(&u->bindlock);
return 0;
@@ -3239,12 +3234,11 @@ static struct sock *unix_from_bucket(struct seq_file *seq, loff_t *pos)
{
unsigned long offset = get_offset(*pos);
unsigned long bucket = get_bucket(*pos);
- struct sock *sk;
unsigned long count = 0;
+ struct sock *sk;
- for (sk = sk_head(&unix_socket_table[bucket]); sk; sk = sk_next(sk)) {
- if (sock_net(sk) != seq_file_net(seq))
- continue;
+ for (sk = sk_head(&seq_file_net(seq)->unx.table.buckets[bucket]);
+ sk; sk = sk_next(sk)) {
if (++count == offset)
break;
}
@@ -3279,13 +3273,13 @@ static struct sock *unix_get_next(struct seq_file *seq, struct sock *sk,
loff_t *pos)
{
unsigned long bucket = get_bucket(*pos);
- struct net *net = seq_file_net(seq);
- for (sk = sk_next(sk); sk; sk = sk_next(sk))
- if (sock_net(sk) == net)
- return sk;
+ sk = sk_next(sk);
+ if (sk)
+ return sk;
+
- spin_unlock(&net->unx.table.locks[bucket]);
+ spin_unlock(&seq_file_net(seq)->unx.table.locks[bucket]);
spin_unlock(&unix_table_locks[bucket]);
*pos = set_bucket_offset(++bucket, 1);
@@ -3406,7 +3400,6 @@ static int bpf_iter_unix_hold_batch(struct seq_file *seq, struct sock *start_sk)
{
struct bpf_unix_iter_state *iter = seq->private;
- struct net *net = seq_file_net(seq);
unsigned int expected = 1;
struct sock *sk;
@@ -3414,9 +3407,6 @@ static int bpf_iter_unix_hold_batch(struct seq_file *seq, struct sock *start_sk)
iter->batch[iter->end_sk++] = start_sk;
for (sk = sk_next(start_sk); sk; sk = sk_next(sk)) {
- if (sock_net(sk) != net)
- continue;
-
if (iter->end_sk < iter->max_sk) {
sock_hold(sk);
iter->batch[iter->end_sk++] = sk;
@@ -3425,7 +3415,7 @@ static int bpf_iter_unix_hold_batch(struct seq_file *seq, struct sock *start_sk)
expected++;
}
- spin_unlock(&net->unx.table.locks[start_sk->sk_hash]);
+ spin_unlock(&seq_file_net(seq)->unx.table.locks[start_sk->sk_hash]);
spin_unlock(&unix_table_locks[start_sk->sk_hash]);
return expected;
diff --git a/net/unix/diag.c b/net/unix/diag.c
index 7fc377435114..4d0f0ca6a1eb 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -210,9 +210,7 @@ static int unix_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
num = 0;
spin_lock(&unix_table_locks[slot]);
spin_lock(&net->unx.table.locks[slot]);
- sk_for_each(sk, &unix_socket_table[slot]) {
- if (!net_eq(sock_net(sk), net))
- continue;
+ sk_for_each(sk, &net->unx.table.buckets[slot]) {
if (num < s_num)
goto next;
if (!(req->udiag_states & (1 << sk->sk_state)))
@@ -246,13 +244,14 @@ static struct sock *unix_lookup_by_ino(struct net *net, unsigned int ino)
for (i = 0; i < UNIX_HASH_SIZE; i++) {
spin_lock(&unix_table_locks[i]);
spin_lock(&net->unx.table.locks[i]);
- sk_for_each(sk, &unix_socket_table[i])
+ sk_for_each(sk, &net->unx.table.buckets[i]) {
if (ino == sock_i_ino(sk)) {
sock_hold(sk);
spin_unlock(&net->unx.table.locks[i]);
spin_unlock(&unix_table_locks[i]);
return sk;
}
+ }
spin_unlock(&net->unx.table.locks[i]);
spin_unlock(&unix_table_locks[i]);
}
@@ -277,8 +276,6 @@ static int unix_diag_get_exact(struct sk_buff *in_skb,
err = -ENOENT;
if (sk == NULL)
goto out_nosk;
- if (!net_eq(sock_net(sk), net))
- goto out;
err = sock_diag_check_cookie(sk, req->udiag_cookie);
if (err)
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 net-next 6/6] af_unix: Remove unix_table_locks.
2022-06-20 18:51 [PATCH v2 net-next 0/6] af_unix: Introduce per-netns socket hash table Kuniyuki Iwashima
` (4 preceding siblings ...)
2022-06-20 18:51 ` [PATCH v2 net-next 5/6] af_unix: Put a socket into a per-netns hash table Kuniyuki Iwashima
@ 2022-06-20 18:51 ` Kuniyuki Iwashima
2022-06-20 21:39 ` kernel test robot
2022-06-20 21:39 ` kernel test robot
5 siblings, 2 replies; 10+ messages in thread
From: Kuniyuki Iwashima @ 2022-06-20 18:51 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Amit Shah, Kuniyuki Iwashima, Kuniyuki Iwashima, netdev
unix_table_locks are to protect the global hash table, unix_socket_table.
The previous commit removed it, so let's clean up the unnecessary locks.
Here is a test result on EC2 c5.9xlarge where 10 processes run concurrently
in different netns and bind 100,000 sockets for each.
without this series : 1m 38s
with this series : 11s
It is ~10x faster because the global hash table is split into 10 netns in
this case.
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
include/net/af_unix.h | 1 -
net/unix/af_unix.c | 30 ++----------------------------
net/unix/diag.c | 5 -----
3 files changed, 2 insertions(+), 34 deletions(-)
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index b1748c9b6db2..480fa579787e 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -21,7 +21,6 @@ struct sock *unix_peer_get(struct sock *sk);
#define UNIX_HASH_BITS 8
extern unsigned int unix_tot_inflight;
-extern spinlock_t unix_table_locks[UNIX_HASH_SIZE];
struct unix_address {
refcount_t refcnt;
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 9d0b07235dbc..eaf5b5b429c1 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -118,8 +118,6 @@
#include "scm.h"
-spinlock_t unix_table_locks[UNIX_HASH_SIZE];
-EXPORT_SYMBOL_GPL(unix_table_locks);
static atomic_long_t unix_nr_socks;
/* SMP locking strategy:
@@ -166,9 +164,6 @@ static void unix_table_double_lock(struct net *net,
if (hash1 > hash2)
swap(hash1, hash2);
- spin_lock(&unix_table_locks[hash1]);
- spin_lock_nested(&unix_table_locks[hash2], SINGLE_DEPTH_NESTING);
-
spin_lock(&net->unx.table.locks[hash1]);
spin_lock_nested(&net->unx.table.locks[hash2], SINGLE_DEPTH_NESTING);
}
@@ -178,9 +173,6 @@ static void unix_table_double_unlock(struct net *net,
{
spin_unlock(&net->unx.table.locks[hash1]);
spin_unlock(&net->unx.table.locks[hash2]);
-
- spin_unlock(&unix_table_locks[hash1]);
- spin_unlock(&unix_table_locks[hash2]);
}
#ifdef CONFIG_SECURITY_NETWORK
@@ -324,20 +316,16 @@ static void __unix_set_addr_hash(struct net *net, struct sock *sk,
static void unix_remove_socket(struct net *net, struct sock *sk)
{
- spin_lock(&unix_table_locks[sk->sk_hash]);
spin_lock(&net->unx.table.locks[sk->sk_hash]);
__unix_remove_socket(sk);
spin_unlock(&net->unx.table.locks[sk->sk_hash]);
- spin_unlock(&unix_table_locks[sk->sk_hash]);
}
static void unix_insert_unbound_socket(struct net *net, struct sock *sk)
{
- spin_lock(&unix_table_locks[sk->sk_hash]);
spin_lock(&net->unx.table.locks[sk->sk_hash]);
__unix_insert_socket(net, sk);
spin_unlock(&net->unx.table.locks[sk->sk_hash]);
- spin_unlock(&unix_table_locks[sk->sk_hash]);
}
static struct sock *__unix_find_socket_byname(struct net *net,
@@ -362,13 +350,11 @@ static inline struct sock *unix_find_socket_byname(struct net *net,
{
struct sock *s;
- spin_lock(&unix_table_locks[hash]);
spin_lock(&net->unx.table.locks[hash]);
s = __unix_find_socket_byname(net, sunname, len, hash);
if (s)
sock_hold(s);
spin_unlock(&net->unx.table.locks[hash]);
- spin_unlock(&unix_table_locks[hash]);
return s;
}
@@ -377,7 +363,6 @@ static struct sock *unix_find_socket_byinode(struct net *net, struct inode *i)
unsigned int hash = unix_bsd_hash(i);
struct sock *s;
- spin_lock(&unix_table_locks[hash]);
spin_lock(&net->unx.table.locks[hash]);
sk_for_each(s, &net->unx.table.buckets[hash]) {
struct dentry *dentry = unix_sk(s)->path.dentry;
@@ -385,12 +370,10 @@ static struct sock *unix_find_socket_byinode(struct net *net, struct inode *i)
if (dentry && d_backing_inode(dentry) == i) {
sock_hold(s);
spin_unlock(&net->unx.table.locks[hash]);
- spin_unlock(&unix_table_locks[hash]);
return s;
}
}
spin_unlock(&net->unx.table.locks[hash]);
- spin_unlock(&unix_table_locks[hash]);
return NULL;
}
@@ -3253,7 +3236,6 @@ static struct sock *unix_get_first(struct seq_file *seq, loff_t *pos)
struct sock *sk;
while (bucket < UNIX_HASH_SIZE) {
- spin_lock(&unix_table_locks[bucket]);
spin_lock(&net->unx.table.locks[bucket]);
sk = unix_from_bucket(seq, pos);
@@ -3261,7 +3243,6 @@ static struct sock *unix_get_first(struct seq_file *seq, loff_t *pos)
return sk;
spin_unlock(&net->unx.table.locks[bucket]);
- spin_unlock(&unix_table_locks[bucket]);
*pos = set_bucket_offset(++bucket, 1);
}
@@ -3280,7 +3261,6 @@ static struct sock *unix_get_next(struct seq_file *seq, struct sock *sk,
spin_unlock(&seq_file_net(seq)->unx.table.locks[bucket]);
- spin_unlock(&unix_table_locks[bucket]);
*pos = set_bucket_offset(++bucket, 1);
@@ -3309,10 +3289,8 @@ static void unix_seq_stop(struct seq_file *seq, void *v)
{
struct sock *sk = v;
- if (sk) {
+ if (sk)
spin_unlock(&seq_file_net(seq)->unx.table.locks[sk->sk_hash]);
- spin_unlock(&unix_table_locks[sk->sk_hash]);
- }
}
static int unix_seq_show(struct seq_file *seq, void *v)
@@ -3416,7 +3394,6 @@ static int bpf_iter_unix_hold_batch(struct seq_file *seq, struct sock *start_sk)
}
spin_unlock(&seq_file_net(seq)->unx.table.locks[start_sk->sk_hash]);
- spin_unlock(&unix_table_locks[start_sk->sk_hash]);
return expected;
}
@@ -3705,13 +3682,10 @@ static void __init bpf_iter_register(void)
static int __init af_unix_init(void)
{
- int i, rc = -1;
+ int rc = -1;
BUILD_BUG_ON(sizeof(struct unix_skb_parms) > sizeof_field(struct sk_buff, cb));
- for (i = 0; i < UNIX_HASH_SIZE; i++)
- spin_lock_init(&unix_table_locks[i]);
-
rc = proto_register(&unix_dgram_proto, 1);
if (rc != 0) {
pr_crit("%s: Cannot create unix_sock SLAB cache!\n", __func__);
diff --git a/net/unix/diag.c b/net/unix/diag.c
index 4d0f0ca6a1eb..e7f5636daa68 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -208,7 +208,6 @@ static int unix_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
struct sock *sk;
num = 0;
- spin_lock(&unix_table_locks[slot]);
spin_lock(&net->unx.table.locks[slot]);
sk_for_each(sk, &net->unx.table.buckets[slot]) {
if (num < s_num)
@@ -220,14 +219,12 @@ static int unix_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
cb->nlh->nlmsg_seq,
NLM_F_MULTI) < 0) {
spin_unlock(&net->unx.table.locks[slot]);
- spin_unlock(&unix_table_locks[slot]);
goto done;
}
next:
num++;
}
spin_unlock(&net->unx.table.locks[slot]);
- spin_unlock(&unix_table_locks[slot]);
}
done:
cb->args[0] = slot;
@@ -242,7 +239,6 @@ static struct sock *unix_lookup_by_ino(struct net *net, unsigned int ino)
int i;
for (i = 0; i < UNIX_HASH_SIZE; i++) {
- spin_lock(&unix_table_locks[i]);
spin_lock(&net->unx.table.locks[i]);
sk_for_each(sk, &net->unx.table.buckets[i]) {
if (ino == sock_i_ino(sk)) {
@@ -253,7 +249,6 @@ static struct sock *unix_lookup_by_ino(struct net *net, unsigned int ino)
}
}
spin_unlock(&net->unx.table.locks[i]);
- spin_unlock(&unix_table_locks[i]);
}
return NULL;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 net-next 6/6] af_unix: Remove unix_table_locks.
2022-06-20 18:51 ` [PATCH v2 net-next 6/6] af_unix: Remove unix_table_locks Kuniyuki Iwashima
@ 2022-06-20 21:39 ` kernel test robot
2022-06-20 21:53 ` Kuniyuki Iwashima
2022-06-20 21:39 ` kernel test robot
1 sibling, 1 reply; 10+ messages in thread
From: kernel test robot @ 2022-06-20 21:39 UTC (permalink / raw)
To: Kuniyuki Iwashima, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: kbuild-all, netdev, Amit Shah, Kuniyuki Iwashima
Hi Kuniyuki,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/intel-lab-lkp/linux/commits/Kuniyuki-Iwashima/af_unix-Introduce-per-netns-socket-hash-table/20220621-025503
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git dbca1596bbb08318f5e3b3b99f8ca0a0d3830a65
config: arc-defconfig (https://download.01.org/0day-ci/archive/20220621/202206210532.q32y1W52-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/f2cd3aee6929543114a0728717969d9bb2f6fa90
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Kuniyuki-Iwashima/af_unix-Introduce-per-netns-socket-hash-table/20220621-025503
git checkout f2cd3aee6929543114a0728717969d9bb2f6fa90
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
net/unix/diag.c: In function 'unix_lookup_by_ino':
>> net/unix/diag.c:247:46: error: 'unix_table_locks' undeclared (first use in this function); did you mean 'unix_state_lock'?
247 | spin_unlock(&unix_table_locks[i]);
| ^~~~~~~~~~~~~~~~
| unix_state_lock
net/unix/diag.c:247:46: note: each undeclared identifier is reported only once for each function it appears in
vim +247 net/unix/diag.c
22931d3b906cd0 Pavel Emelyanov 2011-12-15 235
a50feb1de03567 Kuniyuki Iwashima 2022-06-20 236 static struct sock *unix_lookup_by_ino(struct net *net, unsigned int ino)
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 237 {
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 238 struct sock *sk;
afd20b9290e184 Kuniyuki Iwashima 2021-11-24 239 int i;
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 240
614d83f20d005b Kuniyuki Iwashima 2022-06-20 241 for (i = 0; i < UNIX_HASH_SIZE; i++) {
a50feb1de03567 Kuniyuki Iwashima 2022-06-20 242 spin_lock(&net->unx.table.locks[i]);
868a38bbd9ad2a Kuniyuki Iwashima 2022-06-20 243 sk_for_each(sk, &net->unx.table.buckets[i]) {
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 244 if (ino == sock_i_ino(sk)) {
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 245 sock_hold(sk);
a50feb1de03567 Kuniyuki Iwashima 2022-06-20 246 spin_unlock(&net->unx.table.locks[i]);
afd20b9290e184 Kuniyuki Iwashima 2021-11-24 @247 spin_unlock(&unix_table_locks[i]);
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 248 return sk;
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 249 }
868a38bbd9ad2a Kuniyuki Iwashima 2022-06-20 250 }
a50feb1de03567 Kuniyuki Iwashima 2022-06-20 251 spin_unlock(&net->unx.table.locks[i]);
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 252 }
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 253 return NULL;
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 254 }
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 255
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 net-next 6/6] af_unix: Remove unix_table_locks.
2022-06-20 18:51 ` [PATCH v2 net-next 6/6] af_unix: Remove unix_table_locks Kuniyuki Iwashima
2022-06-20 21:39 ` kernel test robot
@ 2022-06-20 21:39 ` kernel test robot
1 sibling, 0 replies; 10+ messages in thread
From: kernel test robot @ 2022-06-20 21:39 UTC (permalink / raw)
To: Kuniyuki Iwashima, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: llvm, kbuild-all, netdev, Amit Shah, Kuniyuki Iwashima
Hi Kuniyuki,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/intel-lab-lkp/linux/commits/Kuniyuki-Iwashima/af_unix-Introduce-per-netns-socket-hash-table/20220621-025503
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git dbca1596bbb08318f5e3b3b99f8ca0a0d3830a65
config: i386-randconfig-a012-20220620 (https://download.01.org/0day-ci/archive/20220621/202206210554.YYgdQz8e-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project af6d2a0b6825e71965f3e2701a63c239fa0ad70f)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/f2cd3aee6929543114a0728717969d9bb2f6fa90
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Kuniyuki-Iwashima/af_unix-Introduce-per-netns-socket-hash-table/20220621-025503
git checkout f2cd3aee6929543114a0728717969d9bb2f6fa90
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash net/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> net/unix/diag.c:247:18: error: use of undeclared identifier 'unix_table_locks'
spin_unlock(&unix_table_locks[i]);
^
1 error generated.
vim +/unix_table_locks +247 net/unix/diag.c
22931d3b906cd0 Pavel Emelyanov 2011-12-15 235
a50feb1de03567 Kuniyuki Iwashima 2022-06-20 236 static struct sock *unix_lookup_by_ino(struct net *net, unsigned int ino)
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 237 {
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 238 struct sock *sk;
afd20b9290e184 Kuniyuki Iwashima 2021-11-24 239 int i;
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 240
614d83f20d005b Kuniyuki Iwashima 2022-06-20 241 for (i = 0; i < UNIX_HASH_SIZE; i++) {
a50feb1de03567 Kuniyuki Iwashima 2022-06-20 242 spin_lock(&net->unx.table.locks[i]);
868a38bbd9ad2a Kuniyuki Iwashima 2022-06-20 243 sk_for_each(sk, &net->unx.table.buckets[i]) {
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 244 if (ino == sock_i_ino(sk)) {
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 245 sock_hold(sk);
a50feb1de03567 Kuniyuki Iwashima 2022-06-20 246 spin_unlock(&net->unx.table.locks[i]);
afd20b9290e184 Kuniyuki Iwashima 2021-11-24 @247 spin_unlock(&unix_table_locks[i]);
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 248 return sk;
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 249 }
868a38bbd9ad2a Kuniyuki Iwashima 2022-06-20 250 }
a50feb1de03567 Kuniyuki Iwashima 2022-06-20 251 spin_unlock(&net->unx.table.locks[i]);
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 252 }
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 253 return NULL;
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 254 }
5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 255
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 net-next 6/6] af_unix: Remove unix_table_locks.
2022-06-20 21:39 ` kernel test robot
@ 2022-06-20 21:53 ` Kuniyuki Iwashima
0 siblings, 0 replies; 10+ messages in thread
From: Kuniyuki Iwashima @ 2022-06-20 21:53 UTC (permalink / raw)
To: lkp; +Cc: aams, davem, edumazet, kbuild-all, kuba, kuniyu, netdev, pabeni
From: kernel test robot <lkp@intel.com>
Date: Tue, 21 Jun 2022 05:39:37 +0800
> Hi Kuniyuki,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on net-next/master]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Kuniyuki-Iwashima/af_unix-Introduce-per-netns-socket-hash-table/20220621-025503
> base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git dbca1596bbb08318f5e3b3b99f8ca0a0d3830a65
> config: arc-defconfig (https://download.01.org/0day-ci/archive/20220621/202206210532.q32y1W52-lkp@intel.com/config)
> compiler: arc-elf-gcc (GCC) 11.3.0
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://github.com/intel-lab-lkp/linux/commit/f2cd3aee6929543114a0728717969d9bb2f6fa90
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Kuniyuki-Iwashima/af_unix-Introduce-per-netns-socket-hash-table/20220621-025503
> git checkout f2cd3aee6929543114a0728717969d9bb2f6fa90
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
> net/unix/diag.c: In function 'unix_lookup_by_ino':
> >> net/unix/diag.c:247:46: error: 'unix_table_locks' undeclared (first use in this function); did you mean 'unix_state_lock'?
> 247 | spin_unlock(&unix_table_locks[i]);
> | ^~~~~~~~~~~~~~~~
> | unix_state_lock
> net/unix/diag.c:247:46: note: each undeclared identifier is reported only once for each function it appears in
I'm sorry, CONFIG_UNIX_DIAG was not set in my .config.
I'll respin v3.
Best regards,
Kuniyuki
> vim +247 net/unix/diag.c
>
> 22931d3b906cd0 Pavel Emelyanov 2011-12-15 235
> a50feb1de03567 Kuniyuki Iwashima 2022-06-20 236 static struct sock *unix_lookup_by_ino(struct net *net, unsigned int ino)
> 5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 237 {
> 5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 238 struct sock *sk;
> afd20b9290e184 Kuniyuki Iwashima 2021-11-24 239 int i;
> 5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 240
> 614d83f20d005b Kuniyuki Iwashima 2022-06-20 241 for (i = 0; i < UNIX_HASH_SIZE; i++) {
> a50feb1de03567 Kuniyuki Iwashima 2022-06-20 242 spin_lock(&net->unx.table.locks[i]);
> 868a38bbd9ad2a Kuniyuki Iwashima 2022-06-20 243 sk_for_each(sk, &net->unx.table.buckets[i]) {
> 5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 244 if (ino == sock_i_ino(sk)) {
> 5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 245 sock_hold(sk);
> a50feb1de03567 Kuniyuki Iwashima 2022-06-20 246 spin_unlock(&net->unx.table.locks[i]);
> afd20b9290e184 Kuniyuki Iwashima 2021-11-24 @247 spin_unlock(&unix_table_locks[i]);
> 5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 248 return sk;
> 5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 249 }
> 868a38bbd9ad2a Kuniyuki Iwashima 2022-06-20 250 }
> a50feb1de03567 Kuniyuki Iwashima 2022-06-20 251 spin_unlock(&net->unx.table.locks[i]);
> 5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 252 }
> 5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 253 return NULL;
> 5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 254 }
> 5d3cae8bc39dd3 Pavel Emelyanov 2011-12-15 255
>
> --
> 0-DAY CI Kernel Test Service
> https://01.org/lkp
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-06-20 21:54 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-20 18:51 [PATCH v2 net-next 0/6] af_unix: Introduce per-netns socket hash table Kuniyuki Iwashima
2022-06-20 18:51 ` [PATCH v2 net-next 1/6] af_unix: Clean up some sock_net() uses Kuniyuki Iwashima
2022-06-20 18:51 ` [PATCH v2 net-next 2/6] af_unix: Include the whole hash table size in UNIX_HASH_SIZE Kuniyuki Iwashima
2022-06-20 18:51 ` [PATCH v2 net-next 3/6] af_unix: Define a per-netns hash table Kuniyuki Iwashima
2022-06-20 18:51 ` [PATCH v2 net-next 4/6] af_unix: Acquire/Release per-netns hash table's locks Kuniyuki Iwashima
2022-06-20 18:51 ` [PATCH v2 net-next 5/6] af_unix: Put a socket into a per-netns hash table Kuniyuki Iwashima
2022-06-20 18:51 ` [PATCH v2 net-next 6/6] af_unix: Remove unix_table_locks Kuniyuki Iwashima
2022-06-20 21:39 ` kernel test robot
2022-06-20 21:53 ` Kuniyuki Iwashima
2022-06-20 21:39 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).