[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHbLzko1J9ds_JfZe83JwEx=395sPExB7mQ0faju6OSaQ2tmnQ@mail.gmail.com>
Date: Fri, 18 Aug 2023 14:21:22 -0700
From: Yang Shi <shy828301@...il.com>
To: "Zach O'Keefe" <zokeefe@...gle.com>
Cc: Saurabh Singh Sengar <ssengar@...rosoft.com>,
Matthew Wilcox <willy@...radead.org>,
Dan Williams <dan.j.williams@...el.com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [EXTERNAL] [PATCH] mm/thp: fix "mm: thp: kill __transhuge_page_enabled()"
On Thu, Aug 17, 2023 at 11:29 AM Zach O'Keefe <zokeefe@...gle.com> wrote:
>
> On Thu, Aug 17, 2023 at 10:47 AM Yang Shi <shy828301@...il.com> wrote:
> >
> > On Wed, Aug 16, 2023 at 2:48 PM Zach O'Keefe <zokeefe@...gle.com> wrote:
> > >
> > > > We have a out of tree driver that maps huge pages through a file handle and
> > > > relies on -> huge_fault. It used to work in 5.19 kernels but 6.1 changed this
> > > > behaviour.
> > > >
> > > > I don’t think reverting the earlier behaviour of fault_path for huge pages should
> > > > impact kernel negatively.
> > > >
> > > > Do you think we can restore this earlier behaviour of kernel to allow page fault
> > > > for huge pages via ->huge_fault.
> > >
> > > That seems reasonable to me. I think using the existence of a
> > > ->huge_fault() handler as a predicate to return "true" makes sense to
> > > me. The "normal" flow for file-backed memory along fault path still
> > > needs to return "false", so that we correctly fallback to ->fault()
> > > handler. Unless there are objections, I can do that in a v2.
> >
> > Sorry for chiming in late. I'm just back from vacation and trying to catch up...
> >
> > IIUC the out-of-tree driver tries to allocate huge page and install
> > PMD mapping via huge_fault() handler, but the cleanup of
> > hugepage_vma_check() prevents this due to the check to
> > VM_NO_KHUGEPAGED?
> >
> > So you would like to check whether a huge_fault() handler existed
> > instead of vma_is_dax()?
>
> Sorry for the multiple threads here. There are two problems: (a) the
> VM_NO_KHUGEPAGED check along fault path, and (b) we don't give
> ->huge_fault() a fair shake, if it exists, along fault path. The
> current code assumes vma_is_dax() iff ->huge_fault() exists.
>
> (a) is easy enough to fix. For (b), I'm currently looking at the
> possibility of not worrying about ->huge_fault() in
> hugepage_vma_check(), and just letting create_huge_pud() /
> create_huge_pmd() check and fallback as necessary. I think we'll need
> the explicit DAX check still, since we want to keep khugepaged and
> MADV_COLLAPSE away, and the presence / absence of ->huge_fault() isn't
> enough to know that (well.. today it kind of is, but we shouldn't
> depend on it).
You meant something like:
if (vma->vm_ops->huge_fault) {
if (vma_is_dax(vma))
return in_pf;
/Fall through */
}
Powered by blists - more mailing lists