lkml.org 
[lkml]   [2023]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] mm: hugetlb_vmemmap: use PageCompound() instead of PageReserved()
From
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

\
 
 \ /
  Last update: 2023-07-19 08:53    [W:0.154 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site