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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 6C5E2C433E1 for ; Wed, 24 Mar 2021 01:49:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3BBCA619ED for ; Wed, 24 Mar 2021 01:49:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231952AbhCXBtA (ORCPT ); Tue, 23 Mar 2021 21:49:00 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:3317 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231651AbhCXBsx (ORCPT ); Tue, 23 Mar 2021 21:48:53 -0400 Received: from DGGEML402-HUB.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4F4rfX5jh6z1476S; Wed, 24 Mar 2021 09:45:40 +0800 (CST) Received: from dggpemm500023.china.huawei.com (7.185.36.83) by DGGEML402-HUB.china.huawei.com (10.3.17.38) with Microsoft SMTP Server (TLS) id 14.3.498.0; Wed, 24 Mar 2021 09:48:50 +0800 Received: from [10.174.187.128] (10.174.187.128) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2106.2; Wed, 24 Mar 2021 09:48:50 +0800 Subject: Re: [RFC PATCH v5 02/10] tools headers: Add a macro to get HUGETLB page sizes for mmap To: Andrew Jones CC: Paolo Bonzini , , , , Ben Gardon , Sean Christopherson , "Vitaly Kuznetsov" , Peter Xu , Ingo Molnar , Adrian Hunter , Jiri Olsa , Arnaldo Carvalho de Melo , Arnd Bergmann , Michael Kerrisk , Thomas Gleixner , , References: <20210323135231.24948-1-wangyanan55@huawei.com> <20210323135231.24948-3-wangyanan55@huawei.com> <20210323140341.nkikwolwzpu6ectp@kamzik.brq.redhat.com> From: "wangyanan (Y)" Message-ID: <4b4df379-4fe4-abf3-3756-448290309a1d@huawei.com> Date: Wed, 24 Mar 2021 09:48:49 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20210323140341.nkikwolwzpu6ectp@kamzik.brq.redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.174.187.128] X-ClientProxiedBy: dggeme706-chm.china.huawei.com (10.1.199.102) To dggpemm500023.china.huawei.com (7.185.36.83) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/3/23 22:03, Andrew Jones wrote: > $SUBJECT says "tools headers", but this is actually changing > a UAPI header and then copying the change to tools. Indeed. I think head of the subject should be "mm/hugetlb". I will fix it. Thanks, Yanan > Thanks, > drew > > On Tue, Mar 23, 2021 at 09:52:23PM +0800, Yanan Wang wrote: >> We know that if a system supports multiple hugetlb page sizes, >> the desired hugetlb page size can be specified in bits [26:31] >> of the flag arguments. The value in these 6 bits will be the >> shift of each hugetlb page size. >> >> So add a macro to get the page size shift and then calculate the >> corresponding hugetlb page size, using flag x. >> >> Cc: Ben Gardon >> Cc: Ingo Molnar >> Cc: Adrian Hunter >> Cc: Jiri Olsa >> Cc: Arnaldo Carvalho de Melo >> Cc: Arnd Bergmann >> Cc: Michael Kerrisk >> Cc: Thomas Gleixner >> Suggested-by: Ben Gardon >> Signed-off-by: Yanan Wang >> Reviewed-by: Ben Gardon >> --- >> include/uapi/linux/mman.h | 2 ++ >> tools/include/uapi/linux/mman.h | 2 ++ >> 2 files changed, 4 insertions(+) >> >> diff --git a/include/uapi/linux/mman.h b/include/uapi/linux/mman.h >> index f55bc680b5b0..d72df73b182d 100644 >> --- a/include/uapi/linux/mman.h >> +++ b/include/uapi/linux/mman.h >> @@ -41,4 +41,6 @@ >> #define MAP_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB >> #define MAP_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB >> >> +#define MAP_HUGE_PAGE_SIZE(x) (1ULL << ((x >> MAP_HUGE_SHIFT) & MAP_HUGE_MASK)) >> + >> #endif /* _UAPI_LINUX_MMAN_H */ >> diff --git a/tools/include/uapi/linux/mman.h b/tools/include/uapi/linux/mman.h >> index f55bc680b5b0..d72df73b182d 100644 >> --- a/tools/include/uapi/linux/mman.h >> +++ b/tools/include/uapi/linux/mman.h >> @@ -41,4 +41,6 @@ >> #define MAP_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB >> #define MAP_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB >> >> +#define MAP_HUGE_PAGE_SIZE(x) (1ULL << ((x >> MAP_HUGE_SHIFT) & MAP_HUGE_MASK)) >> + >> #endif /* _UAPI_LINUX_MMAN_H */ >> -- >> 2.19.1 >> > .