Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp733538pxf; Wed, 24 Mar 2021 14:46:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGcBfjf9EKP89kME2IU/s17OudZyaipZ8/c6ldhZqdglb4lpdyO4700J+LeNMV234xCkzm X-Received: by 2002:a05:6402:19a:: with SMTP id r26mr5627332edv.44.1616622419189; Wed, 24 Mar 2021 14:46:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616622419; cv=none; d=google.com; s=arc-20160816; b=JOccMS24qc67dnhlz/AH7zeUoAMue5ZLGgaGSXa6Lu1EYDA90yvjNRn4fcRIFG645Y aId7AzTgMYwQdSuAaop0M7jn16WBCLFUsAjTTvz01V38/0IKYpvdm52mFC58yqFc5jaq Ayf4WSUEl3Pn3J10a9VCejBqoRVzJdeL2XVGqhwvwsePYtIaoUTLZbVa9iOzTE5+gZOO CSncN+5yqylMJU2hwM8G0dqVMcB4KboS9PF4vxfhfs9qz7hQNKSQfV0CzKpPCY35Aqi1 7ANYKQ1sTNtP8vgxo74QRji3KFM9MnAdJIHYym5paX1CbPqMhcnckm5CPwVa1eJpL2eA sqWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=T2/7bSnFMx85QC+GGRD5wAyN+Gd8AmKBLcx+rVz6gUk=; b=RvAh+DSTtws0zZAP0bc2Z3KmWiETMDN6BTBOAye+dL0WHGD17x734kuD8Wfr0ec9Ut yzaohcziX1bgAUklDnJrOomHIFq74wMI24lS+9DwI12Z5J2il72iMMpr4E3nn1PDlXmK lCdmmc44GY7pgYDtf+7exwkBy5u0QW7bSQkMMxSuKqcOPzzpNt/p0YZhlU/Vb7uJs91I 5lA/AHbujNUJHbUOcG9MCyshYkx3b+ezc4ITG/SDdwRkjF39chHvROlZzRdPaSCy4YAg LgtCXhZgXKfXP9eJQr4w24K5IzaDoJJwOivPkPmrdfnS/g/42htgk66uGZoFNIjqVfEp IWCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bt5si2521298edb.506.2021.03.24.14.46.36; Wed, 24 Mar 2021 14:46:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231873AbhCXBs7 (ORCPT + 99 others); Tue, 23 Mar 2021 21:48:59 -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 >> > .