From: alexs@kernel.org
To: Will Deacon <will@kernel.org>,
"Aneesh Kumar K . V" <aneesh.kumar@kernel.org>,
Nick Piggin <npiggin@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Russell King <linux@armlinux.org.uk>,
Catalin Marinas <catalin.marinas@arm.com>,
Brian Cain <bcain@quicinc.com>, WANG Xuerui <kernel@xen0n.name>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Jonas Bonn <jonas@southpole.se>,
Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
Stafford Horne <shorne@gmail.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Naveen N Rao <naveen@kernel.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H . Peter Anvin" <hpa@zytor.com>,
Andy Lutomirski <luto@kernel.org>, Bibo Mao <maobibo@loongson.cn>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
linux-arch@vger.kernel.org, linux-mm@kvack.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org,
linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev,
linux-m68k@lists.linux-m68k.org, linux-openrisc@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
Qi Zheng <zhengqi.arch@bytedance.com>,
Vishal Moola <vishal.moola@gmail.com>,
"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
Kemeng Shi <shikemeng@huaweicloud.com>,
Lance Yang <ioworker0@gmail.com>, Peter Xu <peterx@redhat.com>,
Barry Song <baohua@kernel.org>,
linux-s390@vger.kernel.org
Cc: Guo Ren <guoren@kernel.org>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Palmer Dabbelt <palmer@dabbelt.com>,
Mike Rapoport <rppt@kernel.org>,
Oscar Salvador <osalvador@suse.de>,
Alexandre Ghiti <alexghiti@rivosinc.com>,
Jisheng Zhang <jszhang@kernel.org>,
Samuel Holland <samuel.holland@sifive.com>,
Anup Patel <anup@brainfault.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Breno Leitao <leitao@debian.org>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Gerald Schaefer <gerald.schaefer@linux.ibm.com>,
Hugh Dickins <hughd@google.com>,
David Hildenbrand <david@redhat.com>,
Ryan Roberts <ryan.roberts@arm.com>,
Matthew Wilcox <willy@infradead.org>, Alex Shi <alexs@kernel.org>,
"Naveen N . Rao" <naveen.n.rao@linux.ibm.com>,
linux-fsdevel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: [RFC PATCH 17/18] mm: convert vmf.prealloc_pte to struct ptdesc pointer
Date: Tue, 30 Jul 2024 15:27:18 +0800 [thread overview]
Message-ID: <20240730072719.3715016-7-alexs@kernel.org> (raw)
In-Reply-To: <20240730072719.3715016-1-alexs@kernel.org>
From: Alex Shi <alexs@kernel.org>
vmfs.prealloc_pte is a pointer to page table memory, so converter it to
struct ptdesc pointer.
Signed-off-by: Alex Shi <alexs@kernel.org>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/mm.h | 2 +-
mm/filemap.c | 2 +-
mm/memory.c | 12 ++++++------
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 7424f964dff3..749d6dd311fa 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -567,7 +567,7 @@ struct vm_fault {
* Protects pte page table if 'pte'
* is not NULL, otherwise pmd.
*/
- pgtable_t prealloc_pte; /* Pre-allocated pte page table.
+ struct ptdesc *prealloc_pte; /* Pre-allocated pte page table.
* vm_ops->map_pages() sets up a page
* table from atomic context.
* do_fault_around() pre-allocates
diff --git a/mm/filemap.c b/mm/filemap.c
index 3708ef71182e..d62150418b91 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3453,7 +3453,7 @@ static bool filemap_map_pmd(struct vm_fault *vmf, struct folio *folio,
}
if (pmd_none(*vmf->pmd) && vmf->prealloc_pte)
- pmd_install(mm, vmf->pmd, (struct ptdesc **)&vmf->prealloc_pte);
+ pmd_install(mm, vmf->pmd, &vmf->prealloc_pte);
return false;
}
diff --git a/mm/memory.c b/mm/memory.c
index 79685600d23f..1a5fb17ab045 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4648,7 +4648,7 @@ static vm_fault_t __do_fault(struct vm_fault *vmf)
* # flush A, B to clear the writeback
*/
if (pmd_none(*vmf->pmd) && !vmf->prealloc_pte) {
- vmf->prealloc_pte = ptdesc_page(pte_alloc_one(vma->vm_mm));
+ vmf->prealloc_pte = pte_alloc_one(vma->vm_mm);
if (!vmf->prealloc_pte)
return VM_FAULT_OOM;
}
@@ -4687,7 +4687,7 @@ static void deposit_prealloc_pte(struct vm_fault *vmf)
{
struct vm_area_struct *vma = vmf->vma;
- pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, page_ptdesc(vmf->prealloc_pte));
+ pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, vmf->prealloc_pte);
/*
* We are going to consume the prealloc table,
* count that as nr_ptes.
@@ -4726,7 +4726,7 @@ vm_fault_t do_set_pmd(struct vm_fault *vmf, struct page *page)
* related to pte entry. Use the preallocated table for that.
*/
if (arch_needs_pgtable_deposit() && !vmf->prealloc_pte) {
- vmf->prealloc_pte = ptdesc_page(pte_alloc_one(vma->vm_mm));
+ vmf->prealloc_pte = pte_alloc_one(vma->vm_mm);
if (!vmf->prealloc_pte)
return VM_FAULT_OOM;
}
@@ -4868,7 +4868,7 @@ vm_fault_t finish_fault(struct vm_fault *vmf)
}
if (vmf->prealloc_pte)
- pmd_install(vma->vm_mm, vmf->pmd, (struct ptdesc **)&vmf->prealloc_pte);
+ pmd_install(vma->vm_mm, vmf->pmd, &vmf->prealloc_pte);
else if (unlikely(pte_alloc(vma->vm_mm, vmf->pmd)))
return VM_FAULT_OOM;
}
@@ -5011,7 +5011,7 @@ static vm_fault_t do_fault_around(struct vm_fault *vmf)
pte_off + vma_pages(vmf->vma) - vma_off) - 1;
if (pmd_none(*vmf->pmd)) {
- vmf->prealloc_pte = ptdesc_page(pte_alloc_one(vmf->vma->vm_mm));
+ vmf->prealloc_pte = pte_alloc_one(vmf->vma->vm_mm);
if (!vmf->prealloc_pte)
return VM_FAULT_OOM;
}
@@ -5197,7 +5197,7 @@ static vm_fault_t do_fault(struct vm_fault *vmf)
/* preallocated pagetable is unused: free it */
if (vmf->prealloc_pte) {
- pte_free(vm_mm, page_ptdesc(vmf->prealloc_pte));
+ pte_free(vm_mm, vmf->prealloc_pte);
vmf->prealloc_pte = NULL;
}
return ret;
--
2.43.0
next prev parent reply other threads:[~2024-07-30 7:24 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-30 6:46 [RFC PATCH 00/18] use struct ptdesc to replace pgtable_t alexs
2024-07-30 6:46 ` [RFC PATCH 01/18] mm/pgtable: use ptdesc in pte_free_now/pte_free_defer alexs
2024-07-30 6:46 ` [RFC PATCH 02/18] mm/pgtable: convert ptdesc.pmd_huge_pte to ptdesc pointer alexs
2024-07-30 6:46 ` [RFC PATCH 03/18] fs/dax: use ptdesc in dax_pmd_load_hole alexs
2024-07-30 6:46 ` [RFC PATCH 04/18] mm/thp: use ptdesc pointer in __do_huge_pmd_anonymous_page alexs
2024-07-30 6:46 ` [RFC PATCH 05/18] mm/thp: use ptdesc in do_huge_pmd_anonymous_page alexs
2024-07-30 6:47 ` [RFC PATCH 06/18] mm/thp: convert insert_pfn_pmd and its caller to use ptdesc alexs
2024-07-30 6:47 ` [RFC PATCH 07/18] mm/thp: use ptdesc in copy_huge_pmd alexs
2024-07-30 6:47 ` [RFC PATCH 08/18] mm/memory: use ptdesc in __pte_alloc alexs
2024-07-30 6:47 ` [RFC PATCH 09/18] mm/pgtable: fully use ptdesc in pte_alloc_one series functions alexs
2024-07-30 6:47 ` [RFC PATCH 10/18] mm/pgtable: pass ptdesc to pte_free() alexs
2024-07-30 7:27 ` [RFC PATCH 11/18] mm/pgtable: introduce ptdesc_pfn and use ptdesc in free_pte_range() alexs
2024-07-30 7:27 ` [RFC PATCH 12/18] mm/thp: pass ptdesc to set_huge_zero_folio function alexs
2024-07-30 7:27 ` [RFC PATCH 13/18] mm/pgtable: return ptdesc pointer in pgtable_trans_huge_withdraw alexs
2024-07-30 7:27 ` [RFC PATCH 14/18] mm/pgtable: use ptdesc in pgtable_trans_huge_deposit alexs
2024-07-30 7:27 ` [RFC PATCH 15/18] mm/pgtable: pass ptdesc to pmd_populate alexs
2024-07-30 7:27 ` [RFC PATCH 16/18] mm/pgtable: pass ptdesc to pmd_install alexs
2024-07-30 7:27 ` alexs [this message]
2024-07-30 7:27 ` [RFC PATCH 18/18] mm/pgtable: pass ptdesc in pte_free_defer alexs
2024-07-30 8:10 ` [RFC PATCH 00/18] use struct ptdesc to replace pgtable_t Alex Shi
2024-08-14 16:50 ` LEROY Christophe
2024-08-15 6:32 ` Alex Shi
2024-08-14 17:13 ` Matthew Wilcox
2024-08-15 6:17 ` Alex Shi
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=20240730072719.3715016-7-alexs@kernel.org \
--to=alexs@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=alexghiti@rivosinc.com \
--cc=aneesh.kumar@kernel.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=bcain@quicinc.com \
--cc=borntraeger@linux.ibm.com \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=dave.hansen@linux.intel.com \
--cc=david@redhat.com \
--cc=geert@linux-m68k.org \
--cc=gerald.schaefer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=guoren@kernel.org \
--cc=hca@linux.ibm.com \
--cc=hpa@zytor.com \
--cc=hughd@google.com \
--cc=ioworker0@gmail.com \
--cc=jonas@southpole.se \
--cc=jpoimboe@kernel.org \
--cc=jszhang@kernel.org \
--cc=kernel@xen0n.name \
--cc=leitao@debian.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-csky@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-hexagon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-mm@kvack.org \
--cc=linux-openrisc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=loongarch@lists.linux.dev \
--cc=luto@kernel.org \
--cc=maobibo@loongson.cn \
--cc=mpe@ellerman.id.au \
--cc=naveen.n.rao@linux.ibm.com \
--cc=naveen@kernel.org \
--cc=npiggin@gmail.com \
--cc=osalvador@suse.de \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=peterx@redhat.com \
--cc=peterz@infradead.org \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=samuel.holland@sifive.com \
--cc=shikemeng@huaweicloud.com \
--cc=shorne@gmail.com \
--cc=stefan.kristiansson@saunalahti.fi \
--cc=svens@linux.ibm.com \
--cc=tglx@linutronix.de \
--cc=vishal.moola@gmail.com \
--cc=will@kernel.org \
--cc=willy@infradead.org \
--cc=x86@kernel.org \
--cc=zhengqi.arch@bytedance.com \
/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