From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH v2 net-next 08/12] inet: frags: use rhashtables for reassembly units Date: Fri, 30 Mar 2018 15:43:55 -0700 Message-ID: References: <20180330204236.43675-1-edumazet@google.com> <20180330204236.43675-9-edumazet@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: netdev , Florian Westphal , Herbert Xu , Thomas Graf , Jesper Dangaard Brouer , Alexander Aring , Stefan Schmidt , Kirill Tkhai , Nikolay Aleksandrov To: Eric Dumazet , "David S . Miller" Return-path: Received: from mail-pg0-f52.google.com ([74.125.83.52]:35128 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752384AbeC3Wn6 (ORCPT ); Fri, 30 Mar 2018 18:43:58 -0400 Received: by mail-pg0-f52.google.com with SMTP id j3so5803801pgf.2 for ; Fri, 30 Mar 2018 15:43:58 -0700 (PDT) In-Reply-To: <20180330204236.43675-9-edumazet@google.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 03/30/2018 01:42 PM, Eric Dumazet wrote: > Some applications still rely on IP fragmentation, and to be fair linux > reassembly unit is not working under any serious load. ... > - > static struct inet_frag_queue *inet_frag_alloc(struct netns_frags *nf, > struct inet_frags *f, > void *arg) > { > struct inet_frag_queue *q; > > - if (!nf->high_thresh || frag_mem_limit(nf) > nf->high_thresh) { > - inet_frag_schedule_worker(f); > + if (!nf->high_thresh || frag_mem_limit(nf) > nf->high_thresh) > return NULL; > - } > > q = kmem_cache_zalloc(f->frags_cachep, GFP_ATOMIC); > if (!q) > @@ -374,59 +167,53 @@ static struct inet_frag_queue *inet_frag_alloc(struct netns_frags *nf, > > timer_setup(&q->timer, f->frag_expire, 0); > spin_lock_init(&q->lock); > - refcount_set(&q->refcnt, 1); > + refcount_set(&q->refcnt, 3); > > return q; > } > > static struct inet_frag_queue *inet_frag_create(struct netns_frags *nf, > - struct inet_frags *f, > void *arg) > { > + struct inet_frags *f = nf->f; > struct inet_frag_queue *q; > + int err; > > q = inet_frag_alloc(nf, f, arg); > if (!q) > return NULL; > > - return inet_frag_intern(nf, q, f, arg); > + mod_timer(&q->timer, jiffies + nf->timeout); > + > + err = rhashtable_insert_fast(&nf->rhashtable, &q->node, > + f->rhash_params); > + add_frag_mem_limit(nf, f->qsize); When adding back inet_frag_alloc() to address Kirill feedback, it looks like I forgot to remove this add_frag_mem_limit() :/