From: Vishal Moola <vishal.moola@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, muchun.song@linux.dev
Subject: Re: [PATCH 2/3] hugetlb: Use vmf_anon_prepare() instead of anon_vma_prepare()
Date: Wed, 21 Feb 2024 09:15:51 -0800 [thread overview]
Message-ID: <CAOzc2pzLbiEpMuBpX7xXhZqPc0S6ZMnziT2uUFsa0tZe6yJQ0g@mail.gmail.com> (raw)
In-Reply-To: <ZdVx_Jr9tm2lV0Ku@casper.infradead.org>
On Tue, Feb 20, 2024 at 7:46 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Tue, Feb 20, 2024 at 03:14:23PM -0800, Vishal Moola (Oracle) wrote:
> > +++ b/mm/hugetlb.c
> > @@ -5834,9 +5834,15 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma,
> > struct folio *old_folio;
> > struct folio *new_folio;
> > int outside_reserve = 0;
> > - vm_fault_t ret = 0;
> > + vm_fault_t ret = 0, anon_ret = 0;
>
> Do we need a second variable here? Seems to me like we could
> unconditionally assign to ret:
Hmm, looks like we can directly assign to ret without any problems
in both functions, I'll change that for v2.
> > - if (unlikely(anon_vma_prepare(vma))) {
> > - ret = VM_FAULT_OOM;
> > + anon_ret = vmf_anon_prepare(&vmf);
> > + if (unlikely(anon_ret)) {
> > + ret = anon_ret;
>
>
>
> > unsigned long haddr = address & huge_page_mask(h);
> > struct mmu_notifier_range range;
> > + struct vm_fault vmf = {
> > + .vma = vma,
> > + .address = haddr,
> > + .real_address = address,
> > + .flags = flags,
> > + };
>
> We don't usually indent quite so far. One extra tab would be enough.
>
> Also, I thought we talked about creating the vmf in hugetlb_fault(),
> then passing it to hugetlb_wp() hugetlb_no_page() and handle_userfault()?
> Was there a reason to abandon that idea?
No I haven't abandoned that idea, I intend to have a separate patchset to go
on top of this one - just keeping them separate since they are conceptually
different. I'm converting each function to use struct vm_fault first, then
shifting it to be passed throughout as an arguement while cleaning up the
excess variables laying around. In a sense working bottom-up instead
of top-down.
next prev parent reply other threads:[~2024-02-21 17:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-20 23:14 [PATCH 0/3] Handle hugetlb faults under the VMA lock Vishal Moola (Oracle)
2024-02-20 23:14 ` [PATCH 1/3] mm/memory: Change vmf_anon_prepare() to be non-static Vishal Moola (Oracle)
2024-02-21 3:36 ` Matthew Wilcox
2024-02-21 16:49 ` Vishal Moola
2024-02-21 17:30 ` kernel test robot
2024-02-21 19:37 ` kernel test robot
2024-02-20 23:14 ` [PATCH 2/3] hugetlb: Use vmf_anon_prepare() instead of anon_vma_prepare() Vishal Moola (Oracle)
2024-02-21 3:46 ` Matthew Wilcox
2024-02-21 17:15 ` Vishal Moola [this message]
2024-02-21 17:55 ` Matthew Wilcox
2024-02-21 18:02 ` Vishal Moola
2024-02-20 23:14 ` [PATCH 3/3] hugetlb: Allow faults to be handled under the VMA lock Vishal Moola (Oracle)
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=CAOzc2pzLbiEpMuBpX7xXhZqPc0S6ZMnziT2uUFsa0tZe6yJQ0g@mail.gmail.com \
--to=vishal.moola@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=willy@infradead.org \
/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