From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6B19C43461 for ; Tue, 15 Sep 2020 16:20:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 42B822068D for ; Tue, 15 Sep 2020 16:20:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="YqV8EnuD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 42B822068D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BA7C690005E; Tue, 15 Sep 2020 12:20:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B572790000E; Tue, 15 Sep 2020 12:20:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A460290005E; Tue, 15 Sep 2020 12:20:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id 8AD9F90000E for ; Tue, 15 Sep 2020 12:20:02 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 32B3B8249980 for ; Tue, 15 Sep 2020 16:20:02 +0000 (UTC) X-FDA: 77265807444.27.crowd24_5d1040527112 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id D4EDD3D669 for ; Tue, 15 Sep 2020 16:20:00 +0000 (UTC) X-HE-Tag: crowd24_5d1040527112 X-Filterd-Recvd-Size: 3645 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Tue, 15 Sep 2020 16:20:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=gtbrt8dJvKGHqvO+xWVhJDadXOXm7TXL2RE8ocfRdrU=; b=YqV8EnuDoph6ku6oHt9bx4qUwH KCZuDIAfFZknOwjfV+X/HK/ns4hKfz+uJoTC0Dg/MiUtHBr/U3QjAmuqYuF0IriwVx9ktkYnJtyWe q0U+yndgpPFNawlhOeefRJi7NmEX3tz1to/MpP8mBy6agxzAxzN5gpuwMEolreI1xu3kZICFJZ03M Rsz9WpOpYypQrogf3aEzzzzp4SvhUCMYp4g2YkdJn5w6Cj8mj6HjVdDZTzoVuC0AeyBFktr5xDn6v t/0m1BM8miYt+1+xl5yDYv5nAsskVRWIpiWdx00+BuANy7G7O6bQtgsIfTg+sXt9mpH/B/f1PEKHc EaY3jqbA==; Received: from [2601:1c0:6280:3f0::19c2] by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIDgS-0000iB-7x; Tue, 15 Sep 2020 16:19:56 +0000 Subject: Re: [External] Re: [PATCH v4] mm: memcontrol: Add the missing numa_stat interface for cgroup v2 To: Muchun Song Cc: Tejun Heo , Zefan Li , Johannes Weiner , Jonathan Corbet , Michal Hocko , Vladimir Davydov , Andrew Morton , Shakeel Butt , Roman Gushchin , Cgroups , linux-doc@vger.kernel.org, LKML , Linux Memory Management List References: <20200915055825.5279-1-songmuchun@bytedance.com> From: Randy Dunlap Message-ID: Date: Tue, 15 Sep 2020 09:19:49 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: D4EDD3D669 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 9/15/20 9:01 AM, Muchun Song wrote: > On Tue, Sep 15, 2020 at 11:45 PM Randy Dunlap 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