Re: [External] Re: [PATCH v4] mm: memcontrol: Add the missing numa_stat interface for cgroup v2
From: Randy Dunlap <hidden>
Date: 2020-09-15 17:05:40
Also in:
linux-doc, linux-mm, lkml
From: Randy Dunlap <hidden>
Date: 2020-09-15 17:05:40
Also in:
linux-doc, linux-mm, lkml
On 9/15/20 9:01 AM, Muchun Song wrote:
On Tue, Sep 15, 2020 at 11:45 PM Randy Dunlap [off-list ref] wrote:quoted
quoted
quoted
+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.
quoted
quoted
+#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; + } +#endifquoted
+ + return 0; +} +pure_initcall(numa_stats_init);
-- ~Randy