Skip to content
  • Eric W. Biederman's avatar
    net: Batch network namespace destruction. · 2b035b39
    Eric W. Biederman authored
    
    
    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: default avatarEric W. Biederman <ebiederm@xmission.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    2b035b39