Re: [PATCH 1/7] mm: Set the pte dirty if the folio is already dirty

2025-02-18 Thread Matthew Wilcox
On Tue, Feb 18, 2025 at 05:20:28PM +0100, Alexander Gordeev wrote: > > +++ b/arch/s390/include/asm/pgtable.h > > @@ -1451,12 +1451,7 @@ static inline pte_t mk_pte_phys(unsigned long > > physpage, pgprot_t pgprot) > > > > static inline pte_t mk_pte(struct page *page, pgprot_t pgprot) > > { > >

[PATCH 7/7] mm: Add folio_mk_pte()

2025-02-17 Thread Matthew Wilcox (Oracle)
Removes a cast from folio to page in four callers of mk_pte(). Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mm.h | 15 +++ mm/memory.c| 6 +++--- mm/userfaultfd.c | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/include/linux/mm.h b

[PATCH 4/7] x86: Remove custom definition of mk_pte()

2025-02-17 Thread Matthew Wilcox (Oracle)
Move the shadow stack check to pfn_pte() which lets us use the common definition of mk_pte(). Signed-off-by: Matthew Wilcox (Oracle) --- arch/x86/include/asm/pgtable.h | 19 +++ 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch

[PATCH 6/7] mm: Make mk_pte() definition unconditional

2025-02-17 Thread Matthew Wilcox (Oracle)
All architectures now use the common mk_pte() definition, so we can remove the condition. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mm.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 3ef11ff3922f..62dccde9c561 100644 --- a

[PATCH 0/7] Add folio_mk_pte() and simplify mk_pte()

2025-02-17 Thread Matthew Wilcox (Oracle)
last patch to actually use folio_mk_pte() ought to be the least likely to have a problem since it's equivalent to calling mk_pte(&folio->page). Matthew Wilcox (Oracle) (7): mm: Set the pte dirty if the folio is already dirty mm: Introduce a common definition of mk_pte() sparc32

[PATCH 2/7] mm: Introduce a common definition of mk_pte()

2025-02-17 Thread Matthew Wilcox (Oracle)
Most architectures simply call pfn_pte(). Centralise that as the normal definition and remove the definition of mk_pte() from the architectures which have either that exact definition or something similar. Signed-off-by: Matthew Wilcox (Oracle) --- arch/alpha/include/asm/pgtable.h | 7

[PATCH 5/7] um: Remove custom definition of mk_pte()

2025-02-17 Thread Matthew Wilcox (Oracle)
Move the pfn_pte() definitions from the 2level and 4level files to the generic pgtable.h and delete the custom definition of mk_pte() so that we use the central definition. Signed-off-by: Matthew Wilcox (Oracle) --- arch/um/include/asm/pgtable-2level.h | 1 - arch/um/include/asm/pgtable

[PATCH 1/7] mm: Set the pte dirty if the folio is already dirty

2025-02-17 Thread Matthew Wilcox (Oracle)
If the first access to a folio is a read that is then followed by a write, we can save a page fault. s390 implemented this in their mk_pte() in commit abf09bed3cce ("s390/mm: implement software dirty bits"), but other architectures can also benefit from this. Signed-off-by: Matt

[PATCH 3/7] sparc32: Remove custom definition of mk_pte()

2025-02-17 Thread Matthew Wilcox (Oracle)
Instead of defining pfn_pte() in terms of mk_pte(), make pfn_pte() the base implementation. That lets us use the generic definition of mk_pte(). Signed-off-by: Matthew Wilcox (Oracle) --- arch/sparc/include/asm/pgtable_32.h | 15 +-- 1 file changed, 5 insertions(+), 10 deletions

Re: [PATCH 0/5] remove tlb_remove_page_ptdesc()

2025-02-07 Thread Matthew Wilcox
On Fri, Jan 24, 2025 at 12:47:59PM +0100, Peter Zijlstra wrote: > Right, so I don't think Sparc and Power care to use ptdesc, they're > using non page page-tables. i think you mean s390, not sparc. all architectures _use_ ptdescs, it's just that s390 and ppc use fractional ptdescs rather than an

Re: [PATCH] hostfs: Convert to writepages

2025-01-09 Thread Matthew Wilcox
On Fri, Dec 20, 2024 at 05:14:58AM +, Matthew Wilcox (Oracle) wrote: > If we add a migrate_folio operation, we can convert the writepage > operation to writepages. The large folio support here is illusory; > we would need to kmap each page in turn for proper support. But we do >

[PATCH] hostfs: Convert to writepages

2024-12-19 Thread Matthew Wilcox (Oracle)
If we add a migrate_folio operation, we can convert the writepage operation to writepages. The large folio support here is illusory; we would need to kmap each page in turn for proper support. But we do remove a few hidden calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle

Re: [PATCH -next] hostfs: Convert hostfs_writepage to use folio

2024-09-12 Thread Matthew Wilcox
On Thu, Sep 12, 2024 at 08:22:48PM +0200, Richard Weinberger wrote: > - Ursprüngliche Mail - > > Von: "Li Zetao" > > An: "richard" , "anton ivanov" > > , "Johannes Berg" > > > > CC: lizet...@huawei.com, "linux-um" , > > "linux-kernel" > > Gesendet: Dienstag, 20. August 2024 04:50:45 >

[PATCH 1/5] mm: Introduce a common definition of mk_pte()

2024-08-14 Thread Matthew Wilcox (Oracle)
Most architectures simply call pfn_pte(). Centralise that as the normal definition and remove the definition of mk_pte() from the architectures which have either that exact definition or something similar. Signed-off-by: Matthew Wilcox (Oracle) --- arch/alpha/include/asm/pgtable.h | 7

[PATCH 2/5] x86: Remove custom definition of mk_pte()

2024-08-14 Thread Matthew Wilcox (Oracle)
Move the shadow stack check to pfn_pte() which lets us use the common definition of mk_pte(). Signed-off-by: Matthew Wilcox (Oracle) --- arch/x86/include/asm/pgtable.h | 19 +++ 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch

[PATCH 3/5] um: Remove custom definition of mk_pte()

2024-08-14 Thread Matthew Wilcox (Oracle)
Move the pfn_pte() definitions from the 2level and 3level files to the generic pgtable.h, move the setting of newprot and newpage bits into pfn_pte() and delete the custom definition of mk_pte() so that we use the central definition. Signed-off-by: Matthew Wilcox (Oracle) --- arch/um/include

[PATCH 5/5] mm: Make mk_pte() definition unconditional

2024-08-14 Thread Matthew Wilcox (Oracle)
All architectures now use the common mk_pte() definition, so we can remove the condition. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pgtable.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 8204ffd87d74..1d46422b79cc

[PATCH 4/5] s390: Remove custom definition of mk_pte()

2024-08-14 Thread Matthew Wilcox (Oracle)
. Signed-off-by: Matthew Wilcox (Oracle) --- arch/s390/include/asm/pgtable.h | 11 --- 1 file changed, 11 deletions(-) diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index 6a21d947a687..1bb7f33394d0 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch

[PATCH 0/5] Provide a single definition of mk_pte()

2024-08-14 Thread Matthew Wilcox (Oracle)
ssage explaining why I did what I did to each architecture. I have some followup patches which remove folio->page conversions, but if this set of patches are wrong on any architecture, then they'll also be wrong, so I'm not sending them right now. Matthew Wilcox (Oracle) (5): mm:

Re: [linux-next:master] [fs] cdc4ad36a8: kernel_BUG_at_include/linux/page-flags.h

2024-08-06 Thread Matthew Wilcox
On Tue, Aug 06, 2024 at 10:26:17PM +0800, kernel test robot wrote: > kernel test robot noticed "kernel_BUG_at_include/linux/page-flags.h" on: > > commit: cdc4ad36a871b7ac43fcc6b2891058d332ce60ce ("fs: Convert > aops->write_begin to take a folio") > https://git.kernel.org/cgit/linux/kernel/git/nex

[PATCH 07/16] hostfs: Convert hostfs_read_folio() to use a folio

2024-05-30 Thread Matthew Wilcox (Oracle)
@lists.infradead.org Signed-off-by: Matthew Wilcox (Oracle) --- fs/hostfs/hostfs_kern.c | 23 ++- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index a73d27c4dd58..e7c72f2634f6 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs

[PATCH 12/30] hostfs: Convert hostfs_read_folio() to use a folio

2024-04-19 Thread Matthew Wilcox (Oracle)
@lists.infradead.org Signed-off-by: Matthew Wilcox (Oracle) --- fs/hostfs/hostfs_kern.c | 23 ++- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index a73d27c4dd58..e7c72f2634f6 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs

Re: Arches that don't support PREEMPT

2023-09-19 Thread Matthew Wilcox
On Tue, Sep 19, 2023 at 04:24:48PM +0200, John Paul Adrian Glaubitz wrote: > If the conversion isn't hard, why is the first reflex the urge to remove an > architecture > instead of offering advise how to get the conversion done? Because PREEMPT has been around since before 2005 (cc19ca86a023 crea

Arches that don't support PREEMPT

2023-09-19 Thread Matthew Wilcox
On Tue, Sep 19, 2023 at 02:30:59PM +0200, Thomas Gleixner wrote: > Though it just occured to me that there are dragons lurking: > > arch/alpha/Kconfig: select ARCH_NO_PREEMPT > arch/hexagon/Kconfig: select ARCH_NO_PREEMPT > arch/m68k/Kconfig: select ARCH_NO_PREEMPT if !COLDFIRE > arch/u

[PATCH v6 27/38] um: Implement the new page table range API

2023-08-02 Thread Matthew Wilcox (Oracle)
Add PFN_PTE_SHIFT and update_mmu_cache_range(). Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Mike Rapoport (IBM) Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Cc: linux-um@lists.infradead.org --- arch/um/include/asm/pgtable.h | 7 ++- 1 file changed, 2 insertions(+), 5

Re: [PATCH mm-unstable v7 00/31] Split ptdesc from struct page

2023-07-26 Thread Matthew Wilcox
On Mon, Jul 24, 2023 at 09:41:36PM -0700, Hugh Dickins wrote: > On Mon, 24 Jul 2023, Vishal Moola (Oracle) wrote: > > > The MM subsystem is trying to shrink struct page. This patchset > > introduces a memory descriptor for page table tracking - struct ptdesc. > > > > This patchset introduces ptde

[PATCH v5 27/38] um: Implement the new page table range API

2023-07-10 Thread Matthew Wilcox (Oracle)
Add PFN_PTE_SHIFT and update_mmu_cache_range(). Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Mike Rapoport (IBM) Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Cc: linux-um@lists.infradead.org --- arch/um/include/asm/pgtable.h | 7 ++- 1 file changed, 2 insertions(+), 5

Re: [PATCH v6 00/33] Split ptdesc from struct page

2023-06-28 Thread Matthew Wilcox
On Wed, Jun 28, 2023 at 09:41:18AM +0200, David Hildenbrand wrote: > I'm not a friend of these "overlays"; it all only really makes sense to me > once we actually allocate the descriptors dynamically. Maybe some of the > existing/ongoing conversions were different (that's why I was asking for the >

Re: [PATCH v6 00/33] Split ptdesc from struct page

2023-06-27 Thread Matthew Wilcox
On Mon, Jun 26, 2023 at 09:44:08PM -0700, Hugh Dickins wrote: > On Mon, 26 Jun 2023, Vishal Moola (Oracle) wrote: > > > The MM subsystem is trying to shrink struct page. This patchset > > introduces a memory descriptor for page table tracking - struct ptdesc. > ... > > 39 files changed, 686 inser

Re: [PATCH v4 04/34] pgtable: Create struct ptdesc

2023-06-16 Thread Matthew Wilcox
On Thu, Jun 15, 2023 at 12:57:19AM -0700, Hugh Dickins wrote: > Probably just trivial collisions in most architectures, which either > of us can easily adjust to the other; powerpc likely to be more awkward, > but fairly easily resolved; s390 quite a problem. > > I've so far been unable to post a

Re: [PATCH v2 05/34] mm: add utility functions for ptdesc

2023-05-27 Thread Matthew Wilcox
On Sat, May 27, 2023 at 01:41:44PM +0300, Mike Rapoport wrote: > Sorry if I wasn't clear, by "page table page" I meant the page (or memory > for that matter) for actual page table rather than struct page describing > that memory. > > So what we allocate here is the actual memory for the page table

Re: [PATCH v2 01/34] mm: Add PAGE_TYPE_OP folio functions

2023-05-25 Thread Matthew Wilcox
On Thu, May 25, 2023 at 01:38:54PM -0700, Vishal Moola wrote: > On Thu, May 25, 2023 at 1:20 PM Mike Rapoport wrote: > > > > On Thu, May 25, 2023 at 10:00:23AM -0700, Vishal Moola wrote: > > > On Thu, May 25, 2023 at 1:56 AM Mike Rapoport wrote: > > > > > > > > Hi, > > > > > > > > On Mon, May 01,

[PATCH v4 26/36] um: Implement the new page table range API

2023-03-14 Thread Matthew Wilcox (Oracle)
Add PFN_PTE_SHIFT and update_mmu_cache_range(). Signed-off-by: Matthew Wilcox (Oracle) Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Cc: linux-um@lists.infradead.org --- arch/um/include/asm/pgtable.h | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch

[PATCH v3 25/34] um: Implement the new page table range API

2023-02-28 Thread Matthew Wilcox (Oracle)
Add set_ptes() and update_mmu_cache_range(). Signed-off-by: Matthew Wilcox (Oracle) Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Cc: linux-um@lists.infradead.org --- arch/um/include/asm/pgtable.h | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git

[PATCH v2 24/30] um: Implement the new page table range API

2023-02-27 Thread Matthew Wilcox (Oracle)
Add set_ptes() and update_mmu_cache_range(). Signed-off-by: Matthew Wilcox (Oracle) Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Cc: linux-um@lists.infradead.org --- arch/um/include/asm/pgtable.h | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-26 Thread Matthew Wilcox
On Thu, Jan 26, 2023 at 04:50:59PM +0200, Mike Rapoport wrote: > On Thu, Jan 26, 2023 at 11:17:09AM +0200, Mike Rapoport wrote: > > On Wed, Jan 25, 2023 at 12:38:46AM -0800, Suren Baghdasaryan wrote: > > > +/* Use when VMA is not part of the VMA tree and needs no locking */ > > > +static inline voi

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Matthew Wilcox
On Wed, Jan 25, 2023 at 12:38:46AM -0800, Suren Baghdasaryan wrote: > +/* Use when VMA is not part of the VMA tree and needs no locking */ > +static inline void init_vm_flags(struct vm_area_struct *vma, > + unsigned long flags) > +{ > + vma->vm_flags = flags; vm_fl

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Matthew Wilcox
On Wed, Jan 25, 2023 at 08:49:50AM -0800, Suren Baghdasaryan wrote: > On Wed, Jan 25, 2023 at 1:10 AM Peter Zijlstra wrote: > > > + /* > > > + * Flags, see mm.h. > > > + * WARNING! Do not modify directly. > > > + * Use {init|reset|set|clear|mod}_vm_flags() functions instead. > >

Re: [PATCH] um: protect VMA iteration

2022-10-17 Thread Matthew Wilcox
On Mon, Oct 17, 2022 at 11:06:30AM +0200, Johannes Berg wrote: > From: Johannes Berg > > Looks like this is needed now, otherwise we get RCU > splats from lockdep. But I don't know anything about > this code ... You're getting lockdep splats now because there was no checking before. I assumed th

Re: [PATCH v8 00/31] Rust support

2022-08-02 Thread Matthew Wilcox
On Tue, Aug 02, 2022 at 03:45:50PM +0200, Miguel Ojeda wrote: > Hi Willy, > > On Tue, Aug 2, 2022 at 2:26 PM Matthew Wilcox wrote: > > > > None of this (afaict) has been discussed on linux-fsdevel. And I may > > have missed somethiing, but I don't see the fs modu

Re: [PATCH v8 00/31] Rust support

2022-08-02 Thread Matthew Wilcox
On Tue, Aug 02, 2022 at 03:49:47AM +0200, Miguel Ojeda wrote: > Some of the improvements to the abstractions and example drivers are: > > - Filesystem support (`fs` module), including: > > + `INode` type (which wraps `struct inode`). > + `DEntry` type (which wraps `struct dentry`).