netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tyler Hicks <tyhicks@linux.microsoft.com>
To: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
Cc: pablo@netfilter.org, kadlec@netfilter.org, fw@strlen.de,
	subashab@codeaurora.org, netfilter-devel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/3] Don't use RCU for x_tables synchronization
Date: Thu, 11 Mar 2021 09:51:25 -0600	[thread overview]
Message-ID: <20210311155125.GA4374@sequoia> (raw)
In-Reply-To: <20210308012413.14383-1-mark.tomlinson@alliedtelesis.co.nz>

On 2021-03-08 14:24:10, Mark Tomlinson wrote:
> The patches to change to using RCU synchronization in x_tables cause
> updating tables to be slowed down by an order of magnitude. This has
> been tried before, see https://lore.kernel.org/patchwork/patch/151796/
> and ultimately was rejected. As mentioned in the patch description, a
> different method can be used to ensure ordering of reads/writes. This
> can simply be done by changing from smp_wmb() to smp_mb().

I came across these patches while trying to root-cause a significant boot time
regression we were seeing when comparing 5.4 to 5.10. The RCU changes were
where I had started to investigate but hadn't yet made it to the point that
Mark had reached when he sent out these fixes.

Mark's description of the problem and fix looks correct to me.

To touch on why the performance regression is a problem for us, we have
three services that load various firewall rules during boot up. Here are
the total run times that `systemd-analyze blame` reported for each one
to run to completion:

5.4.88:

 129ms fw-1.service
 56ms  fw-2.service
 38ms  fw-3.service

5.10.19:
                                                                                            
 586ms fw-1.service
 847ms fw-2.service
 193ms fw-3.service

5.10.19 + these fixes:

 98ms fw-1.service
 25ms fw-2.service
 54ms fw-3.service

You can see that the performance regression from 5.4.88 -> 5.10.19
considerably increased our boot time.

I cannot explain why '5.10.19 + these fixes' shows improvements over
5.4.88 for two of the three services but I suspect it is due to systemd
taking different code paths, units executing at different times,
unrelated kernel performance improvements, etc.

For all three patches,

 Tested-by: Tyler Hicks <tyhicks@linux.microsoft.com>
 Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>

Tyler

> 
> changes in v2:
> - Update commit messages only
> 
> Mark Tomlinson (3):
>   Revert "netfilter: x_tables: Update remaining dereference to RCU"
>   Revert "netfilter: x_tables: Switch synchronization to RCU"
>   netfilter: x_tables: Use correct memory barriers.
> 
>  include/linux/netfilter/x_tables.h |  7 ++---
>  net/ipv4/netfilter/arp_tables.c    | 16 +++++-----
>  net/ipv4/netfilter/ip_tables.c     | 16 +++++-----
>  net/ipv6/netfilter/ip6_tables.c    | 16 +++++-----
>  net/netfilter/x_tables.c           | 49 +++++++++++++++++++++---------
>  5 files changed, 60 insertions(+), 44 deletions(-)
> 
> -- 
> 2.30.1
> 

  parent reply	other threads:[~2021-03-11 15:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08  1:24 [PATCH v2 0/3] Don't use RCU for x_tables synchronization Mark Tomlinson
2021-03-08  1:24 ` [PATCH v2 1/3] Revert "netfilter: x_tables: Update remaining dereference to RCU" Mark Tomlinson
2021-03-08  1:24 ` [PATCH v2 2/3] Revert "netfilter: x_tables: Switch synchronization " Mark Tomlinson
2021-03-08  1:24 ` [PATCH v2 3/3] netfilter: x_tables: Use correct memory barriers Mark Tomlinson
2021-03-09 11:33   ` Florian Westphal
2021-03-11 15:51 ` Tyler Hicks [this message]
2021-03-15 17:42 ` [PATCH v2 0/3] Don't use RCU for x_tables synchronization Pablo Neira Ayuso

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=20210311155125.GA4374@sequoia \
    --to=tyhicks@linux.microsoft.com \
    --cc=fw@strlen.de \
    --cc=kadlec@netfilter.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.tomlinson@alliedtelesis.co.nz \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=subashab@codeaurora.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).