linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Mika Penttilä" <mpenttil@redhat.com>
To: Muchun Song <songmuchun@bytedance.com>,
	mike.kravetz@oracle.com, muchun.song@linux.dev,
	akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: hugetlb_vmemmap: use PageCompound() instead of PageReserved()
Date: Wed, 19 Jul 2023 09:51:48 +0300	[thread overview]
Message-ID: <2b66797b-3ee9-a70f-25d0-dcab830859d2@redhat.com> (raw)
In-Reply-To: <20230719063132.37676-1-songmuchun@bytedance.com>

Hi,


On 19.7.2023 9.31, Muchun Song wrote:
> The ckeck of PageReserved() is easy to be broken in the future, PageCompound()
> is more stable to check if the page should be split.
> 
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> ---
>   mm/hugetlb_vmemmap.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c
> index 4b9734777f69..8068fe890f52 100644
> --- a/mm/hugetlb_vmemmap.c
> +++ b/mm/hugetlb_vmemmap.c
> @@ -73,8 +73,10 @@ static int split_vmemmap_huge_pmd(pmd_t *pmd, unsigned long start)
>   		 * be treated as indepdenent small pages (as they can be freed
>   		 * individually).
>   		 */
> -		if (!PageReserved(head))
> +		if (PageCompound(head)) {
> +			VM_BUG_ON(compound_order(head) != get_order(PMD_SIZE));
>   			split_page(head, get_order(PMD_SIZE));

I think vmemmap pages are not compound pages (even order > 0).
They would bug on here trying to split_page() :


void split_page(struct page *page, unsigned int order)
{
         int i;

         VM_BUG_ON_PAGE(PageCompound(page), page);


> +		}
>   
>   		/* Make pte visible before pmd. See comment in pmd_install(). */
>   		smp_wmb();

--Mika



  reply	other threads:[~2023-07-19  6:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19  6:31 Muchun Song
2023-07-19  6:51 ` Mika Penttilä [this message]
2023-07-19  7:00   ` Muchun Song

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=2b66797b-3ee9-a70f-25d0-dcab830859d2@redhat.com \
    --to=mpenttil@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=muchun.song@linux.dev \
    --cc=songmuchun@bytedance.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