All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC net-next 00/20] net/ipv6: Separate data structures for FIB and data path
@ 2018-02-25 19:47 David Ahern
  2018-02-25 19:47 ` [PATCH RFC net-next 01/20] net: Move fib_convert_metrics to dst core David Ahern
                   ` (19 more replies)
  0 siblings, 20 replies; 48+ messages in thread
From: David Ahern @ 2018-02-25 19:47 UTC (permalink / raw)
  To: netdev
  Cc: davem, idosch, roopa, eric.dumazet, weiwan, kafai, yoshfuji, David Ahern

IPv6 uses the same data struct for both control plane (FIB entries) and
data path (dst entries). This struct has elements needed for both paths
adding memory overhead and complexity (taking a dst hold in most places
but an additional reference on rt6i_ref in a few). Furthermore, because
of the dst_alloc tie, all FIB entries are allocated with GFP_ATOMIC.

This patch set separates FIB entries from dst entries, better aligning
IPv6 code with IPv4, simplifying the reference counting and allowing
FIB entries added by userspace (not autoconf) to use GFP_KERNEL. It is
first step to a number of performance and scalability changes.

The end result of this patch set:
  - FIB entries (fib6_info):
        /* size: 208, cachelines: 4, members: 25 */
        /* sum members: 207, holes: 1, sum holes: 1 */

  - dst entries (rt6_info)
       /* size: 240, cachelines: 4, members: 12 */

Versus the the single rt6_info struct today for both paths:
      /* size: 320, cachelines: 5, members: 28 */

This amounts to a 35% reduction in memory use for FIB entries and a
25% reduction for dst entries.

With respect to locking FIB entries use RCU and a single atomic
counter with fib6_info_hold and fib6_info_release helpers to manage
the reference counting. dst entries use only the traditional dst
refcounts with dst_hold and dst_release.

FIB entries for host routes are referenced by inet6_ifaddr and
ifacaddr6. In both cases, additional holds are taken -- similar to
what is done for devices.

This set is the first of many changes to improve the scalability of the
IPv6 code. Follow on changes include:
- consolidating duplicate fib6_info references like IPv4 does with
  duplicate fib_info

- moving fib6_info into a slab cache to avoid allocation roundups to
  power of 2 (the 208 size becomes a 256 actual allocation)

- Allow FIB lookups without generating a dst (e.g., most rt6_lookup
  users just want to verify the egress device). Means moving dst
  allocation to the other side of fib6_rule_lookup which again aligns
  with IPv4 behavior

- using separate standalone nexthop objects which have performance
  benefits beyond fib_info consolidation

At this point I am not seeing any refcount leaks or underflows, no
oops or bug_ons, or warnings from kasan, so I think it is ready for
others to beat up on it finding errors in code paths I have missed.

David Ahern (20):
  net: Move fib_convert_metrics to dst core
  vrf: Move fib6_table into net_vrf
  net/ipv6: Pass net to fib6_update_sernum
  net/ipv6: Pass net namespace to route functions
  net/ipv6: Move support functions up in route.c
  net/ipv6: Save route type in rt6_info flags
  net/ipv6: Move nexthop data to fib6_nh
  net/ipv6: Defer initialization of dst to data path
  net/ipv6: move metrics from dst to rt6_info
  net/ipv6: move expires into rt6_info
  net/ipv6: Add fib6_null_entry
  net/ipv6: Add rt6_info create function for ip6_pol_route_lookup
  net/ipv6: Move dst flags to booleans in fib entries
  net/ipv6: Create a neigh_lookup for FIB entries
  net/ipv6: Add gfp_flags to route add functions
  net/ipv6: Cleanup exception route handling
  net/ipv6: introduce fib6_info struct and helpers
  net/ipv6: separate handling of FIB entries from dst based routes
  net/ipv6: Flip FIB entries to fib6_info
  net/ipv6: Remove unused code and variables for rt6_info

 .../net/ethernet/mellanox/mlxsw/spectrum_router.c  |   96 +-
 drivers/net/vrf.c                                  |   25 +-
 include/net/dst.h                                  |    3 +
 include/net/if_inet6.h                             |    4 +-
 include/net/ip6_fib.h                              |  146 ++-
 include/net/ip6_route.h                            |   46 +-
 include/net/netns/ipv6.h                           |    3 +-
 net/core/dst.c                                     |   49 +
 net/ipv4/fib_semantics.c                           |   43 +-
 net/ipv6/addrconf.c                                |  131 +-
 net/ipv6/anycast.c                                 |   21 +-
 net/ipv6/ip6_fib.c                                 |  344 +++--
 net/ipv6/ip6_output.c                              |    3 +-
 net/ipv6/ndisc.c                                   |   35 +-
 net/ipv6/route.c                                   | 1361 ++++++++++----------
 net/ipv6/xfrm6_policy.c                            |    2 -
 16 files changed, 1183 insertions(+), 1129 deletions(-)

-- 
2.11.0

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

end of thread, other threads:[~2018-02-28 22:56 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-25 19:47 [PATCH RFC net-next 00/20] net/ipv6: Separate data structures for FIB and data path David Ahern
2018-02-25 19:47 ` [PATCH RFC net-next 01/20] net: Move fib_convert_metrics to dst core David Ahern
2018-02-26 19:05   ` David Miller
2018-02-26 20:07     ` David Ahern
2018-02-25 19:47 ` [PATCH RFC net-next 02/20] vrf: Move fib6_table into net_vrf David Ahern
2018-02-26 19:08   ` David Miller
2018-02-26 20:13     ` David Ahern
2018-02-26 20:34       ` David Miller
2018-02-25 19:47 ` [PATCH RFC net-next 03/20] net/ipv6: Pass net to fib6_update_sernum David Ahern
2018-02-25 19:47 ` [PATCH RFC net-next 04/20] net/ipv6: Pass net namespace to route functions David Ahern
2018-02-25 19:47 ` [PATCH RFC net-next 05/20] net/ipv6: Move support functions up in route.c David Ahern
2018-02-25 19:47 ` [PATCH RFC net-next 06/20] net/ipv6: Save route type in rt6_info flags David Ahern
2018-02-25 19:47 ` [PATCH RFC net-next 07/20] net/ipv6: Move nexthop data to fib6_nh David Ahern
2018-02-26 22:28   ` Wei Wang
2018-02-26 22:47     ` David Ahern
2018-02-26 23:05       ` Wei Wang
2018-02-25 19:47 ` [PATCH RFC net-next 08/20] net/ipv6: Defer initialization of dst to data path David Ahern
2018-02-26 19:17   ` David Miller
2018-02-26 20:20     ` David Ahern
2018-02-26 20:22       ` David Miller
2018-02-25 19:47 ` [PATCH RFC net-next 09/20] net/ipv6: move metrics from dst to rt6_info David Ahern
2018-02-27  0:01   ` [net/ipv6] 15c9251fd2: BUG:unable_to_handle_kernel kernel test robot
2018-02-27  0:01     ` kernel test robot
2018-02-25 19:47 ` [PATCH RFC net-next 10/20] net/ipv6: move expires into rt6_info David Ahern
2018-02-26 22:28   ` Wei Wang
2018-02-26 22:55     ` David Ahern
2018-02-27  0:31       ` Wei Wang
2018-02-28 19:21       ` Martin KaFai Lau
2018-02-28 22:25         ` David Ahern
2018-02-28 22:56           ` Martin KaFai Lau
2018-02-25 19:47 ` [PATCH RFC net-next 11/20] net/ipv6: Add fib6_null_entry David Ahern
2018-02-25 19:47 ` [PATCH RFC net-next 12/20] net/ipv6: Add rt6_info create function for ip6_pol_route_lookup David Ahern
2018-02-25 19:47 ` [PATCH RFC net-next 13/20] net/ipv6: Move dst flags to booleans in fib entries David Ahern
2018-02-25 19:47 ` [PATCH RFC net-next 14/20] net/ipv6: Create a neigh_lookup for FIB entries David Ahern
2018-02-25 19:47 ` [PATCH RFC net-next 15/20] net/ipv6: Add gfp_flags to route add functions David Ahern
2018-02-25 19:47 ` [PATCH RFC net-next 16/20] net/ipv6: Cleanup exception route handling David Ahern
2018-02-26 19:27   ` David Miller
2018-02-26 20:25     ` David Ahern
2018-02-26 20:29       ` David Miller
2018-02-26 22:29   ` Wei Wang
2018-02-26 23:02     ` David Ahern
2018-02-27  0:32       ` Wei Wang
2018-02-25 19:47 ` [PATCH RFC net-next 17/20] net/ipv6: introduce fib6_info struct and helpers David Ahern
2018-02-25 19:47 ` [PATCH RFC net-next 18/20] net/ipv6: separate handling of FIB entries from dst based routes David Ahern
2018-02-28 18:44   ` Martin KaFai Lau
2018-02-28 20:10     ` David Ahern
2018-02-25 19:47 ` [PATCH RFC net-next 19/20] net/ipv6: Flip FIB entries to fib6_info David Ahern
2018-02-25 19:47 ` [PATCH RFC net-next 20/20] net/ipv6: Remove unused code and variables for rt6_info David Ahern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.