1. 02 Dec, 2009 5 commits
    • Eric W. Biederman's avatar
      net: Automatically allocate per namespace data. · f875bae0
      Eric W. Biederman authored
      To get the full benefit of batched network namespace cleanup netowrk
      device deletion needs to be performed by the generic code.  When
      using register_pernet_gen_device and freeing the data in exit_net
      it is impossible to delay allocation until after exit_net has called
      as the device uninit methods are no longer safe.
      
      To correct this, and to simplify working with per network namespace data
      I have moved allocation and deletion of per network namespace data into
      the network namespace core.  The core now frees the data only after
      all of the network namespace exit routines have run.
      
      Now it is only required to set the new fields .id and .size
      in the pernet_operations structure if you want network namespace
      data to be managed for you automatically.
      
      This makes the current register_pernet_gen_device and
      register_pernet_gen_subsys routines unnecessary.  For the moment
      I have left them as compatibility wrappers in net_namespace.h
      They will be removed once all of the users have been updated.
      Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f875bae0
    • 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
    • Eric W. Biederman's avatar
      net: Implement for_each_netdev_reverse. · dcbccbd4
      Eric W. Biederman authored
      I will need this shortly to implement network namespace shutdown
      batching.  For sanity sake network devices should be removed in
      the reverse order they were created in.
      Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dcbccbd4
    • Eric W. Biederman's avatar
      net: NETDEV_UNREGISTER_PERNET -> NETDEV_UNREGISTER_BATCH · a5ee1551
      Eric W. Biederman authored
      The motivation for an additional notifier in batched netdevice
      notification (rt_do_flush) only needs to be called once per batch not
      once per namespace.
      
      For further batching improvements I need a guarantee that the
      netdevices are unregistered in order allowing me to unregister an all
      of the network devices in a network namespace at the same time with
      the guarantee that the loopback device is really and truly
      unregistered last.
      
      Additionally it appears that we moved the route cache flush after
      the final synchronize_net, which seems wrong and there was no
      explanation.  So I have restored the original location of the final
      synchronize_net.
      
      Cc: Octavian Purdila <opurdila@ixiacom.com>
      Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a5ee1551
    • Arnaldo Carvalho de Melo's avatar
  2. 30 Nov, 2009 29 commits
  3. 29 Nov, 2009 6 commits