netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2 0/2] refactor the 'ip netns exec' command
@ 2019-06-10 22:16 Matteo Croce
  2019-06-10 22:16 ` [PATCH iproute2 1/2] netns: switch netns in the child when executing commands Matteo Croce
  2019-06-10 22:16 ` [PATCH iproute2 2/2] netns: make netns_{save,restore} static Matteo Croce
  0 siblings, 2 replies; 7+ messages in thread
From: Matteo Croce @ 2019-06-10 22:16 UTC (permalink / raw)
  To: netdev; +Cc: David Ahern, Stephen Hemminger

Refactor the netns code so less steps are needed to exec commands in a netns.
Also remove some code which became dead. bloat-o-meter output:

$ bloat-o-meter ip.old ip
add/remove: 0/5 grow/shrink: 3/3 up/down: 159/-358 (-199)
Function                                     old     new   delta
netns_add                                    971    1058     +87
cmd_exec                                     207     254     +47
on_netns_exec                                 32      57     +25
netns_restore                                 69      67      -2
netns_switch                                 838     822     -16
on_netns_label                                45       -     -45
do_netns                                    1226    1180     -46
vrf_reset                                     55       -     -55
do_each_netns                                 57       -     -57
on_netns                                      60       -     -60
netns_save                                    77       -     -77
Total: Before=667505, After=667306, chg -0.03%

Matteo Croce (2):
  netns: switch netns in the child when executing commands
  netns: make netns_{save,restore} static

 include/namespace.h |  2 --
 include/utils.h     |  5 +----
 ip/ip.c             |  1 -
 ip/ip_common.h      |  1 -
 ip/ipnetns.c        | 49 ++++++++++++++++++++++++++++++++-------------
 ip/ipvrf.c          | 16 +--------------
 lib/exec.c          |  6 +++++-
 lib/namespace.c     | 31 ----------------------------
 lib/utils.c         | 27 -------------------------
 9 files changed, 42 insertions(+), 96 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-06-10 23:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-10 22:16 [PATCH iproute2 0/2] refactor the 'ip netns exec' command Matteo Croce
2019-06-10 22:16 ` [PATCH iproute2 1/2] netns: switch netns in the child when executing commands Matteo Croce
2019-06-10 22:45   ` Stephen Hemminger
2019-06-10 22:52     ` Matteo Croce
2019-06-10 23:03       ` Matteo Croce
2019-06-10 23:11         ` Stephen Hemminger
2019-06-10 22:16 ` [PATCH iproute2 2/2] netns: make netns_{save,restore} static Matteo Croce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).