From: Vishal Moola <vishal.moola@gmail.com>
To: Muchun Song <muchun.song@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>, Linux-MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: Re: [PATCH v2 2/3] hugetlb: Convert hugetlb_no_page() to use struct vm_fault
Date: Mon, 8 Apr 2024 10:45:27 -0700 [thread overview]
Message-ID: <ZhQtN8y5zud8iI1u@fedora> (raw)
In-Reply-To: <73DFA2EE-0929-4801-9C7C-A393F7796CE8@linux.dev>
[-- Attachment #1: Type: text/plain, Size: 2169 bytes --]
On Sun, Apr 07, 2024 at 04:59:13PM +0800, Muchun Song wrote:
>
>
> > On Apr 5, 2024, at 03:58, Vishal Moola <vishal.moola@gmail.com> wrote:
> >
> > On Thu, Apr 4, 2024 at 5:49 AM Oscar Salvador <osalvador@suse.de> wrote:
> >>
> >> On Mon, Apr 01, 2024 at 01:26:50PM -0700, Vishal Moola (Oracle) wrote:
> >>> hugetlb_no_page() can use the struct vm_fault passed in from
> >>> hugetlb_fault(). This alleviates the stack by consolidating 7
> >>> variables into a single struct.
> >>>
> >>> Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
> >>> ---
> >>> mm/hugetlb.c | 59 ++++++++++++++++++++++++++--------------------------
> >>> 1 file changed, 29 insertions(+), 30 deletions(-)
> >>>
> >>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> >>> index 360b82374a89..aca2f11b4138 100644
> >>> --- a/mm/hugetlb.c
> >>> +++ b/mm/hugetlb.c
> >>> @@ -6189,9 +6189,7 @@ static bool hugetlb_pte_stable(struct hstate *h, struct mm_struct *mm,
> >>>
> >>> static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
> >>> struct vm_area_struct *vma,
> >>> - struct address_space *mapping, pgoff_t idx,
> >>> - unsigned long address, pte_t *ptep,
> >>> - pte_t old_pte, unsigned int flags,
> >>> + struct address_space *mapping,
> >>
> >> AFAICS all this can be self-contained in vm_fault struct.
> >> vmf->vma->mm and vmf->vma.
> >> I mean, if we want to convert this interface, why not going all the way?
> >>
> >> Looks a bit odd some fields yes while some others remain.
> >>
> >> Or am I missing something?
> >
> > Mainly just minimizing code churn, we would either unnecessarily
> > change multiple lines using vma or have to declare the variables
> > again anyways (or have extra churn I didn't like).
>
> I don't think adding some variables is a problem. I suppose the compiler
> could do some optimization for us. So I think it is better to pass
> only one argument vmf to hugetlb_no_page(). Otherwise, LGTM.
Alright we can get rid of the vm_area_struct and mm_struct arguments as
well.
Andrew, could you please fold the attached patch into this one?
[-- Attachment #2: 0001-hugetlb-Simplify-hugetlb_no_page-arguments.patch --]
[-- Type: text/plain, Size: 1513 bytes --]
From 891e085115a06f638e238bea267d520bb2432fba Mon Sep 17 00:00:00 2001
From: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Date: Mon, 8 Apr 2024 10:17:54 -0700
Subject: [PATCH 1/2] hugetlb: Simplify hugetlb_no_page() arguments
To simplify the function arguments, as suggested by Oscar and Muchun.
Suggested-by: Muchun Song <muchun.song@linux.dev>
Suggested-by: Oscar Salvador <osalvador@suse.de>
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
mm/hugetlb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 456c81fbf8f5..05fe610f4699 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -6186,11 +6186,11 @@ static bool hugetlb_pte_stable(struct hstate *h, struct mm_struct *mm,
return same;
}
-static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
- struct vm_area_struct *vma,
- struct address_space *mapping,
+static vm_fault_t hugetlb_no_page(struct address_space *mapping,
struct vm_fault *vmf)
{
+ struct vm_area_struct *vma = vmf->vma;
+ struct mm_struct *mm = vma->vm_mm;
struct hstate *h = hstate_vma(vma);
vm_fault_t ret = VM_FAULT_SIGBUS;
int anon_rmap = 0;
@@ -6483,7 +6483,7 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
* hugetlb_no_page will drop vma lock and hugetlb fault
* mutex internally, which make us return immediately.
*/
- return hugetlb_no_page(mm, vma, mapping, &vmf);
+ return hugetlb_no_page(mapping, &vmf);
}
ret = 0;
--
2.43.0
next prev parent reply other threads:[~2024-04-08 17:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-01 20:26 [PATCH v2 0/3] Hugetlb fault path to use struct vm_fault Vishal Moola (Oracle)
2024-04-01 20:26 ` [PATCH v2 1/3] hugetlb: Convert hugetlb_fault() " Vishal Moola (Oracle)
2024-04-04 12:27 ` Oscar Salvador
2024-04-04 19:32 ` Vishal Moola
2024-04-07 7:36 ` Muchun Song
2024-04-07 7:18 ` Muchun Song
2024-04-01 20:26 ` [PATCH v2 2/3] hugetlb: Convert hugetlb_no_page() " Vishal Moola (Oracle)
2024-04-04 12:50 ` Oscar Salvador
2024-04-04 19:58 ` Vishal Moola
2024-04-07 8:59 ` Muchun Song
2024-04-08 17:45 ` Vishal Moola [this message]
2024-04-05 3:12 ` Oscar Salvador
2024-04-01 20:26 ` [PATCH v2 3/3] hugetlb: Convert hugetlb_wp() " Vishal Moola (Oracle)
2024-04-05 3:23 ` Oscar Salvador
2024-04-07 9:12 ` Muchun Song
2024-04-08 17:47 ` Vishal Moola
2024-04-08 17:55 ` Matthew Wilcox
2024-04-04 2:07 ` [PATCH v2 0/3] Hugetlb fault path " Andrew Morton
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=ZhQtN8y5zud8iI1u@fedora \
--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=osalvador@suse.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.