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 E8A07C43461 for ; Tue, 15 Sep 2020 17:05:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA139206A4 for ; Tue, 15 Sep 2020 17:05:40 +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" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727762AbgIORFf (ORCPT ); Tue, 15 Sep 2020 13:05:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727559AbgIOQUD (ORCPT ); Tue, 15 Sep 2020 12:20:03 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EF67C0611BC; Tue, 15 Sep 2020 09:20:01 -0700 (PDT) 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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