net: Batch network namespace destruction.
authorEric W. Biederman <eric@conroxe.ebiederm.org>
Sun, 29 Nov 2009 22:25:27 +0000 (22:25 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Dec 2009 00:15:51 +0000 (16:15 -0800)
commit2b035b39970740722598f7a9d548835f9bdd730f
treea240b595c380b50f783fe8b3d3d4e9cb612cbb30
parentdcbccbd4f1f6ad0f0e169d4b2e816e42bde06f82
net: Batch network namespace destruction.

It is fairly common to kill several network namespaces at once.  Either
because they are nested one inside the other or because they are cooperating
in multiple machine networking experiments.  As the network stack control logic
does not parallelize easily batch up multiple network namespaces existing
together.

To get the full benefit of batching the virtual network devices to be
removed must be all removed in one batch.  For that purpose I have added
a loop after the last network device operations have run that batches
up all remaining network devices and deletes them.

An extra benefit is that the reorganization slightly shrinks the size
of the per network namespace data structures replaceing a work_struct
with a list_head.

In a trivial test with 4K namespaces this change reduced the cost of
a destroying 4K namespaces from 7+ minutes (at 12% cpu) to 44 seconds
(at 60% cpu).  The bulk of that 44s was spent in inet_twsk_purge.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/net_namespace.h
net/core/net_namespace.c