linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Haifeng Xu <haifeng.xu@shopee.com>
To: Roman Gushchin <roman.gushchin@linux.dev>
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org,
	shakeelb@google.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm: list_lru: disable memcg_aware when cgroup.memory is set to "nokmem"
Date: Mon, 8 Jan 2024 14:49:31 +0800	[thread overview]
Message-ID: <70448afd-cb53-478c-83fc-831c712e9a82@shopee.com> (raw)
In-Reply-To: <ZZS-IFA6TScotocU@P9FQF9L96D>



On 2024/1/3 09:53, Roman Gushchin wrote:
> On Thu, Dec 28, 2023 at 06:27:14AM +0000, Haifeng Xu wrote:
>> Actually, when using a boot time kernel option "cgroup.memory=nokmem",
>> all lru items are inserted to list_lru_node. But for those users who
>> invoke list_lru_init_memcg() to initialize list_lru, list_lru_memcg_aware()
>> returns true. And this brings unneeded operations related to memcg.
>>
>> To make things more convenient, let's disable memcg_aware when
>> cgroup.memory is set to "nokmem".
> 
> I guess it's not only more convenient, but also should save a bit of memory.
> But _probably_ not enough to justify messing up with stable backports.
> Do you have any data on memory savings?

Do you mean that it will remove the allocation of 'list_lru_memcg' in memcg_init_list_lru_one()?

In fact, even without this patch, if we set cgroup.memory set to "nokmem", all memcg's kmemcg_id is -1, so
memcg_list_lru_allocated() always returns true and we won't invoke memcg_init_list_lru_one().


> 
>>
>> Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
> 
> Acked-by: Roman Gushchin <roman.gushchin@linux.dev>
> 
> Thanks!


      reply	other threads:[~2024-01-08  6:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-28  6:27 Haifeng Xu
2024-01-03  1:53 ` Roman Gushchin
2024-01-08  6:49   ` Haifeng Xu [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=70448afd-cb53-478c-83fc-831c712e9a82@shopee.com \
    --to=haifeng.xu@shopee.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeelb@google.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