[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200525045945.lkw36jergxwg7bfj@box>
Date: Mon, 25 May 2020 07:59:45 +0300
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: Matthew Wilcox <willy@...radead.org>
Cc: linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 24/36] mm: Remove page fault assumption of compound
page size
On Fri, May 15, 2020 at 06:16:44AM -0700, Matthew Wilcox wrote:
> From: "Matthew Wilcox (Oracle)" <willy@...radead.org>
>
> A compound page in the page cache will not necessarily be of PMD size,
> so check explicitly.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
> ---
> mm/memory.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index f703fe8c8346..d68ce428ddd2 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3549,13 +3549,14 @@ static vm_fault_t do_set_pmd(struct vm_fault *vmf, struct page *page)
> unsigned long haddr = vmf->address & HPAGE_PMD_MASK;
> pmd_t entry;
> int i;
> - vm_fault_t ret;
> + vm_fault_t ret = VM_FAULT_FALLBACK;
>
> if (!transhuge_vma_suitable(vma, haddr))
> - return VM_FAULT_FALLBACK;
> + return ret;
>
> - ret = VM_FAULT_FALLBACK;
> page = compound_head(page);
> + if (page_order(page) != HPAGE_PMD_ORDER)
> + return ret;
Maybe WARN() for page_order(page) > HPAGE_PMD_ORDER. It would be fun to
handle :P
>
> /*
> * Archs like ppc64 need additonal space to store information
> --
> 2.26.2
>
--
Kirill A. Shutemov
Powered by blists - more mailing lists