Skip to content

IPVS optimizations, part 2

Julian Anastasov lvs-devel netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest19 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19ipvs: change ip_vs_sched_lock to mutexnet/netfilter/ipvs/ip_vs_sched.c+12 -120 replies
2/19ipvs: preparations for using rcu in schedulersinclude/net/ip_vs.h net/netfilter/ipvs/ip_vs_core.c net/netfilter/ipvs/ip_vs_ctl.c+20 -00 replies
3/19ipvs: add ip_vs_dest_hold and ip_vs_dest_putinclude/net/ip_vs.h net/netfilter/ipvs/ip_vs_conn.c net/netfilter/ipvs/ip_vs_ctl.c +1 more+16 -110 replies
4/19ipvs: convert dh scheduler to rcunet/netfilter/ipvs/ip_vs_dh.c+45 -360 replies
5/19ipvs: convert lblc scheduler to rcunet/netfilter/ipvs/ip_vs_lblc.c+55 -410 replies
6/19ipvs: convert lblcr scheduler to rcunet/netfilter/ipvs/ip_vs_lblcr.c+90 -810 replies
7/19ipvs: convert lc scheduler to rcunet/netfilter/ipvs/ip_vs_lc.c+1 -10 replies
8/19ipvs: convert nq scheduler to rcunet/netfilter/ipvs/ip_vs_nq.c+1 -10 replies
9/19ipvs: convert rr scheduler to rcunet/netfilter/ipvs/ip_vs_rr.c+35 -200 replies
10/19ipvs: convert sed scheduler to rcunet/netfilter/ipvs/ip_vs_sed.c+2 -20 replies
11/19ipvs: convert sh scheduler to rcunet/netfilter/ipvs/ip_vs_sh.c+45 -360 replies
12/19ipvs: convert wlc scheduler to rcunet/netfilter/ipvs/ip_vs_wlc.c+2 -20 replies
13/19ipvs: convert wrr scheduler to rcunet/netfilter/ipvs/ip_vs_wrr.c+103 -640 replies
14/19ipvs: reorganize dest trashinclude/net/ip_vs.h net/netfilter/ipvs/ip_vs_ctl.c+113 -740 replies
15/19ipvs: do not expect result from done_serviceinclude/net/ip_vs.h net/netfilter/ipvs/ip_vs_ctl.c net/netfilter/ipvs/ip_vs_dh.c +5 more+12 -300 replies
16/19ipvs: convert sched_lock to spin lockinclude/net/ip_vs.h net/netfilter/ipvs/ip_vs_ctl.c net/netfilter/ipvs/ip_vs_lblc.c +3 more+33 -330 replies
17/19ipvs: convert dests to rcuinclude/net/ip_vs.h net/netfilter/ipvs/ip_vs_conn.c net/netfilter/ipvs/ip_vs_ctl.c +1 more+27 -260 replies
18/19ipvs: convert services to rcuinclude/net/ip_vs.h net/netfilter/ipvs/ip_vs_core.c net/netfilter/ipvs/ip_vs_ctl.c +15 more+186 -2590 replies
19/19ipvs: do not disable bh for long timenet/netfilter/ipvs/ip_vs_app.c net/netfilter/ipvs/ip_vs_conn.c net/netfilter/ipvs/ip_vs_core.c +9 more+64 -870 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH net-next 00/19] IPVS optimizations, part 2

This is the second patchset with IPVS optimizations.
Now we convert the schedulers, dests and services to RCU.

All patches are for net-next based on the first
patchset v3. The idea is after discussion and review Simon to apply the patchset after a week or so to ipvs-next tree.

The changes in this patchset eliminate global locks
from packet processing by using RCU. There are more details in the patches.

After this patchset the situation is as follows:

- dests:
- lookups under RCU lock allow ip_vs_dest_hold, used for binding dest to conn or to select dest by scheduler
- dests are freed by dest_trash code long after grace period

- services:
- no global read_lock
- lookups under RCU lock allow scheduler to select dests under RCU lock
- grace period implemented with IP_VS_WAIT_WHILE is gone allowing scheduler's dest selection and scheduler reconfiguration to run in parallel

- schedulers:
- schedule method runs under RCU lock, needs _rcu if using svc->destinations, needs _bh suffix to locks because it can be called in LOCAL_OUT hook
- when dest is added, the add_dest method is called instead of update_service
- when dest is deleted, the del_dest method is called instead of update_service
- when dest is updated, the upd_dest method is called instead of update_service
- scheduler can hold dests in its state long after they are unlinked from svc, even without providing del_dest handler. But such dests must not be returned by the schedule method (needs IP_VS_DEST_F_AVAILABLE check)
- sched_data must be freed after grace period and module exit should be delayed with synchronize_rcu to wait all RCU read-side critical sections to complete

- BH:
- we do not disable BHs in LOCAL_OUT and sync code anymore
- _bh suffixes are added to all places that need them, except timer handlers

Julian Anastasov (19):
ipvs: change ip_vs_sched_lock to mutex
ipvs: preparations for using rcu in schedulers
ipvs: add ip_vs_dest_hold and ip_vs_dest_put
ipvs: convert dh scheduler to rcu
ipvs: convert lblc scheduler to rcu
ipvs: convert lblcr scheduler to rcu
ipvs: convert lc scheduler to rcu
ipvs: convert nq scheduler to rcu
ipvs: convert rr scheduler to rcu
ipvs: convert sed scheduler to rcu
ipvs: convert sh scheduler to rcu
ipvs: convert wlc scheduler to rcu
ipvs: convert wrr scheduler to rcu
ipvs: reorganize dest trash
ipvs: do not expect result from done_service
ipvs: convert sched_lock to spin lock
ipvs: convert dests to rcu
ipvs: convert services to rcu
ipvs: do not disable bh for long time

 include/net/ip_vs.h                   |   59 +++--
 net/netfilter/ipvs/ip_vs_app.c        |    4 +-
 net/netfilter/ipvs/ip_vs_conn.c       |   47 ++--
 net/netfilter/ipvs/ip_vs_core.c       |   57 ++---
 net/netfilter/ipvs/ip_vs_ctl.c        |  510 ++++++++++++++++-----------------
 net/netfilter/ipvs/ip_vs_dh.c         |   86 +++---
 net/netfilter/ipvs/ip_vs_ftp.c        |    2 +
 net/netfilter/ipvs/ip_vs_lblc.c       |  115 ++++----
 net/netfilter/ipvs/ip_vs_lblcr.c      |  190 +++++++------
 net/netfilter/ipvs/ip_vs_lc.c         |    3 +-
 net/netfilter/ipvs/ip_vs_nq.c         |    3 +-
 net/netfilter/ipvs/ip_vs_pe.c         |   12 -
 net/netfilter/ipvs/ip_vs_proto_sctp.c |   18 +-
 net/netfilter/ipvs/ip_vs_proto_tcp.c  |   22 +-
 net/netfilter/ipvs/ip_vs_proto_udp.c  |   14 +-
 net/netfilter/ipvs/ip_vs_rr.c         |   64 +++--
 net/netfilter/ipvs/ip_vs_sched.c      |   63 ++---
 net/netfilter/ipvs/ip_vs_sed.c        |    5 +-
 net/netfilter/ipvs/ip_vs_sh.c         |   86 +++---
 net/netfilter/ipvs/ip_vs_sync.c       |   35 +--
 net/netfilter/ipvs/ip_vs_wlc.c        |    5 +-
 net/netfilter/ipvs/ip_vs_wrr.c        |  176 +++++++-----
 net/netfilter/ipvs/ip_vs_xmit.c       |   16 +-
 23 files changed, 819 insertions(+), 773 deletions(-)
Signature · 1 line
1.7.3.4