From: Andrew Jones <drjones@redhat.com>
To: Yanan Wang <wangyanan55@huawei.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, Ben Gardon <bgardon@google.com>,
Sean Christopherson <seanjc@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Peter Xu <peterx@redhat.com>, Ingo Molnar <mingo@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Jiri Olsa <jolsa@redhat.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Arnd Bergmann <arnd@arndb.de>,
Michael Kerrisk <mtk.manpages@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
wanghaibin.wang@huawei.com, yuzenghui@huawei.com
Subject: Re: [RFC PATCH v5 02/10] tools headers: Add a macro to get HUGETLB page sizes for mmap
Date: Tue, 23 Mar 2021 15:03:41 +0100 [thread overview]
Message-ID: <20210323140341.nkikwolwzpu6ectp@kamzik.brq.redhat.com> (raw)
In-Reply-To: <20210323135231.24948-3-wangyanan55@huawei.com>
$SUBJECT says "tools headers", but this is actually changing
a UAPI header and then copying the change to tools.
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 <bgardon@google.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Michael Kerrisk <mtk.manpages@gmail.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Suggested-by: Ben Gardon <bgardon@google.com>
> Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
> Reviewed-by: Ben Gardon <bgardon@google.com>
> ---
> 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
>
next prev parent reply other threads:[~2021-03-23 14:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-23 13:52 [RFC PATCH v5 00/10] KVM: selftests: some improvement and a new test for kvm page table Yanan Wang
2021-03-23 13:52 ` [RFC PATCH v5 01/10] tools headers: sync headers of asm-generic/hugetlb_encode.h Yanan Wang
2021-03-23 13:52 ` [RFC PATCH v5 02/10] tools headers: Add a macro to get HUGETLB page sizes for mmap Yanan Wang
2021-03-23 14:03 ` Andrew Jones [this message]
2021-03-24 1:48 ` wangyanan (Y)
2021-03-23 13:52 ` [RFC PATCH v5 03/10] KVM: selftests: Use flag CLOCK_MONOTONIC_RAW for timing Yanan Wang
2021-03-23 13:52 ` [RFC PATCH v5 04/10] KVM: selftests: Print the errno besides error-string in TEST_ASSERT Yanan Wang
2021-03-23 14:04 ` Andrew Jones
2021-03-23 13:52 ` [RFC PATCH v5 05/10] KVM: selftests: Make a generic helper to get vm guest mode strings Yanan Wang
2021-03-23 13:52 ` [RFC PATCH v5 06/10] KVM: selftests: Add a helper to get system configured THP page size Yanan Wang
2021-03-23 14:07 ` Andrew Jones
2021-03-23 13:52 ` [RFC PATCH v5 07/10] KVM: selftests: Add a helper to get system default hugetlb " Yanan Wang
2021-03-23 13:52 ` [RFC PATCH v5 08/10] KVM: selftests: List all hugetlb src types specified with page sizes Yanan Wang
2021-03-23 14:12 ` Andrew Jones
2021-03-23 13:52 ` [RFC PATCH v5 09/10] KVM: selftests: Adapt vm_userspace_mem_region_add to new helpers Yanan Wang
2021-03-23 13:52 ` [RFC PATCH v5 10/10] KVM: selftests: Add a test for kvm page table code Yanan Wang
2021-03-24 2:21 ` wangyanan (Y)
2021-03-29 11:38 ` Andrew Jones
2021-03-29 13:25 ` wangyanan (Y)
2021-03-23 15:58 ` [RFC PATCH v5 00/10] KVM: selftests: some improvement and a new test for kvm page table Sean Christopherson
2021-03-24 2:13 ` wangyanan (Y)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210323140341.nkikwolwzpu6ectp@kamzik.brq.redhat.com \
--to=drjones@redhat.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=arnd@arndb.de \
--cc=bgardon@google.com \
--cc=jolsa@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanghaibin.wang@huawei.com \
--cc=wangyanan55@huawei.com \
--cc=yuzenghui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).