From: Muchun Song <songmuchun@bytedance.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: David Miller <davem@davemloft.net>,
kuba@kernel.org, Eric Dumazet <edumazet@google.com>,
Michal Hocko <mhocko@kernel.org>,
Vladimir Davydov <vdavydov.dev@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org,
Shakeel Butt <shakeelb@google.com>, Roman Gushchin <guro@fb.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
laoar.shao@gmail.com, Chris Down <chris@chrisdown.name>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <kafai@fb.com>,
Alexei Starovoitov <ast@kernel.org>,
jakub@cloudflare.com, linmiaohe@huawei.com,
Kees Cook <keescook@chromium.org>,
LKML <linux-kernel@vger.kernel.org>,
Networking <netdev@vger.kernel.org>,
Cgroups <cgroups@vger.kernel.org>,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [External] Re: [PATCH] mm: memcontrol: localize mem_cgroup_sockets_enabled() check
Date: Tue, 13 Oct 2020 00:04:44 +0800 [thread overview]
Message-ID: <CAMZfGtXE1DaDXSOWObaJDTxUH2zB2hjfKoX38Y2oKgNaDkyoCA@mail.gmail.com> (raw)
In-Reply-To: <20201012135823.GA188876@cmpxchg.org>
On Mon, Oct 12, 2020 at 9:59 PM Johannes Weiner <hannes@cmpxchg.org> wrote:
>
> On Sat, Oct 10, 2020 at 06:45:21PM +0800, Muchun Song wrote:
> > Move the mem_cgroup_sockets_enabled() checks into memcg socket charge
> > or uncharge functions, so the users don't have to explicitly check that
> > condition.
> >
> > This is purely code cleanup patch without any functional change. But
> > move the sk_memcg member of the sock structure to the CONFIG_MEMCG
> > scope.
> >
> > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > ---
> > include/linux/memcontrol.h | 78 ++++++++++++++++++++++++++-------
> > include/net/sock.h | 5 ++-
> > include/net/tcp.h | 3 +-
> > mm/memcontrol.c | 43 +++++++++++++-----
> > net/core/sock.c | 15 +++----
> > net/ipv4/inet_connection_sock.c | 6 +--
> > net/ipv4/tcp_output.c | 3 +-
> > 7 files changed, 111 insertions(+), 42 deletions(-)
>
> Hm, this is almost 3 times as much code.
>
> The sk_memcg saving on !CONFIG_MEMCG is somewhat nice, but it's not
> clear how many users would benefit here. And it adds ifdefs in code.
The 'ifdefs in code' means the initialization of sk_memcg in the sk_clone_lock?
If yes, we can add a new inline initialization function to avoid this.
>
> Also memcg code now has to know about struct sock.
Without this patch, the memcg code also has to know about struct sock.
You can see the code of mem_cgroup_sk_alloc and mem_cgroup_sk_free.
Thanks.
>
> I'm not quite sure that this is an overall improvement.
--
Yours,
Muchun
prev parent reply other threads:[~2020-10-12 16:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-10 10:45 Muchun Song
2020-10-12 13:58 ` Johannes Weiner
2020-10-12 16:04 ` Muchun Song [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=CAMZfGtXE1DaDXSOWObaJDTxUH2zB2hjfKoX38Y2oKgNaDkyoCA@mail.gmail.com \
--to=songmuchun@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=ast@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=chris@chrisdown.name \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=jakub@cloudflare.com \
--cc=kafai@fb.com \
--cc=keescook@chromium.org \
--cc=kuba@kernel.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=laoar.shao@gmail.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=shakeelb@google.com \
--cc=vdavydov.dev@gmail.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