Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

inet: frags: delay fqdir_free_fn()

fqdir_free_fn() is using very expensive rcu_barrier()

When one netns is dismantled, we often call fqdir_exit()
multiple times, typically lauching fqdir_free_fn() twice.

Delaying by one second fqdir_free_fn() helps to reduce
the number of rcu_barrier() calls, and lock contention
on rcu_state.barrier_mutex.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric Dumazet and committed by
David S. Miller
802e12ff b2c919c1

+2 -2
+2 -2
net/ipv4/inet_fragment.c
··· 175 175 } 176 176 } 177 177 178 - static DECLARE_WORK(fqdir_free_work, fqdir_free_fn); 178 + static DECLARE_DELAYED_WORK(fqdir_free_work, fqdir_free_fn); 179 179 180 180 static void fqdir_work_fn(struct work_struct *work) 181 181 { ··· 184 184 rhashtable_free_and_destroy(&fqdir->rhashtable, inet_frags_free_cb, NULL); 185 185 186 186 if (llist_add(&fqdir->free_list, &fqdir_free_list)) 187 - queue_work(system_wq, &fqdir_free_work); 187 + queue_delayed_work(system_wq, &fqdir_free_work, HZ); 188 188 } 189 189 190 190 int fqdir_init(struct fqdir **fqdirp, struct inet_frags *f, struct net *net)