linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Barry Song <21cnbao@gmail.com>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: akpm@linux-foundation.org, hughd@google.com, willy@infradead.org,
	 david@redhat.com, ryan.roberts@arm.com, ziy@nvidia.com,
	gshan@redhat.com,  ioworker0@gmail.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm: shmem: avoid allocating huge pages larger than MAX_PAGECACHE_ORDER for shmem
Date: Wed, 31 Jul 2024 14:18:02 +0800	[thread overview]
Message-ID: <CAGsJ_4xmHY06VAKzXxCFcovPkrR0WOR28jXbaeD5VyUBHWzn_w@mail.gmail.com> (raw)
In-Reply-To: <117121665254442c3c7f585248296495e5e2b45c.1722404078.git.baolin.wang@linux.alibaba.com>

On Wed, Jul 31, 2024 at 1:46 PM Baolin Wang
<baolin.wang@linux.alibaba.com> wrote:
>
> Similar to commit d659b715e94ac ("mm/huge_memory: avoid PMD-size page cache
> if needed"), ARM64 can support 512MB PMD-sized THP when the base page size is
> 64KB, which is larger than the maximum supported page cache size MAX_PAGECACHE_ORDER.
> This is not expected. To fix this issue, use THP_ORDERS_ALL_FILE_DEFAULT for
> shmem to filter allowable huge orders.
>
> Fixes: e7a2ab7b3bb5 ("mm: shmem: add mTHP support for anonymous shmem")
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>

Reviewed-by: Barry Song <baohua@kernel.org>

> ---
>  mm/shmem.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 2faa9daaf54b..a4332a97558c 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -1630,10 +1630,10 @@ unsigned long shmem_allowable_huge_orders(struct inode *inode,
>         unsigned long within_size_orders = READ_ONCE(huge_shmem_orders_within_size);
>         unsigned long vm_flags = vma->vm_flags;
>         /*
> -        * Check all the (large) orders below HPAGE_PMD_ORDER + 1 that
> +        * Check all the (large) orders below MAX_PAGECACHE_ORDER + 1 that
>          * are enabled for this vma.

Nit:
THP_ORDERS_ALL_FILE_DEFAULT should be self-explanatory enough.
I feel we don't need this comment?

>          */
> -       unsigned long orders = BIT(PMD_ORDER + 1) - 1;
> +       unsigned long orders = THP_ORDERS_ALL_FILE_DEFAULT;
>         loff_t i_size;
>         int order;
>
> --
> 2.39.3
>

Thanks
Barry


  parent reply	other threads:[~2024-07-31  6:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31  5:46 [PATCH 1/2] mm: shmem: avoid allocating huge pages larger than MAX_PAGECACHE_ORDER for shmem Baolin Wang
2024-07-31  5:46 ` [PATCH 2/2] mm: shmem: fix incorrect aligned index when checking conflicts Baolin Wang
2024-07-31  9:18   ` David Hildenbrand
2024-07-31  6:18 ` Barry Song [this message]
2024-07-31  8:56   ` [PATCH 1/2] mm: shmem: avoid allocating huge pages larger than MAX_PAGECACHE_ORDER for shmem Baolin Wang
2024-07-31  9:59     ` Kefeng Wang
2024-07-31 10:22       ` Baolin Wang
2024-07-31 20:48         ` Andrew Morton
2024-08-01  0:06           ` Baolin Wang
2024-08-01 19:55             ` Andrew Morton
2024-08-02  3:11               ` Baolin Wang
2024-07-31  9:17 ` David Hildenbrand
2024-07-31 13:09 ` Zi Yan

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=CAGsJ_4xmHY06VAKzXxCFcovPkrR0WOR28jXbaeD5VyUBHWzn_w@mail.gmail.com \
    --to=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@redhat.com \
    --cc=gshan@redhat.com \
    --cc=hughd@google.com \
    --cc=ioworker0@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ryan.roberts@arm.com \
    --cc=willy@infradead.org \
    --cc=ziy@nvidia.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).