From: David Hildenbrand <david@redhat.com>
To: Hao Peng <flyingpenghao@gmail.com>, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/huge_memory: disable thp if thp page size is too large
Date: Thu, 30 Sep 2021 15:19:19 +0200 [thread overview]
Message-ID: <914a0b38-cb44-f4be-43aa-bc42bee1553b@redhat.com> (raw)
In-Reply-To: <CAPm50aLBfe7N_udxCkS3-PKbTmUvSpqu0sL7U6qHXZ=OWGQnTQ@mail.gmail.com>
On 30.09.21 04:14, Hao Peng wrote:
> From: Peng Hao <flyingpeng@tencent.com>
"disable thp if thp page size is too large" you disable thp if there is
not sufficient memory installed in the system (and for that, you use THP
size), something doesn't add up here.
>
> After seting the page size to 64k on ARM64, the supported huge page
s/seting/setting/
Fortunately, most distributions already switched to 4k, because 512MB
THP is pretty much useless, especially on any system that doesn't have
memory in the range of hundreds of megabytes or terrabytes.
> size is 512M and 1TB. Therefore, if the thp is enabled, the size
> of the thp is 512M. In this case, min_free_kbytes will be too large.
>
> On an arm64 server with 64G memory, the page size is 64k, with thp
> enabled.
> cat /proc/sys/vm/min_free_kbytes
> 3335104
>
> Therefore, when judging whether to enable thp by default, consider
> the size of thp.
>
> Signed-off-by: Peng Hao <flyingpeng@tencent.com>
> ---
> mm/huge_memory.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 5e9ef0fc261e..03c7f571b3ae 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -437,7 +437,7 @@ static int __init hugepage_init(void)
> * where the extra memory used could hurt more than TLB overhead
> * is likely to save. The admin can still enable it through /sys.
> */
> - if (totalram_pages() < (512 << (20 - PAGE_SHIFT))) {
> + if (totalram_pages() < (512 << (HPAGE_PMD_SHIFT - PAGE_SHIFT))) {
> transparent_hugepage_flags = 0;
> return 0;
> }
> --
> 2.27.0
>
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2021-09-30 13:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-30 2:14 Hao Peng
2021-09-30 13:19 ` David Hildenbrand [this message]
2021-10-06 8:16 ` Hao Peng
2021-10-06 8:20 ` David Hildenbrand
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=914a0b38-cb44-f4be-43aa-bc42bee1553b@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=flyingpenghao@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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