[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f2ec1c19-b86b-887e-186a-3a8c3014857d@infradead.org>
Date: Tue, 15 Sep 2020 09:19:49 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: Muchun Song <songmuchun@...edance.com>
Cc: Tejun Heo <tj@...nel.org>, Zefan Li <lizefan@...wei.com>,
Johannes Weiner <hannes@...xchg.org>,
Jonathan Corbet <corbet@....net>,
Michal Hocko <mhocko@...nel.org>,
Vladimir Davydov <vdavydov.dev@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Shakeel Butt <shakeelb@...gle.com>,
Roman Gushchin <guro@...com>,
Cgroups <cgroups@...r.kernel.org>, linux-doc@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>,
Linux Memory Management List <linux-mm@...ck.org>
Subject: Re: [External] Re: [PATCH v4] mm: memcontrol: Add the missing
numa_stat interface for cgroup v2
On 9/15/20 9:01 AM, Muchun Song wrote:
> On Tue, Sep 15, 2020 at 11:45 PM Randy Dunlap <rdunlap@...radead.org> wrote:
>>
>>> +static int __init numa_stats_init(void)
>>> +{
>>> + int i;
>>> +
>>> + for (i = 0; i < ARRAY_SIZE(numa_stats); i++) {
>>> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
>>> + if (numa_stats[i].idx == NR_ANON_THPS)
>>> + numa_stats[i].ratio = HPAGE_PMD_SIZE;
>>> +#endif
>>> + }
>>
>> Although the loop may be needed sometime in the future due to
>> other changes.. why couldn't it be like this for now?
>
> The compiler is so smart, so there is nothing difference between
> them. I disassemble the numa_stats_init when
> !CONFIG_TRANSPARENT_HUGEPAGE.
>
> Dump of assembler code for function numa_stats_init:
> 0xffffffff8273b061 <+0>: callq 0xffffffff81057490 <__fentry__>
> 0xffffffff8273b066 <+5>: xor %eax,%eax
> 0xffffffff8273b068 <+7>: retq
>
Of course! Thanks.
>>
>>
>>> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
>>> + for (i = 0; i < ARRAY_SIZE(numa_stats); i++) {
>>> + if (numa_stats[i].idx == NR_ANON_THPS)
>>> + numa_stats[i].ratio = HPAGE_PMD_SIZE;
>>> + }
>>> +#endif
>>
>>
>>> +
>>> + return 0;
>>> +}
>>> +pure_initcall(numa_stats_init);
--
~Randy
Powered by blists - more mailing lists