linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Zi Yan <ziy@nvidia.com>
Cc: linux-mm@kvack.org
Subject: Re: [bug report] mm: huge_memory: enable debugfs to split huge pages to any order
Date: Thu, 7 Mar 2024 17:31:17 +0300	[thread overview]
Message-ID: <f23c753c-5fb6-4aaf-bd99-39dafe058ed3@moroto.mountain> (raw)
In-Reply-To: <4EFF8F91-5B42-4E90-BFBB-FBA8DAAB8301@nvidia.com>

On Thu, Mar 07, 2024 at 09:20:09AM -0500, Zi Yan wrote:
> 
> Can you check if the patch below fixes the issue? I checked the inputs from
> debugfs and also inside split_huge_page_to_list_to_order().
> 
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index a81a09236c16..4d21e57a7d07 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -3052,6 +3052,9 @@ int split_huge_page_to_list_to_order(struct page *page, struct list_head *list,
>         VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
>         VM_BUG_ON_FOLIO(!folio_test_large(folio), folio);
> 
> +       if (new_order >= folio_order(folio))
> +               return -EINVAL;
> +
>         /* Cannot split anonymous THP to order-1 */
>         if (new_order == 1 && folio_test_anon(folio)) {
>                 VM_WARN_ONCE(1, "Cannot split to order-1 folio");

From a static analysis perspective I think just this is sufficient?  But
I don't really know the code and don't object to the other parts of
this path either.

regards,
dan carpenter



  reply	other threads:[~2024-03-07 14:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-07 13:49 [bug report] mm: huge_memory: enable debugfs to split huge pages to any order Dan Carpenter
2024-03-07 14:20 ` Zi Yan
2024-03-07 14:31   ` Dan Carpenter [this message]
2024-03-07 14:41     ` Zi Yan
2024-03-07 14:44       ` Dan Carpenter

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=f23c753c-5fb6-4aaf-bd99-39dafe058ed3@moroto.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=linux-mm@kvack.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).