* [PATCH net-next] tcp/dccp: add SLAB_DESTROY_BY_RCU flag for request sockets
@ 2015-10-03 13:27 Eric Dumazet
2015-10-03 20:25 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2015-10-03 13:27 UTC (permalink / raw)
To: David Miller; +Cc: netdev
From: Eric Dumazet <edumazet@google.com>
Before letting request sockets being put in TCP/DCCP regular
ehash table, we need to add either :
- SLAB_DESTROY_BY_RCU flag to their kmem_cache
- add RCU grace period before freeing them.
Since we carefully respected the SLAB_DESTROY_BY_RCU protocol
like ESTABLISH and TIMEWAIT sockets, use it here.
req_prot_init() being only used by TCP and DCCP, I did not add
a new slab_flags into their rsk_prot, but reuse prot->slab_flags
Since all reqsk_alloc() users are correctly dealing with a failure,
add the __GFP_NOWARN flag to avoid traces under pressure.
Fixes: 079096f103fa ("tcp/dccp: install syn_recv requests into ehash table")
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
include/net/request_sock.h | 4 +++-
net/core/sock.c | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index bae6936d75c4..dd423d840852 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -82,7 +82,9 @@ static inline struct sock *req_to_sk(struct request_sock *req)
static inline struct request_sock *
reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener)
{
- struct request_sock *req = kmem_cache_alloc(ops->slab, GFP_ATOMIC);
+ struct request_sock *req;
+
+ req = kmem_cache_alloc(ops->slab, GFP_ATOMIC | __GFP_NOWARN);
if (req) {
req->rsk_ops = ops;
diff --git a/net/core/sock.c b/net/core/sock.c
index 3307c02244d3..7dd1263e4c24 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2758,7 +2758,7 @@ static int req_prot_init(const struct proto *prot)
rsk_prot->slab = kmem_cache_create(rsk_prot->slab_name,
rsk_prot->obj_size, 0,
- 0, NULL);
+ prot->slab_flags, NULL);
if (!rsk_prot->slab) {
pr_crit("%s: Can't create request sock SLAB cache!\n",
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] tcp/dccp: add SLAB_DESTROY_BY_RCU flag for request sockets
2015-10-03 13:27 [PATCH net-next] tcp/dccp: add SLAB_DESTROY_BY_RCU flag for request sockets Eric Dumazet
@ 2015-10-03 20:25 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-10-03 20:25 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 03 Oct 2015 06:27:28 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> Before letting request sockets being put in TCP/DCCP regular
> ehash table, we need to add either :
>
> - SLAB_DESTROY_BY_RCU flag to their kmem_cache
> - add RCU grace period before freeing them.
>
> Since we carefully respected the SLAB_DESTROY_BY_RCU protocol
> like ESTABLISH and TIMEWAIT sockets, use it here.
>
> req_prot_init() being only used by TCP and DCCP, I did not add
> a new slab_flags into their rsk_prot, but reuse prot->slab_flags
>
> Since all reqsk_alloc() users are correctly dealing with a failure,
> add the __GFP_NOWARN flag to avoid traces under pressure.
>
> Fixes: 079096f103fa ("tcp/dccp: install syn_recv requests into ehash table")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, thanks Eric.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-03 20:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-03 13:27 [PATCH net-next] tcp/dccp: add SLAB_DESTROY_BY_RCU flag for request sockets Eric Dumazet
2015-10-03 20:25 ` David Miller
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).