linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Roman Gushchin <guro@fb.com>
To: Shakeel Butt <shakeelb@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	Vasily Averin <vvs@virtuozzo.com>,
	Cgroups <cgroups@vger.kernel.org>,
	Michal Hocko <mhocko@kernel.org>, Linux MM <linux-mm@kvack.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	David Ahern <dsahern@kernel.org>
Subject: Re: [PATCH v2 1/8] memcg: accounting for fib6_nodes cache
Date: Mon, 15 Mar 2021 12:32:07 -0700	[thread overview]
Message-ID: <YE+2N0zb9wKTriDH@carbon.dhcp.thefacebook.com> (raw)
In-Reply-To: <CALvZod4ct6X_M1fzKufX1jKoO2JEE_ONwEmiDWTbpt-fut85yA@mail.gmail.com>

On Mon, Mar 15, 2021 at 12:24:31PM -0700, Shakeel Butt wrote:
> On Mon, Mar 15, 2021 at 10:09 AM Jakub Kicinski <kuba@kernel.org> wrote:
> >
> > On Mon, 15 Mar 2021 15:23:00 +0300 Vasily Averin wrote:
> > > An untrusted netadmin inside a memcg-limited container can create a
> > > huge number of routing entries. Currently, allocated kernel objects
> > > are not accounted to proper memcg, so this can lead to global memory
> > > shortage on the host and cause lot of OOM kiils.
> > >
> > > One such object is the 'struct fib6_node' mostly allocated in
> > > net/ipv6/route.c::__ip6_ins_rt() inside the lock_bh()/unlock_bh() section:
> > >
> > >  write_lock_bh(&table->tb6_lock);
> > >  err = fib6_add(&table->tb6_root, rt, info, mxc);
> > >  write_unlock_bh(&table->tb6_lock);
> > >
> > > It this case is not enough to simply add SLAB_ACCOUNT to corresponding
> > > kmem cache. The proper memory cgroup still cannot be found due to the
> > > incorrect 'in_interrupt()' check used in memcg_kmem_bypass().
> > > To be sure that caller is not executed in process contxt
> > > '!in_task()' check should be used instead
> >
> > Sorry for a random question, I didn't get the cover letter.
> >
> > What's the overhead of adding SLAB_ACCOUNT?
> >
> 
> The potential overhead is for MEMCG users where we need to
> charge/account each allocation from SLAB_ACCOUNT kmem caches. However
> charging is done in batches, so the cost is amortized. If there is a
> concern about a specific workload then it would be good to see the
> impact of this patch for that workload.
> 
> > Please make sure you CC netdev on series which may impact networking.

In general the overhead is not that big, so I don't think we should argue
too much about every new case where we want to enable the accounting and
rather focus on those few examples (if any?) where it actually hurts
the performance in a meaningful way.

Thanks!


  reply	other threads:[~2021-03-15 19:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09  8:03 [PATCH 0/9] memcg accounting from OpenVZ Vasily Averin
2021-03-09 21:12 ` Shakeel Butt
2021-03-10 10:17   ` Vasily Averin
2021-03-10 10:41     ` Michal Hocko
2021-03-11  7:00       ` Vasily Averin
2021-03-11  8:35         ` Michal Hocko
     [not found]           ` <360b4c94-8713-f621-1049-6bc0865c1867@virtuozzo.com>
2021-03-15 13:27             ` [PATCH v2 8/8] memcg: accounting for ldt_struct objects Borislav Petkov
2021-03-15 15:48               ` Shakeel Butt
2021-03-15 15:58                 ` Michal Hocko
2021-03-15 15:59                 ` Borislav Petkov
     [not found]           ` <85b5f428-294b-af57-f496-5be5fddeeeea@virtuozzo.com>
2021-03-15 15:13             ` [PATCH v2 1/8] memcg: accounting for fib6_nodes cache David Ahern
2021-03-15 15:23             ` Shakeel Butt
2021-03-15 17:09             ` Jakub Kicinski
2021-03-15 19:24               ` Shakeel Butt
2021-03-15 19:32                 ` Roman Gushchin [this message]
2021-03-15 19:35                   ` Jakub Kicinski
     [not found]           ` <8196f732-718e-0465-a39c-62668cc12c2b@virtuozzo.com>
2021-03-15 15:14             ` [PATCH v2 2/8] memcg: accounting for ip6_dst_cache David Ahern
     [not found]           ` <cb893761-cf6e-fa92-3219-712e485259b4@virtuozzo.com>
2021-03-15 15:14             ` [PATCH v2 3/8] memcg: accounting for fib_rules David Ahern
     [not found]           ` <d569bf43-b30a-02af-f7ad-ccc794a50589@virtuozzo.com>
2021-03-15 15:15             ` [PATCH v2 4/8] memcg: accounting for ip_fib caches David Ahern
     [not found]           ` <4eb97c88-b87c-6f6e-3960-b1a61b46d380@virtuozzo.com>
2021-03-15 15:56             ` [PATCH v2 5/8] memcg: accounting for fasync_cache Shakeel Butt
2021-03-11 15:14         ` [PATCH 0/9] memcg accounting from OpenVZ Shakeel Butt

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=YE+2N0zb9wKTriDH@carbon.dhcp.thefacebook.com \
    --to=guro@fb.com \
    --cc=cgroups@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=kuba@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=shakeelb@google.com \
    --cc=vdavydov.dev@gmail.com \
    --cc=vvs@virtuozzo.com \
    --cc=yoshfuji@linux-ipv6.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