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=-3.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 0B822C433FE for ; Thu, 10 Dec 2020 16:20:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A268423D39 for ; Thu, 10 Dec 2020 16:20:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A268423D39 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A4B3E6B005D; Thu, 10 Dec 2020 11:20:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9FCD26B0072; Thu, 10 Dec 2020 11:20:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 911D36B0073; Thu, 10 Dec 2020 11:20:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0074.hostedemail.com [216.40.44.74]) by kanga.kvack.org (Postfix) with ESMTP id 7AD636B005D for ; Thu, 10 Dec 2020 11:20:30 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 3EBD2180AD81D for ; Thu, 10 Dec 2020 16:20:30 +0000 (UTC) X-FDA: 77577885420.27.wall00_5d028b7273f9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 1765D3D663 for ; Thu, 10 Dec 2020 16:20:30 +0000 (UTC) X-HE-Tag: wall00_5d028b7273f9 X-Filterd-Recvd-Size: 5223 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Thu, 10 Dec 2020 16:20:29 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id v29so4636191pgk.12 for ; Thu, 10 Dec 2020 08:20:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gOoShQoy2wQXY3FUgpRmJNV81X7XkJlcJzzP39yH8B4=; b=LQDH7cHHyuvDFABjfdf9FCcJAaWrzP3BR5lBscpduE8+d/2f9mGS6XkaQKV0I60pqs dNpfH8d0p1VK1cyAjKTaqlC5y3T808RJwN9j3zhRg/y9AEzktUHWw3XIMzzOnQGlkIMb b4zsyh1x5M7w/lo/hNoZWTX6mjHZvhogI5SyMNajkwzm79JnfCyDV9rN3geEZVvVO0PE QuKQKh6TyvxlTr7Gc0QAKbe5kd3kwVS0eqIVfQ5F6V17xzPNzcJ0t2jmgEzR1W50cgBC t91uBNVmv8sHk1Lu39R8Dk2cdY6wbDcZ+k//sf9r0sxS5O3DnV4bQebIkJxjkwuBXsuK +P6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gOoShQoy2wQXY3FUgpRmJNV81X7XkJlcJzzP39yH8B4=; b=lUuA2UECFDtA4vhXttlX1uu27Wt8CfrFcmXX77YcCz+996tKOMeldI8BYOg9FTU4WD fhOZIyREkoug/ca4xGCS8sUF/IsCcwWJeIxqzs2sFeBoQgpCMQamfgT27V989rf7q3JH 5VTHxGD3zPmlz/M28U2VCFQM4X5uQZ7r0sFzYj0uqV2pVoV1wb1Dhk6A34TwivL4NEic aAt3dEWFt7xaoQv91AyidU8xZvJOv+wZMaOZvxPftREq+cPncHwVcqYhmI5sg3WwjV54 yj+UkiiKkHxbX4UJkygZL2Uze85vjgD4nkKW9RfB+uT1b0WNVmTN9kmD68MSr3uyft0I UjHg== X-Gm-Message-State: AOAM533+NOIUBACt8yB1o1wLf5VQkIEe7Kd8cwMzDVm1lI7wXaDqrRMx 67WxCdYKi7ia07Xl5cXydeP8d7hQIzuXttcuwZp6Zg== X-Google-Smtp-Source: ABdhPJyFWG17IHNoAP1Thl1Hpjqvi91RsLyQZI9OQ0R4iCDqarpGl7qDkLFnU7RvxsSo3ZJbFWt8ym48Dt8Rp1jptMQ= X-Received: by 2002:a62:4e4e:0:b029:19e:aaab:8be with SMTP id c75-20020a624e4e0000b029019eaaab08bemr5287563pfb.59.1607617226427; Thu, 10 Dec 2020 08:20:26 -0800 (PST) MIME-Version: 1.0 References: <20201210035526.38938-1-songmuchun@bytedance.com> <20201210035526.38938-13-songmuchun@bytedance.com> <375d6bad6bb37e3626f71bfabc20b384@suse.de> <20201210131608.GA7811@localhost.localdomain> In-Reply-To: From: Muchun Song Date: Fri, 11 Dec 2020 00:19:50 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v8 12/12] mm/hugetlb: Optimize the code with the help of the compiler To: Oscar Salvador Cc: Jonathan Corbet , Mike Kravetz , Thomas Gleixner , mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, Peter Zijlstra , viro@zeniv.linux.org.uk, Andrew Morton , paulmck@kernel.org, mchehab+huawei@kernel.org, pawan.kumar.gupta@linux.intel.com, Randy Dunlap , oneukum@suse.com, anshuman.khandual@arm.com, jroedel@suse.de, Mina Almasry , David Rientjes , Matthew Wilcox , Michal Hocko , "Song Bao Hua (Barry Song)" , David Hildenbrand , Xiongchun duan , linux-doc@vger.kernel.org, LKML , Linux Memory Management List , linux-fsdevel Content-Type: text/plain; charset="UTF-8" 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 Thu, Dec 10, 2020 at 9:29 PM Muchun Song wrote: > > On Thu, Dec 10, 2020 at 9:16 PM Oscar Salvador wrote: > > > > On Thu, Dec 10, 2020 at 08:14:18PM +0800, Muchun Song wrote: > > > Yeah, you are right. But if we do this check can make the code simple. > > > > > > For example, here is a code snippet. > > > > > > void func(void) > > > { > > > if (free_vmemmap_pages_per_hpage()) > > > return; > > > /* Do something */ > > > } > > > > > > With this patch, the func will be optimized to null when is_power_of_2 > > > returns false. > > > > > > void func(void) > > > { > > > } > > > > > > Without this patch, the compiler cannot do this optimization. > > > > Ok, I misread the changelog. > > > > So, then is_hugetlb_free_vmemmap_enabled, free_huge_page_vmemmap, > > free_vmemmap_pages_per_hpage and hugetlb_vmemmap_init are optimized > > out, right? > > Yes, that's right. I have disassembled to make sure of this. Thanks. Hi Oscar, Because this is an optimization for code, I leave it in this separate patch. Do you still suggest squash this with patch#10? Thanks. > > > > > -- > > Oscar Salvador > > SUSE L3 > > > > -- > Yours, > Muchun -- Yours, Muchun