From: Huan Yang <link@vivo.com>
To: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Muchun Song <muchun.song@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Petr Mladek <pmladek@suse.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Francesco Valla <francesco@valla.it>,
Huang Shijie <shijie@os.amperecomputing.com>,
KP Singh <kpsingh@kernel.org>,
"Paul E. McKenney" <paulmck@kernel.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
"Uladzislau Rezki (Sony)" <urezki@gmail.com>,
Guo Weikang <guoweikang.kernel@gmail.com>,
Raul E Rangel <rrangel@chromium.org>,
cgroups@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Boqun Feng <boqun.feng@gmail.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Paul Moore <paul@paul-moore.com>,
"Mike Rapoport (Microsoft)" <rppt@kernel.org>,
opensource.kernel@vivo.com
Subject: Re: [PATCH v2 3/3] mm/memcg: introduce mem_cgroup_early_init
Date: Fri, 25 Apr 2025 09:11:01 +0800 [thread overview]
Message-ID: <1166b629-92a0-47d5-8cba-01aafd928e25@vivo.com> (raw)
In-Reply-To: <lkumupd7gkzcui2wzssz4tzrw3cchta67onxnykxjldssmfnei@54mlc5fn3brk>
Hi Shakeel
在 2025/4/25 07:00, Shakeel Butt 写道:
> On Thu, Apr 24, 2025 at 09:00:01AM -0700, Shakeel Butt wrote:
>> On Thu, Apr 24, 2025 at 08:09:29PM +0800, Huan Yang wrote:
>>> When cgroup_init() creates root_mem_cgroup through css_online callback,
>>> some critical resources might not be fully initialized, forcing later
>>> operations to perform conditional checks for resource availability.
>>>
>>> This patch introduces mem_cgroup_early_init() to address the init order,
>>> it invoke before cgroup_init, so, compare mem_cgroup_init which invoked
>>> by initcall, mem_cgroup_early_init can use to prepare some key resources
>>> before root_mem_cgroup alloc.
>>>
>>> Signed-off-by: Huan Yang <link@vivo.com>
>>> Suggested-by: Shakeel Butt <shakeel.butt@linux.dev>
>> Please move this patch as the first patch of the series and also remove
>> the "early" from the function name as it has a different meaning in the
>> context of cgroup init. Something like either memcg_init() or
>> memcg_kmem_caches_init().
> BTW I think just putting this kmem cache creation in mem_cgroup_init()
> and explicitly calling it before cgroup_init() would be fine. In that
> case there would be a single memcg init function.
Maybe someone also need init something after cgroup init done?
Currently no, but for furture may need?
So, memcg_init then cgroup_init then initcall->mem_cgroup_init.
Thanks,
Huan
next prev parent reply other threads:[~2025-04-25 1:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-24 12:09 [PATCH v2 0/3] Use kmem_cache for memcg alloc Huan Yang
2025-04-24 12:09 ` [PATCH v2 1/3] mm/memcg: use kmem_cache when alloc memcg Huan Yang
2025-04-24 12:09 ` [PATCH v2 2/3] mm/memcg: use kmem_cache when alloc memcg pernode info Huan Yang
2025-04-24 12:09 ` [PATCH v2 3/3] mm/memcg: introduce mem_cgroup_early_init Huan Yang
2025-04-24 16:00 ` Shakeel Butt
2025-04-24 23:00 ` Shakeel Butt
2025-04-25 1:11 ` Huan Yang [this message]
2025-04-25 1:30 ` Shakeel Butt
2025-04-25 1:55 ` Huan Yang
2025-04-25 1:11 ` Huan Yang
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=1166b629-92a0-47d5-8cba-01aafd928e25@vivo.com \
--to=link@vivo.com \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=boqun.feng@gmail.com \
--cc=cgroups@vger.kernel.org \
--cc=francesco@valla.it \
--cc=geert@linux-m68k.org \
--cc=guoweikang.kernel@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@rasmusvillemoes.dk \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=opensource.kernel@vivo.com \
--cc=paul@paul-moore.com \
--cc=paulmck@kernel.org \
--cc=pmladek@suse.com \
--cc=roman.gushchin@linux.dev \
--cc=rppt@kernel.org \
--cc=rrangel@chromium.org \
--cc=shakeel.butt@linux.dev \
--cc=shijie@os.amperecomputing.com \
--cc=urezki@gmail.com \
/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