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() :/