* [PATCH net-next 0/4] net: remove clear_sk() method
@ 2016-08-23 18:39 Eric Dumazet
2016-08-23 18:39 ` [PATCH net-next 1/4] ipv6: udp: remove udp_v6_clear_sk() Eric Dumazet
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Eric Dumazet @ 2016-08-23 18:39 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet
Since IPv6 socket lookups no longer dereference pinet6 pointer
and UDP lost SLAB_DESTROY_BY_RCU special rules, we no longer
need special clear_sk() methods.
Eric Dumazet (4):
ipv6: udp: remove udp_v6_clear_sk()
udp: get rid of sk_prot_clear_portaddr_nulls()
ipv6: tcp: get rid of tcp_v6_clear_sk()
net: remove clear_sk() method
include/net/sock.h | 3 ---
net/core/sock.c | 26 ++------------------------
net/ipv4/udp.c | 1 -
net/ipv4/udplite.c | 1 -
net/ipv6/tcp_ipv6.c | 12 ------------
net/ipv6/udp.c | 12 ------------
net/ipv6/udp_impl.h | 2 --
net/ipv6/udplite.c | 1 -
8 files changed, 2 insertions(+), 56 deletions(-)
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next 1/4] ipv6: udp: remove udp_v6_clear_sk()
2016-08-23 18:39 [PATCH net-next 0/4] net: remove clear_sk() method Eric Dumazet
@ 2016-08-23 18:39 ` Eric Dumazet
2016-08-23 18:39 ` [PATCH net-next 2/4] udp: get rid of sk_prot_clear_portaddr_nulls() Eric Dumazet
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2016-08-23 18:39 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet
Now RCU lookups of ipv6 udp sockets no longer dereference
pinet6 field, we can get rid of udp_v6_clear_sk() helper.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/ipv6/udp.c | 13 +------------
net/ipv6/udp_impl.h | 2 --
net/ipv6/udplite.c | 2 +-
3 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 81e2f98b958d..c86b9417f44e 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1424,17 +1424,6 @@ void udp6_proc_exit(struct net *net)
}
#endif /* CONFIG_PROC_FS */
-void udp_v6_clear_sk(struct sock *sk, int size)
-{
- struct inet_sock *inet = inet_sk(sk);
-
- /* we do not want to clear pinet6 field, because of RCU lookups */
- sk_prot_clear_portaddr_nulls(sk, offsetof(struct inet_sock, pinet6));
-
- size -= offsetof(struct inet_sock, pinet6) + sizeof(inet->pinet6);
- memset(&inet->pinet6 + 1, 0, size);
-}
-
/* ------------------------------------------------------------------------ */
struct proto udpv6_prot = {
@@ -1466,7 +1455,7 @@ struct proto udpv6_prot = {
.compat_setsockopt = compat_udpv6_setsockopt,
.compat_getsockopt = compat_udpv6_getsockopt,
#endif
- .clear_sk = udp_v6_clear_sk,
+ .clear_sk = sk_prot_clear_portaddr_nulls,
};
static struct inet_protosw udpv6_protosw = {
diff --git a/net/ipv6/udp_impl.h b/net/ipv6/udp_impl.h
index 0682c031ccdc..f6eb1ab34f4b 100644
--- a/net/ipv6/udp_impl.h
+++ b/net/ipv6/udp_impl.h
@@ -29,8 +29,6 @@ int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock,
int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
void udpv6_destroy_sock(struct sock *sk);
-void udp_v6_clear_sk(struct sock *sk, int size);
-
#ifdef CONFIG_PROC_FS
int udp6_seq_show(struct seq_file *seq, void *v);
#endif
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c
index 9cf097e206e9..118057a5b759 100644
--- a/net/ipv6/udplite.c
+++ b/net/ipv6/udplite.c
@@ -56,7 +56,7 @@ struct proto udplitev6_prot = {
.compat_setsockopt = compat_udpv6_setsockopt,
.compat_getsockopt = compat_udpv6_getsockopt,
#endif
- .clear_sk = udp_v6_clear_sk,
+ .clear_sk = sk_prot_clear_portaddr_nulls,
};
static struct inet_protosw udplite6_protosw = {
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 2/4] udp: get rid of sk_prot_clear_portaddr_nulls()
2016-08-23 18:39 [PATCH net-next 0/4] net: remove clear_sk() method Eric Dumazet
2016-08-23 18:39 ` [PATCH net-next 1/4] ipv6: udp: remove udp_v6_clear_sk() Eric Dumazet
@ 2016-08-23 18:39 ` Eric Dumazet
2016-08-23 18:39 ` [PATCH net-next 3/4] ipv6: tcp: get rid of tcp_v6_clear_sk() Eric Dumazet
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2016-08-23 18:39 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet
Since we no longer use SLAB_DESTROY_BY_RCU for UDP,
we do not need sk_prot_clear_portaddr_nulls() helper.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
include/net/sock.h | 2 --
net/core/sock.c | 18 ------------------
net/ipv4/udp.c | 1 -
net/ipv4/udplite.c | 1 -
net/ipv6/udp.c | 1 -
net/ipv6/udplite.c | 1 -
6 files changed, 24 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 2aab9b63bf16..1bc57609f8e1 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1242,8 +1242,6 @@ static inline int __sk_prot_rehash(struct sock *sk)
return sk->sk_prot->hash(sk);
}
-void sk_prot_clear_portaddr_nulls(struct sock *sk, int size);
-
/* About 10 seconds */
#define SOCK_DESTROY_TIME (10*HZ)
diff --git a/net/core/sock.c b/net/core/sock.c
index 25dab8b60223..2b09c2967e21 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1315,24 +1315,6 @@ static void sock_copy(struct sock *nsk, const struct sock *osk)
#endif
}
-void sk_prot_clear_portaddr_nulls(struct sock *sk, int size)
-{
- unsigned long nulls1, nulls2;
-
- nulls1 = offsetof(struct sock, __sk_common.skc_node.next);
- nulls2 = offsetof(struct sock, __sk_common.skc_portaddr_node.next);
- if (nulls1 > nulls2)
- swap(nulls1, nulls2);
-
- if (nulls1 != 0)
- memset((char *)sk, 0, nulls1);
- memset((char *)sk + nulls1 + sizeof(void *), 0,
- nulls2 - nulls1 - sizeof(void *));
- memset((char *)sk + nulls2 + sizeof(void *), 0,
- size - nulls2 - sizeof(void *));
-}
-EXPORT_SYMBOL(sk_prot_clear_portaddr_nulls);
-
static struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority,
int family)
{
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 8f5f7f6026f7..5c5807612cc0 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2223,7 +2223,6 @@ struct proto udp_prot = {
.compat_setsockopt = compat_udp_setsockopt,
.compat_getsockopt = compat_udp_getsockopt,
#endif
- .clear_sk = sk_prot_clear_portaddr_nulls,
};
EXPORT_SYMBOL(udp_prot);
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c
index 3b3efbda48e1..67fc9d96e67d 100644
--- a/net/ipv4/udplite.c
+++ b/net/ipv4/udplite.c
@@ -61,7 +61,6 @@ struct proto udplite_prot = {
.compat_setsockopt = compat_udp_setsockopt,
.compat_getsockopt = compat_udp_getsockopt,
#endif
- .clear_sk = sk_prot_clear_portaddr_nulls,
};
EXPORT_SYMBOL(udplite_prot);
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index c86b9417f44e..9f0b025cc750 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1455,7 +1455,6 @@ struct proto udpv6_prot = {
.compat_setsockopt = compat_udpv6_setsockopt,
.compat_getsockopt = compat_udpv6_getsockopt,
#endif
- .clear_sk = sk_prot_clear_portaddr_nulls,
};
static struct inet_protosw udpv6_protosw = {
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c
index 118057a5b759..5cf0099b86f7 100644
--- a/net/ipv6/udplite.c
+++ b/net/ipv6/udplite.c
@@ -56,7 +56,6 @@ struct proto udplitev6_prot = {
.compat_setsockopt = compat_udpv6_setsockopt,
.compat_getsockopt = compat_udpv6_getsockopt,
#endif
- .clear_sk = sk_prot_clear_portaddr_nulls,
};
static struct inet_protosw udplite6_protosw = {
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 3/4] ipv6: tcp: get rid of tcp_v6_clear_sk()
2016-08-23 18:39 [PATCH net-next 0/4] net: remove clear_sk() method Eric Dumazet
2016-08-23 18:39 ` [PATCH net-next 1/4] ipv6: udp: remove udp_v6_clear_sk() Eric Dumazet
2016-08-23 18:39 ` [PATCH net-next 2/4] udp: get rid of sk_prot_clear_portaddr_nulls() Eric Dumazet
@ 2016-08-23 18:39 ` Eric Dumazet
2016-08-23 18:39 ` [PATCH net-next 4/4] net: remove clear_sk() method Eric Dumazet
2016-08-24 6:37 ` [PATCH net-next 0/4] " David Miller
4 siblings, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2016-08-23 18:39 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet
Now RCU lookups of IPv6 TCP sockets no longer dereference pinet6,
we do not need tcp_v6_clear_sk() anymore.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/ipv6/tcp_ipv6.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 33df8b8575cc..e0f46439e391 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1862,17 +1862,6 @@ void tcp6_proc_exit(struct net *net)
}
#endif
-static void tcp_v6_clear_sk(struct sock *sk, int size)
-{
- struct inet_sock *inet = inet_sk(sk);
-
- /* we do not want to clear pinet6 field, because of RCU lookups */
- sk_prot_clear_nulls(sk, offsetof(struct inet_sock, pinet6));
-
- size -= offsetof(struct inet_sock, pinet6) + sizeof(inet->pinet6);
- memset(&inet->pinet6 + 1, 0, size);
-}
-
struct proto tcpv6_prot = {
.name = "TCPv6",
.owner = THIS_MODULE,
@@ -1914,7 +1903,6 @@ struct proto tcpv6_prot = {
.compat_setsockopt = compat_tcp_setsockopt,
.compat_getsockopt = compat_tcp_getsockopt,
#endif
- .clear_sk = tcp_v6_clear_sk,
.diag_destroy = tcp_abort,
};
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 4/4] net: remove clear_sk() method
2016-08-23 18:39 [PATCH net-next 0/4] net: remove clear_sk() method Eric Dumazet
` (2 preceding siblings ...)
2016-08-23 18:39 ` [PATCH net-next 3/4] ipv6: tcp: get rid of tcp_v6_clear_sk() Eric Dumazet
@ 2016-08-23 18:39 ` Eric Dumazet
2016-08-24 6:37 ` [PATCH net-next 0/4] " David Miller
4 siblings, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2016-08-23 18:39 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet
We no longer use this handler, we can delete it.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
include/net/sock.h | 1 -
net/core/sock.c | 8 ++------
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 1bc57609f8e1..c797c57f4d9f 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1020,7 +1020,6 @@ struct proto {
void (*unhash)(struct sock *sk);
void (*rehash)(struct sock *sk);
int (*get_port)(struct sock *sk, unsigned short snum);
- void (*clear_sk)(struct sock *sk, int size);
/* Keeping track of sockets in use */
#ifdef CONFIG_PROC_FS
diff --git a/net/core/sock.c b/net/core/sock.c
index 2b09c2967e21..51a730485649 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1326,12 +1326,8 @@ static struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority,
sk = kmem_cache_alloc(slab, priority & ~__GFP_ZERO);
if (!sk)
return sk;
- if (priority & __GFP_ZERO) {
- if (prot->clear_sk)
- prot->clear_sk(sk, prot->obj_size);
- else
- sk_prot_clear_nulls(sk, prot->obj_size);
- }
+ if (priority & __GFP_ZERO)
+ sk_prot_clear_nulls(sk, prot->obj_size);
} else
sk = kmalloc(prot->obj_size, priority);
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 0/4] net: remove clear_sk() method
2016-08-23 18:39 [PATCH net-next 0/4] net: remove clear_sk() method Eric Dumazet
` (3 preceding siblings ...)
2016-08-23 18:39 ` [PATCH net-next 4/4] net: remove clear_sk() method Eric Dumazet
@ 2016-08-24 6:37 ` David Miller
2016-08-24 13:35 ` Eric Dumazet
4 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2016-08-24 6:37 UTC (permalink / raw)
To: edumazet; +Cc: netdev, eric.dumazet
From: Eric Dumazet <edumazet@google.com>
Date: Tue, 23 Aug 2016 11:39:25 -0700
> Since IPv6 socket lookups no longer dereference pinet6 pointer
> and UDP lost SLAB_DESTROY_BY_RCU special rules, we no longer
> need special clear_sk() methods.
Series applied, thanks Eric.
There were some merge conflicts because I applied David Ahern's
sock diag udp patches first.
Please double check my work.
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 0/4] net: remove clear_sk() method
2016-08-24 6:37 ` [PATCH net-next 0/4] " David Miller
@ 2016-08-24 13:35 ` Eric Dumazet
0 siblings, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2016-08-24 13:35 UTC (permalink / raw)
To: David Miller; +Cc: edumazet, netdev
On Tue, 2016-08-23 at 23:37 -0700, David Miller wrote:
> From: Eric Dumazet <edumazet@google.com>
> Date: Tue, 23 Aug 2016 11:39:25 -0700
>
> > Since IPv6 socket lookups no longer dereference pinet6 pointer
> > and UDP lost SLAB_DESTROY_BY_RCU special rules, we no longer
> > need special clear_sk() methods.
>
> Series applied, thanks Eric.
>
> There were some merge conflicts because I applied David Ahern's
> sock diag udp patches first.
>
> Please double check my work.
Sure, this all looks fine to me, thanks David !
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-08-24 13:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-23 18:39 [PATCH net-next 0/4] net: remove clear_sk() method Eric Dumazet
2016-08-23 18:39 ` [PATCH net-next 1/4] ipv6: udp: remove udp_v6_clear_sk() Eric Dumazet
2016-08-23 18:39 ` [PATCH net-next 2/4] udp: get rid of sk_prot_clear_portaddr_nulls() Eric Dumazet
2016-08-23 18:39 ` [PATCH net-next 3/4] ipv6: tcp: get rid of tcp_v6_clear_sk() Eric Dumazet
2016-08-23 18:39 ` [PATCH net-next 4/4] net: remove clear_sk() method Eric Dumazet
2016-08-24 6:37 ` [PATCH net-next 0/4] " David Miller
2016-08-24 13:35 ` Eric Dumazet
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.