From: SeongJae Park <sjpark@amazon.com>
To: Eric Dumazet <edumazet@google.com>
Cc: SeongJae Park <sjpark@amazon.com>,
David Miller <davem@davemloft.net>,
SeongJae Park <sjpark@amazon.de>,
Jakub Kicinski <kuba@kernel.org>,
"Alexey Kuznetsov" <kuznet@ms2.inr.ac.ru>,
Florian Westphal <fw@strlen.de>,
"Paul E. McKenney" <paulmck@kernel.org>,
netdev <netdev@vger.kernel.org>, <rcu@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 0/1] net: Reduce rcu_barrier() contentions from 'unshare(CLONE_NEWNET)'
Date: Thu, 10 Dec 2020 23:16:05 +0100 [thread overview]
Message-ID: <20201210221605.4236-1-sjpark@amazon.com> (raw)
In-Reply-To: <CANn89i+egqwjJqGE6mZFB+-GuT_1dOQJP=pccREEZvEwQ1SGiw@mail.gmail.com>
On Thu, 10 Dec 2020 15:09:10 +0100 Eric Dumazet <edumazet@google.com> wrote:
> On Thu, Dec 10, 2020 at 9:09 AM SeongJae Park <sjpark@amazon.com> wrote:
> >
> > From: SeongJae Park <sjpark@amazon.de>
> >
> > On a few of our systems, I found frequent 'unshare(CLONE_NEWNET)' calls
> > make the number of active slab objects including 'sock_inode_cache' type
> > rapidly and continuously increase. As a result, memory pressure occurs.
> >
> > In more detail, I made an artificial reproducer that resembles the
> > workload that we found the problem and reproduce the problem faster. It
> > merely repeats 'unshare(CLONE_NEWNET)' 50,000 times in a loop. It takes
> > about 2 minutes. On 40 CPU cores, 70GB DRAM machine, it reduced about
> > 15GB of available memory in total. Note that the issue don't reproduce
> > on every machine. On my 6 CPU cores machine, the problem didn't
> > reproduce.
>
> OK, that is the number before the patch, but what is the number after
> the patch ?
No continuous memory reduction but some fluctuation observed. Nevertheless,
the available memory reduction was only up to about 400MB.
>
> I think the idea is very nice, but this will serialize fqdir hash
> tables destruction on one single cpu,
> this might become a real issue _if_ these hash tables are populated.
>
> (Obviously in your for (i=1;i<50000;i++) unshare(CLONE_NEWNET); all
> these tables are empty...)
>
> As you may now, frags are often used as vectors for DDOS attacks.
>
> I would suggest maybe to not (ab)use system_wq, but a dedicated work queue
> with a limit (@max_active argument set to 1 in alloc_workqueue()) , to
> make sure that the number of
> threads is optimal/bounded.
>
> Only the phase after hash table removal could benefit from your
> deferral to a single context,
> so that a single rcu_barrier() is active, since the part after
> rcu_barrier() is damn cheap and _can_ be serialized
>
> if (refcount_dec_and_test(&f->refcnt))
> complete(&f->completion);
Good point, thanks for this kind suggestion. I will do so in next version.
Thanks,
SeongJae Park
prev parent reply other threads:[~2020-12-10 23:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-10 8:08 [PATCH v2 0/1] net: Reduce rcu_barrier() contentions from 'unshare(CLONE_NEWNET)' SeongJae Park
2020-12-10 8:08 ` [PATCH v2 1/1] net/ipv4/inet_fragment: Batch fqdir destroy works SeongJae Park
2020-12-10 14:09 ` [PATCH v2 0/1] net: Reduce rcu_barrier() contentions from 'unshare(CLONE_NEWNET)' Eric Dumazet
2020-12-10 22:16 ` SeongJae Park [this message]
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=20201210221605.4236-1-sjpark@amazon.com \
--to=sjpark@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=kuba@kernel.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=sjpark@amazon.de \
/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).