[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240730064712.3714387-4-alexs@kernel.org>
Date: Tue, 30 Jul 2024 14:46:57 +0800
From: alexs@...nel.org
To: Will Deacon <will@...nel.org>,
"Aneesh Kumar K . V" <aneesh.kumar@...nel.org>,
Nick Piggin <npiggin@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
Russell King <linux@...linux.org.uk>,
Catalin Marinas <catalin.marinas@....com>,
Brian Cain <bcain@...cinc.com>,
WANG Xuerui <kernel@...0n.name>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Jonas Bonn <jonas@...thpole.se>,
Stefan Kristiansson <stefan.kristiansson@...nalahti.fi>,
Stafford Horne <shorne@...il.com>,
Michael Ellerman <mpe@...erman.id.au>,
Naveen N Rao <naveen@...nel.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Albert Ou <aou@...s.berkeley.edu>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org,
"H . Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...nel.org>,
Bibo Mao <maobibo@...ngson.cn>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
linux-arch@...r.kernel.org,
linux-mm@...ck.org,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
linux-csky@...r.kernel.org,
linux-hexagon@...r.kernel.org,
loongarch@...ts.linux.dev,
linux-m68k@...ts.linux-m68k.org,
linux-openrisc@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org,
linux-riscv@...ts.infradead.org,
Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>,
Qi Zheng <zhengqi.arch@...edance.com>,
Vishal Moola <vishal.moola@...il.com>,
"Aneesh Kumar K . V" <aneesh.kumar@...ux.ibm.com>,
Kemeng Shi <shikemeng@...weicloud.com>,
Lance Yang <ioworker0@...il.com>,
Peter Xu <peterx@...hat.com>,
Barry Song <baohua@...nel.org>,
linux-s390@...r.kernel.org
Cc: Guo Ren <guoren@...nel.org>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Palmer Dabbelt <palmer@...belt.com>,
Mike Rapoport <rppt@...nel.org>,
Oscar Salvador <osalvador@...e.de>,
Alexandre Ghiti <alexghiti@...osinc.com>,
Jisheng Zhang <jszhang@...nel.org>,
Samuel Holland <samuel.holland@...ive.com>,
Anup Patel <anup@...infault.org>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Breno Leitao <leitao@...ian.org>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Gerald Schaefer <gerald.schaefer@...ux.ibm.com>,
Hugh Dickins <hughd@...gle.com>,
David Hildenbrand <david@...hat.com>,
Ryan Roberts <ryan.roberts@....com>,
Matthew Wilcox <willy@...radead.org>,
Alex Shi <alexs@...nel.org>,
nvdimm@...ts.linux.dev,
linux-fsdevel@...r.kernel.org,
Christian Brauner <brauner@...nel.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Jan Kara <jack@...e.cz>,
Dan Williams <dan.j.williams@...el.com>
Subject: [RFC PATCH 03/18] fs/dax: use ptdesc in dax_pmd_load_hole
From: Alex Shi <alexs@...nel.org>
Since we have ptdesc struct now, better to use replace pgtable_t, aka
'struct page *'.
It's a prepare for return ptdesc pointer in pte_alloc_one series
function.
Signed-off-by: Alex Shi <alexs@...nel.org>
Cc: linux-kernel@...r.kernel.org
Cc: nvdimm@...ts.linux.dev
Cc: linux-fsdevel@...r.kernel.org
Cc: Christian Brauner <brauner@...nel.org>
Cc: Alexander Viro <viro@...iv.linux.org.uk>
Cc: Jan Kara <jack@...e.cz>
Cc: Matthew Wilcox <willy@...radead.org>
Cc: Dan Williams <dan.j.williams@...el.com>
---
fs/dax.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/dax.c b/fs/dax.c
index becb4a6920c6..6f7cea248206 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1206,7 +1206,7 @@ static vm_fault_t dax_pmd_load_hole(struct xa_state *xas, struct vm_fault *vmf,
unsigned long pmd_addr = vmf->address & PMD_MASK;
struct vm_area_struct *vma = vmf->vma;
struct inode *inode = mapping->host;
- pgtable_t pgtable = NULL;
+ struct ptdesc *ptdesc = NULL;
struct folio *zero_folio;
spinlock_t *ptl;
pmd_t pmd_entry;
@@ -1222,8 +1222,8 @@ static vm_fault_t dax_pmd_load_hole(struct xa_state *xas, struct vm_fault *vmf,
DAX_PMD | DAX_ZERO_PAGE);
if (arch_needs_pgtable_deposit()) {
- pgtable = pte_alloc_one(vma->vm_mm);
- if (!pgtable)
+ ptdesc = page_ptdesc(pte_alloc_one(vma->vm_mm));
+ if (!ptdesc)
return VM_FAULT_OOM;
}
@@ -1233,8 +1233,8 @@ static vm_fault_t dax_pmd_load_hole(struct xa_state *xas, struct vm_fault *vmf,
goto fallback;
}
- if (pgtable) {
- pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, pgtable);
+ if (ptdesc) {
+ pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, ptdesc_page(ptdesc));
mm_inc_nr_ptes(vma->vm_mm);
}
pmd_entry = mk_pmd(&zero_folio->page, vmf->vma->vm_page_prot);
@@ -1245,8 +1245,8 @@ static vm_fault_t dax_pmd_load_hole(struct xa_state *xas, struct vm_fault *vmf,
return VM_FAULT_NOPAGE;
fallback:
- if (pgtable)
- pte_free(vma->vm_mm, pgtable);
+ if (ptdesc)
+ pte_free(vma->vm_mm, ptdesc_page(ptdesc));
trace_dax_pmd_load_hole_fallback(inode, vmf, zero_folio, *entry);
return VM_FAULT_FALLBACK;
}
--
2.43.0
Powered by blists - more mailing lists