netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: netdev@vger.kernel.org
Cc: herbert@gondor.apana.org.au, steffen.klassert@secunet.com,
	noel@familie-kuntze.de, tobias@strongswan.org,
	Florian Westphal <fw@strlen.de>
Subject: [PATCH ipsec-next 0/4] xfrm: speed up policy insertions
Date: Thu, 22 Aug 2024 15:04:28 +0200	[thread overview]
Message-ID: <20240822130643.5808-1-fw@strlen.de> (raw)

Policy insertions do not scale well, due to both a lienar list walk
to find the insertion spot and another list walk to set the 'pos' value
(a tie-breaker to detect which policy is older when there is ambiguity
 as to which one should be matched).

First patch gets rid of the second list walk on insert.
Rest of the patches get rid of the insertion walk.

This list walk was only needed because when I moved the policy db
implementation to rbtree I retained the old insertion method for the
sake of XFRM_MIGRATE.

Switching that to tree-based lookup avoids the need for the full
list search.

After this, insertion of a policy is largely independent of the number
of pre-existing policies as long as they do not share the same source/
destination networks.

Note that this is compile tested only as I did not find any
tests for XFRM_MIGRATE.

Florian Westphal (4):
  selftests: add xfrm policy insertion speed test script
  xfrm: policy: don't iterate inexact policies twice at insert time
  xfrm: switch migrate to xfrm_policy_lookup_bytype
  xfrm: policy: remove remaining use of inexact list

 include/net/xfrm.h                            |   1 -
 net/xfrm/xfrm_policy.c                        | 201 ++++++++----------
 tools/testing/selftests/net/Makefile          |   2 +-
 .../selftests/net/xfrm_policy_add_speed.sh    |  83 ++++++++
 4 files changed, 175 insertions(+), 112 deletions(-)
 create mode 100755 tools/testing/selftests/net/xfrm_policy_add_speed.sh

-- 
2.44.2


             reply	other threads:[~2024-08-22 13:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-22 13:04 Florian Westphal [this message]
2024-08-22 13:04 ` [PATCH ipsec-next 1/4] selftests: add xfrm policy insertion speed test script Florian Westphal
2024-08-22 13:04 ` [PATCH ipsec-next 2/4] xfrm: policy: don't iterate inexact policies twice at insert time Florian Westphal
2024-08-22 13:04 ` [PATCH ipsec-next 3/4] xfrm: switch migrate to xfrm_policy_lookup_bytype Florian Westphal
2024-08-30 14:49   ` Julian Wiedmann
2024-08-30 14:39     ` [PATCH ipsec-next] xfrm: policy: fix null dereference Florian Westphal
2024-08-30 16:37       ` Simon Horman
2024-09-10  6:43       ` Steffen Klassert
2024-08-22 13:04 ` [PATCH ipsec-next 4/4] xfrm: policy: remove remaining use of inexact list Florian Westphal
2024-08-27  8:55 ` [PATCH ipsec-next 0/4] xfrm: speed up policy insertions Steffen Klassert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240822130643.5808-1-fw@strlen.de \
    --to=fw@strlen.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    --cc=noel@familie-kuntze.de \
    --cc=steffen.klassert@secunet.com \
    --cc=tobias@strongswan.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).