Re: [PATCH v4 13/13] mm/gup: Handle hugetlb in the generic follow_page_mask code

2024-04-02 Thread Matthew Wilcox
On Tue, Apr 02, 2024 at 05:26:28PM +0200, David Hildenbrand wrote: > > The oops trigger is at mm/gup.c:778: > > VM_BUG_ON_PAGE(!PageHead(page) && !is_zone_device_page(page), page); > > > > So 2M passed ok, and its failing for 32M, which is cont-pmd. I'm guessing > > you're trying to iterate 2M

Re: [PATCH v1 01/11] arm/pgtable: define PFN_PTE_SHIFT on arm and arm64

2024-01-23 Thread Matthew Wilcox
On Tue, Jan 23, 2024 at 10:34:21AM +, Ryan Roberts wrote: > > +#define PFN_PTE_SHIFT PAGE_SHIFT > > I think this is buggy. And so is the arm64 implementation of set_ptes(). It > works fine for 48-bit output address, but for 52-bit OAs, the high bits are > not > kept contigously,

Re: [PATCH RFC 06/12] mm/gup: Drop folio_fast_pin_allowed() in hugepd processing

2023-11-23 Thread Matthew Wilcox
On Wed, Nov 22, 2023 at 12:00:24AM -0800, Christoph Hellwig wrote: > > The other option is I can always add a comment above gup_huge_pd() > > explaining this special bit, so that when someone is adding hugepd support > > to file large folios we'll hopefully not forget it? But then that > >

Re: [PATCH v2] powerpc/mm: Avoid calling arch_enter/leave_lazy_mmu() in set_ptes

2023-10-27 Thread Matthew Wilcox
On Tue, Oct 24, 2023 at 08:06:04PM +0530, Aneesh Kumar K.V wrote: > ptep++; > - pte = __pte(pte_val(pte) + (1UL << PTE_RPN_SHIFT)); > addr += PAGE_SIZE; > + /* > + * increment the pfn. > + */ > + pte =

[PATCH 2/2] sparc: Allow nesting of lazy MMU mode

2023-10-12 Thread Matthew Wilcox (Oracle)
As noted in commit 49147beb0ccb ("x86/xen: allow nesting of same lazy mode"), we can now nest calls to arch_enter_lazy_mmu_mode(). Use ->active as a counter instead of a flag and only drain the batch when the counter hits 0. Signed-off-by: Matthew Wilcox (Oracle) Fixes: bcc6cc832

[PATCH 1/2] powerpc: Allow nesting of lazy MMU mode

2023-10-12 Thread Matthew Wilcox (Oracle)
As noted in commit 49147beb0ccb ("x86/xen: allow nesting of same lazy mode"), we can now nest calls to arch_enter_lazy_mmu_mode(). Use ->active as a counter instead of a flag and only drain the batch when the counter hits 0. Signed-off-by: Matthew Wilcox (Oracle) Fixes: bcc6cc832

[PATCH 0/2] Allow nesting of lazy MMU mode

2023-10-12 Thread Matthew Wilcox (Oracle)
blem that Erhard reported. Matthew Wilcox (Oracle) (2): powerpc: Allow nesting of lazy MMU mode sparc: Allow nesting of lazy MMU mode arch/powerpc/include/asm/book3s/64/tlbflush-hash.h | 5 ++--- arch/sparc/mm/tlb.c| 5 ++--- 2 files changed, 4 insertions(+

Re: [Bisected] PowerMac G5 fails booting kernel 6.6-rc3 (BUG: Unable to handle kernel data access at 0xfeffbb62ffec65fe)

2023-10-05 Thread Matthew Wilcox
On Fri, Oct 06, 2023 at 08:11:12AM +0700, Bagas Sanjaya wrote: > Matthew Wilcox, did you miss this regression report? You should look into it > since it is (apparently) cause by a commit of yours. No, I didn't miss it. I'm simply choosing to work on other things. All this regression tr

Re: [PATCH gmem FIXUP] mm, compaction: make testing mapping_unmovable() safe

2023-09-02 Thread Matthew Wilcox
On Fri, Sep 01, 2023 at 10:20:26AM +0200, Vlastimil Babka wrote: > As Kirill pointed out, mapping can be removed under us due to > truncation. Test it under folio lock as already done for the async > compaction / dirty folio case. To prevent locking every folio with > mapping to do the test, do it

Re: linux-next: build failure after merge of the mm tree

2023-08-22 Thread Matthew Wilcox
On Mon, Aug 21, 2023 at 09:00:43PM -0700, Darrick J. Wong wrote: > Please leave this ^^^ comment, because the need for TRACE_DEFINE_ENUM to > make enums work in tracepoints is not at all obvious. > > "order %u" to match the (non dev_t) style of the rest of the xfs > tracepoints. ACK, thanks.

Re: [PATCH mm-unstable] mm/khugepaged: fix collapse_pte_mapped_thp() versus uffd

2023-08-22 Thread Matthew Wilcox
On Tue, Aug 22, 2023 at 11:34:19AM -0700, Hugh Dickins wrote: > (Yes, the locking is a bit confusing: but mainly for the unrelated reason, > that with the split locking configs, we never quite know whether this lock > is the same as that lock or not, and so have to be rather careful.) Is it time

Re: [PATCH mm-unstable] mm/khugepaged: fix collapse_pte_mapped_thp() versus uffd

2023-08-22 Thread Matthew Wilcox
On Tue, Aug 22, 2023 at 04:39:43PM +0200, Jann Horn wrote: > > Perhaps something else will want that same behaviour in future (it's > > tempting, but difficult to guarantee correctness); for now, it is just > > userfaultfd (but by saying "_armed" rather than "_missing", I'm half- > > expecting

Re: linux-next: build failure after merge of the mm tree

2023-08-21 Thread Matthew Wilcox
On Tue, Aug 22, 2023 at 11:22:17AM +1000, Stephen Rothwell wrote: > Hi Matthew, > > On Tue, 22 Aug 2023 02:11:44 +0100 Matthew Wilcox wrote: > > > > On Tue, Aug 22, 2023 at 09:55:37AM +1000, Stephen Rothwell wrote: > > > In file included from i

Re: linux-next: build failure after merge of the mm tree

2023-08-21 Thread Matthew Wilcox
On Tue, Aug 22, 2023 at 09:55:37AM +1000, Stephen Rothwell wrote: > In file included from include/trace/trace_events.h:27, > from include/trace/define_trace.h:102, > from fs/xfs/xfs_trace.h:4428, > from fs/xfs/xfs_trace.c:45: >

Re: [PATCH v6 21/38] powerpc: Implement the new page table range API

2023-08-03 Thread Matthew Wilcox
On Thu, Aug 03, 2023 at 04:38:14PM -0700, Nathan Chancellor wrote: > > -EXPORT_SYMBOL(flush_dcache_icache_page); > > Apologies if this has already been fixed or reported, I searched lore > and did not find anything. The dropping of this export in combination > with the conversion above appears to

[PATCH v6 21/38] powerpc: Implement the new page table range API

2023-08-02 Thread Matthew Wilcox (Oracle)
Add set_ptes(), update_mmu_cache_range() and flush_dcache_folio(). Change the PG_arch_1 (aka PG_dcache_dirty) flag from being per-page to per-folio. Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Mike Rapoport (IBM) Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: linuxppc

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

Re: [RFC PATCH v11 10/29] mm: Add AS_UNMOVABLE to mark mapping as completely unmovable

2023-07-25 Thread Matthew Wilcox
On Tue, Jul 25, 2023 at 01:24:03PM +0300, Kirill A . Shutemov wrote: > On Tue, Jul 18, 2023 at 04:44:53PM -0700, Sean Christopherson wrote: > > diff --git a/mm/compaction.c b/mm/compaction.c > > index dbc9f86b1934..a3d2b132df52 100644 > > --- a/mm/compaction.c > > +++ b/mm/compaction.c > > @@

Re: [PATCH rfc -next 01/10] mm: add a generic VMA lock-based page fault handler

2023-07-13 Thread Matthew Wilcox
> +int try_vma_locked_page_fault(struct vm_locked_fault *vmlf, vm_fault_t *ret) > +{ > + struct vm_area_struct *vma; > + vm_fault_t fault; On Thu, Jul 13, 2023 at 05:53:29PM +0800, Kefeng Wang wrote: > +#define VM_LOCKED_FAULT_INIT(_name, _mm, _address, _fault_flags, _vm_flags, > _regs,

Re: [PATCH v3 2/5] fs: Add fchmodat4()

2023-07-11 Thread Matthew Wilcox
On Tue, Jul 11, 2023 at 01:25:43PM +0200, Alexey Gladkov wrote: > -static int do_fchmodat(int dfd, const char __user *filename, umode_t mode) > +static int do_fchmodat4(int dfd, const char __user *filename, umode_t mode, > int lookup_flags) This function can still be called do_fchmodat(); we

[PATCH v5 21/38] powerpc: Implement the new page table range API

2023-07-10 Thread Matthew Wilcox (Oracle)
Add set_ptes(), update_mmu_cache_range() and flush_dcache_folio(). Change the PG_arch_1 (aka PG_dcache_dirty) flag from being per-page to per-folio. Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Mike Rapoport (IBM) Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: linuxppc

Re: [PATCH v4 20/36] powerpc: Implement the new page table range API

2023-07-10 Thread Matthew Wilcox
On Sat, Mar 18, 2023 at 09:19:04AM +, Christophe Leroy wrote: > void set_ptes(struct mm_struct *mm, unsigned long addr, pte_t *ptep, > pte_t pte, unsigned int nr) > { > pgprot_t prot; > unsigned long pfn; > /* >* Make sure hardware valid bit is not set.

Re: [PATCH 1/2] mm: remove arguments of show_mem()

2023-06-29 Thread Matthew Wilcox
On Thu, Jun 29, 2023 at 06:43:56PM +0800, Kefeng Wang wrote: > Directly call __show_mem(0, NULL, MAX_NR_ZONES - 1) in show_mem() > to remove the arguments of show_mem(). Do you mean, "All callers of show_mem() pass 0 and NULL, so we can remove the two arguments"?

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

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 05/12] powerpc: add pte_free_defer() for pgtables sharing page

2023-05-29 Thread Matthew Wilcox
On Sun, May 28, 2023 at 11:20:21PM -0700, Hugh Dickins wrote: > +void pte_free_defer(struct mm_struct *mm, pgtable_t pgtable) > +{ > + struct page *page; > + > + page = virt_to_page(pgtable); > + call_rcu(>rcu_head, pte_free_now); > +} This can't be safe (on ppc). IIRC you might have

Re: [PATCH 02/12] mm/pgtable: add PAE safety to __pte_offset_map()

2023-05-29 Thread Matthew Wilcox
On Sun, May 28, 2023 at 11:16:16PM -0700, Hugh Dickins wrote: > +#if defined(CONFIG_GUP_GET_PXX_LOW_HIGH) && \ > + (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RCU)) > +/* > + * See the comment above ptep_get_lockless() in include/linux/pgtable.h: > + * the barriers in pmdp_get_lockless()

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

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

Re: [PATCH 00/23] arch: allow pte_offset_map[_lock]() to fail

2023-05-11 Thread Matthew Wilcox
On Wed, May 10, 2023 at 09:35:44PM -0700, Hugh Dickins wrote: > On Wed, 10 May 2023, Matthew Wilcox wrote: > > On Tue, May 09, 2023 at 09:39:13PM -0700, Hugh Dickins wrote: > > > Two: pte_offset_map() will need to do an rcu_read_lock(), with the > > > corresponding rcu

Re: [PATCH 01/23] arm: allow pte_offset_map[_lock]() to fail

2023-05-10 Thread Matthew Wilcox
On Tue, May 09, 2023 at 09:42:44PM -0700, Hugh Dickins wrote: > diff --git a/arch/arm/lib/uaccess_with_memcpy.c > b/arch/arm/lib/uaccess_with_memcpy.c > index e4c2677cc1e9..2f6163f05e93 100644 > --- a/arch/arm/lib/uaccess_with_memcpy.c > +++ b/arch/arm/lib/uaccess_with_memcpy.c > @@ -74,6 +74,9

Re: [PATCH 00/23] arch: allow pte_offset_map[_lock]() to fail

2023-05-10 Thread Matthew Wilcox
On Tue, May 09, 2023 at 09:39:13PM -0700, Hugh Dickins wrote: > Two: pte_offset_map() will need to do an rcu_read_lock(), with the > corresponding rcu_read_unlock() in pte_unmap(). But most architectures > never supported CONFIG_HIGHPTE, so some don't always call pte_unmap() > after

Re: [PATCH v3 26/35] mm: fall back to mmap_lock if vma->anon_vma is not yet set

2023-04-03 Thread Matthew Wilcox
On Fri, Feb 17, 2023 at 08:10:35AM -0800, Suren Baghdasaryan wrote: > On Fri, Feb 17, 2023 at 8:05 AM Matthew Wilcox wrote: > > > > On Thu, Feb 16, 2023 at 06:14:59PM -0800, Suren Baghdasaryan wrote: > > > On Thu, Feb 16, 2023 at 11:43 AM Suren Baghdasaryan > > &

Re: [PATCH v4 20/36] powerpc: Implement the new page table range API

2023-03-16 Thread Matthew Wilcox
On Wed, Mar 15, 2023 at 10:18:22AM +, Christophe Leroy wrote: > I investigated a bit further and can confirm now that the above won't > always work, see comment > https://elixir.bootlin.com/linux/v6.3-rc2/source/arch/powerpc/include/asm/nohash/32/pgtable.h#L147 > > And then you see >

[PATCH v4 20/36] powerpc: Implement the new page table range API

2023-03-14 Thread Matthew Wilcox (Oracle)
Add set_ptes(), update_mmu_cache_range() and flush_dcache_folio(). Change the PG_arch_1 (aka PG_dcache_dirty) flag from being per-page to per-folio. Signed-off-by: Matthew Wilcox (Oracle) Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: linuxppc-dev@lists.ozlabs.org --- arch

Re: [PATCH v5 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros

2023-02-28 Thread Matthew Wilcox
On Wed, Mar 01, 2023 at 04:38:10AM +, Edward Cree wrote: > On 01/03/2023 03:42, Baoquan He wrote: > > diff --git a/drivers/net/ethernet/sfc/io.h b/drivers/net/ethernet/sfc/io.h > > index 30439cc83a89..07f99ad14bf3 100644 > > --- a/drivers/net/ethernet/sfc/io.h > > +++

[PATCH v3 19/34] powerpc: Implement the new page table range API

2023-02-28 Thread Matthew Wilcox (Oracle)
Add set_ptes(), update_mmu_cache_range() and flush_dcache_folio(). Change the PG_arch_1 (aka PG_dcache_dirty) flag from being per-page to per-folio. Signed-off-by: Matthew Wilcox (Oracle) Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: linuxppc-dev@lists.ozlabs.org --- arch

Re: [PATCH v2 18/30] powerpc: Implement the new page table range API

2023-02-27 Thread Matthew Wilcox
On Mon, Feb 27, 2023 at 07:45:08PM +, Christophe Leroy wrote: > Hi, > > Le 27/02/2023 à 18:57, Matthew Wilcox (Oracle) a écrit : > > Add set_ptes(), update_mmu_cache_range() and flush_dcache_folio(). > > Change the PG_arch_1 (aka PG_dcache_dirty) flag from being per-

[PATCH v2 18/30] powerpc: Implement the new page table range API

2023-02-27 Thread Matthew Wilcox (Oracle)
of flush_dcache_icache_phys(). Please review. Signed-off-by: Matthew Wilcox (Oracle) Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: linuxppc-dev@lists.ozlabs.org --- arch/powerpc/include/asm/book3s/pgtable.h | 10 +-- arch/powerpc/include/asm/cacheflush.h | 14

Re: [PATCH v3 26/35] mm: fall back to mmap_lock if vma->anon_vma is not yet set

2023-02-17 Thread Matthew Wilcox
On Thu, Feb 16, 2023 at 06:14:59PM -0800, Suren Baghdasaryan wrote: > On Thu, Feb 16, 2023 at 11:43 AM Suren Baghdasaryan wrote: > > > > On Thu, Feb 16, 2023 at 7:44 AM Matthew Wilcox wrote: > > > > > > On Wed, Feb 15, 2023 at 09:17:41PM -0800, Suren Bag

Re: [PATCH v3 26/35] mm: fall back to mmap_lock if vma->anon_vma is not yet set

2023-02-16 Thread Matthew Wilcox
On Wed, Feb 15, 2023 at 09:17:41PM -0800, Suren Baghdasaryan wrote: > When vma->anon_vma is not set, page fault handler will set it by either > reusing anon_vma of an adjacent VMA if VMAs are compatible or by > allocating a new one. find_mergeable_anon_vma() walks VMA tree to find > a compatible

Re: API for setting multiple PTEs at once

2023-02-08 Thread Matthew Wilcox
On Wed, Feb 08, 2023 at 08:09:00PM +0800, Yin, Fengwei wrote: > > > On 2/8/2023 7:23 PM, Alexandre Ghiti wrote: > > Hi Matthew, > > > > On 2/7/23 21:27, Matthew Wilcox wrote: > >> On Thu, Feb 02, 2023 at 09:14:23PM +, Matthew Wilcox wrote: > >&g

Re: API for setting multiple PTEs at once

2023-02-07 Thread Matthew Wilcox
On Thu, Feb 02, 2023 at 09:14:23PM +, Matthew Wilcox wrote: > For those of you not subscribed, linux-mm is currently discussing > how best to handle page faults on large folios. I simply made it work > when adding large folio support. Now Yin Fengwei is working on > making

Re: [PATCH v2 00/33] Per-VMA locks

2023-01-27 Thread Matthew Wilcox
On Fri, Jan 27, 2023 at 02:51:38PM -0800, Andrew Morton wrote: > On Fri, 27 Jan 2023 11:40:37 -0800 Suren Baghdasaryan > wrote: > > > Per-vma locks idea that was discussed during SPF [1] discussion at LSF/MM > > last year [2], which concluded with suggestion that “a reader/writer > > semaphore

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

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 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;

Re: [PATCH 39/41] kernel/fork: throttle call_rcu() calls in vm_area_free

2023-01-23 Thread Matthew Wilcox
On Mon, Jan 23, 2023 at 08:18:37PM +0100, Michal Hocko wrote: > On Mon 23-01-23 18:23:08, Matthew Wilcox wrote: > > On Mon, Jan 23, 2023 at 09:46:20AM -0800, Suren Baghdasaryan wrote: > [...] > > > Yes, batching the vmas into a list and draining it in remove_mt() and >

Re: [PATCH 39/41] kernel/fork: throttle call_rcu() calls in vm_area_free

2023-01-23 Thread Matthew Wilcox
; > > > On Mon 23-01-23 08:22:53, Suren Baghdasaryan wrote: > > > > > On Mon, Jan 23, 2023 at 1:56 AM Michal Hocko wrote: > > > > > > > > > > > > On Fri 20-01-23 09:50:01, Suren Baghdasaryan wrote: > > > > > > > On Fri

Re: [PATCH 39/41] kernel/fork: throttle call_rcu() calls in vm_area_free

2023-01-20 Thread Matthew Wilcox
On Fri, Jan 20, 2023 at 09:17:46AM -0800, Suren Baghdasaryan wrote: > On Fri, Jan 20, 2023 at 9:08 AM Liam R. Howlett > wrote: > > > > * Matthew Wilcox [230120 11:50]: > > > On Fri, Jan 20, 2023 at 08:45:21AM -0800, Suren Baghdasaryan wrote: > > > >

Re: [PATCH 39/41] kernel/fork: throttle call_rcu() calls in vm_area_free

2023-01-20 Thread Matthew Wilcox
On Fri, Jan 20, 2023 at 08:45:21AM -0800, Suren Baghdasaryan wrote: > On Fri, Jan 20, 2023 at 8:20 AM Suren Baghdasaryan wrote: > > > > On Fri, Jan 20, 2023 at 12:52 AM Michal Hocko wrote: > > > > > > On Thu 19-01-23 10:52:03, Suren Baghdasaryan wrote: > > > > On Thu, Jan 19, 2023 at 4:59 AM

Re: [PATCH 28/41] mm: introduce lock_vma_under_rcu to be used from arch-specific code

2023-01-17 Thread Matthew Wilcox
On Tue, Jan 17, 2023 at 05:06:57PM -0800, Suren Baghdasaryan wrote: > On Tue, Jan 17, 2023 at 7:47 AM Michal Hocko wrote: > > > > On Mon 09-01-23 12:53:23, Suren Baghdasaryan wrote: > > > Introduce lock_vma_under_rcu function to lookup and lock a VMA during > > > page fault handling. When VMA is

Re: [PATCH 12/41] mm: add per-VMA lock and helper functions to control it

2023-01-17 Thread Matthew Wilcox
On Tue, Jan 17, 2023 at 02:36:47PM -0800, Suren Baghdasaryan wrote: > On Tue, Jan 17, 2023 at 1:46 PM Jann Horn wrote: > > On Tue, Jan 17, 2023 at 10:28 PM Suren Baghdasaryan > > wrote: > > > On Tue, Jan 17, 2023 at 10:03 AM Jann Horn wrote: > > > > One thing that might be gnarly here is that

Re: [PATCH 12/41] mm: add per-VMA lock and helper functions to control it

2023-01-17 Thread Matthew Wilcox
On Tue, Jan 17, 2023 at 01:21:47PM -0800, Suren Baghdasaryan wrote: > On Tue, Jan 17, 2023 at 7:12 AM Michal Hocko wrote: > > > > On Tue 17-01-23 16:04:26, Michal Hocko wrote: > > > On Mon 09-01-23 12:53:07, Suren Baghdasaryan wrote: > > > > Introduce a per-VMA rw_semaphore to be used during page

Re: [PATCH 41/41] mm: replace rw_semaphore with atomic_t in vma_lock

2023-01-17 Thread Matthew Wilcox
On Tue, Jan 17, 2023 at 10:36:42AM -0800, Suren Baghdasaryan wrote: > On Tue, Jan 17, 2023 at 10:31 AM Matthew Wilcox wrote: > > > > On Tue, Jan 17, 2023 at 10:26:32AM -0800, Suren Baghdasaryan wrote: > > > On Tue, Jan 17, 2023 at 10:12 AM Jann Horn wrote: > > &

Re: [PATCH 41/41] mm: replace rw_semaphore with atomic_t in vma_lock

2023-01-17 Thread Matthew Wilcox
On Tue, Jan 17, 2023 at 10:26:32AM -0800, Suren Baghdasaryan wrote: > On Tue, Jan 17, 2023 at 10:12 AM Jann Horn wrote: > > > > On Mon, Jan 9, 2023 at 9:55 PM Suren Baghdasaryan wrote: > > > rw_semaphore is a sizable structure of 40 bytes and consumes > > > considerable space for each

Re: [PATCH 41/41] mm: replace rw_semaphore with atomic_t in vma_lock

2023-01-17 Thread Matthew Wilcox
On Mon, Jan 16, 2023 at 09:58:35PM -0800, Suren Baghdasaryan wrote: > On Mon, Jan 16, 2023 at 9:46 PM Matthew Wilcox wrote: > > > > On Mon, Jan 16, 2023 at 08:34:36PM -0800, Suren Baghdasaryan wrote: > > > On Mon, Jan 16, 2023 at 8:14 PM Matthew Wilcox > > > w

Re: [PATCH 41/41] mm: replace rw_semaphore with atomic_t in vma_lock

2023-01-16 Thread Matthew Wilcox
On Mon, Jan 16, 2023 at 08:34:36PM -0800, Suren Baghdasaryan wrote: > On Mon, Jan 16, 2023 at 8:14 PM Matthew Wilcox wrote: > > > > On Mon, Jan 16, 2023 at 11:14:38AM +, Hyeonggon Yoo wrote: > > > > @@ -643,20 +647,28 @@ static inline void vma_write_lock(struct

Re: [PATCH 41/41] mm: replace rw_semaphore with atomic_t in vma_lock

2023-01-16 Thread Matthew Wilcox
On Mon, Jan 16, 2023 at 11:14:38AM +, Hyeonggon Yoo wrote: > > @@ -643,20 +647,28 @@ static inline void vma_write_lock(struct > > vm_area_struct *vma) > > static inline bool vma_read_trylock(struct vm_area_struct *vma) > > { > > /* Check before locking. A race might cause false locked

Re: Memory transaction instructions

2023-01-16 Thread Matthew Wilcox
On Mon, Jan 16, 2023 at 02:08:15PM +, David Howells wrote: > Hi Linus, > > I'm not sure how relevant it is to the topic, but I seem to remember you > having a go at implementing spinlocks with x86_64 memory transaction > instructions a while back. Do you have any thoughts on whether these >

Re: ia64 removal (was: Re: lockref scalability on x86-64 vs cpu_relax)

2023-01-16 Thread Matthew Wilcox
On Mon, Jan 16, 2023 at 10:41:14AM +0100, John Paul Adrian Glaubitz wrote: > On 1/15/23 01:27, Matthew Wilcox wrote: > > More useful perhaps is to look at https://popcon.debian.org/ > > > > There are three machines reporting popcon results. It's dead. > > It's an op

Re: ia64 removal (was: Re: lockref scalability on x86-64 vs cpu_relax)

2023-01-14 Thread Matthew Wilcox
On Sat, Jan 14, 2023 at 12:28:30PM +0100, Sedat Dilek wrote: > [ ... ] > > > Best is to ask the Debian release-team or (if there exist) maintainers > > or responsibles for the IA64 port - which is an ***unofficial*** port. > > > > Here we go: > > https://lists.debian.org/debian-ia64/ > >

Re: [Bug report] BUG: Kernel NULL pointer dereference at 0x00000069, filemap_release_folio+0x88/0xb0

2022-09-30 Thread Matthew Wilcox
On Fri, Sep 30, 2022 at 12:01:26PM +1000, Michael Ellerman wrote: > Matthew Wilcox writes: > >> [ 4681.238745] Instruction dump: > >> [ 4681.238749] fbc1fff0 f821ffc1 7c7d1b78 7c9c2378 ebc30028 7fdff378 > >> 4818 6000 > >> [ 4681.238765] 60

Re: [Bug report] BUG: Kernel NULL pointer dereference at 0x00000069, filemap_release_folio+0x88/0xb0

2022-09-29 Thread Matthew Wilcox
On Tue, Sep 27, 2022 at 09:17:20AM +0800, Zorro Lang wrote: > Hi mm and ppc list, > > Recently I started to hit a kernel panic [2] rarely on *ppc64le* with *1k > blocksize* ext4. It's not easy to reproduce, but still has chance to trigger > by loop running generic/048 on ppc64le (not sure all

Re: [RFC PATCH] fs/hugetlb: Fix UBSAN warning reported on hugetlb

2022-09-08 Thread Matthew Wilcox
On Thu, Sep 08, 2022 at 12:56:59PM +0530, Aneesh Kumar K.V wrote: > +++ b/fs/dax.c > @@ -1304,7 +1304,7 @@ EXPORT_SYMBOL_GPL(dax_zero_range); > int dax_truncate_page(struct inode *inode, loff_t pos, bool *did_zero, > const struct iomap_ops *ops) > { > - unsigned int blocksize =

[PATCH v5 25/32] powerpc: Convert to printbuf

2022-08-07 Thread Matthew Wilcox (Oracle)
From: Kent Overstreet This converts from seq_buf to printbuf. We're using printbuf in external buffer mode, so it's a direct conversion, aside from some trivial refactoring in cpu_show_meltdown() to make the code more consistent. Signed-off-by: Kent Overstreet Cc: linuxppc-dev@lists.ozlabs.org

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 module in

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`).

Re: [PATCH v6 00/23] Rust support

2022-05-08 Thread Matthew Wilcox
On Sat, May 07, 2022 at 01:06:18AM -0700, Kees Cook wrote: > On Sat, May 07, 2022 at 07:23:58AM +0200, Miguel Ojeda wrote: > > ## Patch series status > > > > The Rust support is still to be considered experimental. However, > > support is good enough that kernel developers can start working on

Re: [PATCH 2/6] treewide: remove using list iterator after loop body as a ptr

2022-03-01 Thread Matthew Wilcox
a look at the rest of cleaning this up soon. >From 28ffe35d56223d4242b915832299e5acc926737e Mon Sep 17 00:00:00 2001 From: "Matthew Wilcox (Oracle)" Date: Tue, 1 Mar 2022 13:47:07 -0500 Subject: [PATCH] wait: Parameterize the return variable to ___wait_event() Macros should not refer

Re: [PATCH 2/6] treewide: remove using list iterator after loop body as a ptr

2022-02-28 Thread Matthew Wilcox
On Mon, Feb 28, 2022 at 12:37:15PM -0800, Linus Torvalds wrote: > On Mon, Feb 28, 2022 at 12:16 PM Matthew Wilcox wrote: > > > > Then we can never use -Wshadow ;-( I'd love to be able to turn it on; > > it catches real bugs. > > Oh, we already can never use -Wshado

Re: [PATCH 2/6] treewide: remove using list iterator after loop body as a ptr

2022-02-28 Thread Matthew Wilcox
On Mon, Feb 28, 2022 at 12:10:24PM -0800, Linus Torvalds wrote: > We can do > > typeof(pos) pos > > in the 'for ()' loop, and never use __iter at all. > > That means that inside the for-loop, we use a _different_ 'pos' than outside. Then we can never use -Wshadow ;-( I'd love to be

Re: [next-20220215] WARNING at fs/iomap/buffered-io.c:75 with xfstests

2022-02-16 Thread Matthew Wilcox
On Wed, Feb 16, 2022 at 09:35:04AM -0800, Darrick J. Wong wrote: > On Wed, Feb 16, 2022 at 12:55:02PM +0530, Sachin Sant wrote: > > [ 2547.662818] [ cut here ] > > [ 2547.662832] WARNING: CPU: 24 PID: 2463718 at fs/iomap/buffered-io.c:75 > > iomap_page_release+0x1b0/0x1e0

Re: BUG: sleeping function called from invalid context at include/linux/sched/mm.h:256

2022-02-12 Thread Matthew Wilcox
On Sun, Feb 13, 2022 at 11:19:09AM +0800, Zhouyi Zhou wrote: > I think the key to the problem lies in your attached console.log > (pasted below), at times 0.014987 and 0.015995, I see there are two > locks (cpu_hotplug_lock and jump_label_mutex) holded while > kmem_cache_alloc calls

Re: [PATCH v2 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior

2022-01-19 Thread Matthew Wilcox
On Wed, Jan 19, 2022 at 09:44:20PM +0800, Kefeng Wang wrote: > > On 2022/1/19 21:22, Matthew Wilcox wrote: > > On Wed, Jan 19, 2022 at 08:57:58PM +0800, Kefeng Wang wrote: > > > Only parts of our products wants this feature,  we add some interfaces > > > which

Re: [PATCH v2 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior

2022-01-19 Thread Matthew Wilcox
On Wed, Jan 19, 2022 at 08:57:58PM +0800, Kefeng Wang wrote: > Only parts of our products wants this feature,  we add some interfaces which > only > > alloc hugevmalloc for them, eg, > vmap_hugepage/vmalloc_hugepage/remap_vmalloc_hugepage_range.. > > for our products, but it's not the choice of

Re: [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior

2021-12-26 Thread Matthew Wilcox
On Mon, Dec 27, 2021 at 09:44:24AM +0800, Kefeng Wang wrote: > > On 2021/12/27 1:36, Christophe Leroy wrote: > > > > Le 26/12/2021 à 09:39, Kefeng Wang a écrit : > > > Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or > > > not enable huge vmalloc mappings by default, and this

Re: [PATCH v2 0/2] kdump: simplify code

2021-12-14 Thread Matthew Wilcox
On Tue, Dec 14, 2021 at 06:03:11PM +0800, Tiezhu Yang wrote: > On 12/13/2021 10:43 PM, Matthew Wilcox wrote: > > On Mon, Dec 13, 2021 at 08:30:33AM +, David Laight wrote: > > > From: Matthew Wilcox > > > > Sent: 12 December 2021 11:48 > > > > > &

Re: [PATCH v2 0/2] kdump: simplify code

2021-12-13 Thread Matthew Wilcox
On Mon, Dec 13, 2021 at 08:30:33AM +, David Laight wrote: > From: Matthew Wilcox > > Sent: 12 December 2021 11:48 > > > > On Sat, Dec 11, 2021 at 05:53:46PM +, David Laight wrote: > > > From: Tiezhu Yang > > > > Sent: 11 December 2021

Re: [PATCH v2 0/2] kdump: simplify code

2021-12-12 Thread Matthew Wilcox
On Sat, Dec 11, 2021 at 05:53:46PM +, David Laight wrote: > From: Tiezhu Yang > > Sent: 11 December 2021 03:33 > > > > v2: > > -- add copy_to_user_or_kernel() in lib/usercopy.c > > -- define userbuf as bool type > > Instead of having a flag to indicate whether the buffer is user or

Re: [PATCH 5/6] mm/mremap: Use pmd/pud_poplulate to update page table entries

2021-06-13 Thread Matthew Wilcox
On Sun, Jun 13, 2021 at 02:36:13PM +0530, Aneesh Kumar K.V wrote: > IIUC the reason why we do have pmd_pgtable() is that pgtable_t type > is arch dependent. On some architecture it is pte_t * and on the other > struct page *. The reason being highmem and level 4 page table can > be located in

Re: [RFC PATCH 0/7] Memory hotplug/hotremove at subsection size

2021-05-06 Thread Matthew Wilcox
On Thu, May 06, 2021 at 09:10:52PM +0200, David Hildenbrand wrote: > I have to admit that I am not really a friend of that. I still think our > target goal should be to have gigantic THP *in addition to* ordinary THP. > Use gigantic THP where enabled and possible, and just use ordinary THP >

Re: [PATCH] Raise the minimum GCC version to 5.2

2021-05-02 Thread Matthew Wilcox
On Sun, May 02, 2021 at 02:08:31PM -0700, Linus Torvalds wrote: > What is relevant is what version of gcc various distributions actually > have reasonably easily available, and how old and relevant the > distributions are. We did decide that (just as an example) RHEL 7 was > too old to worry about

Re: [PATCH 1/2] mm: Fix struct page layout on 32-bit systems

2021-04-20 Thread Matthew Wilcox
On Tue, Apr 20, 2021 at 09:39:54AM +0200, Geert Uytterhoeven wrote: > > +++ b/include/linux/mm_types.h > > @@ -97,10 +97,10 @@ struct page { > > }; > > struct {/* page_pool used by netstack */ > > /** > > -*

Re: [PATCH 1/2] mm: Fix struct page layout on 32-bit systems

2021-04-19 Thread Matthew Wilcox
On Tue, Apr 20, 2021 at 02:48:17AM +, Vineet Gupta wrote: > > 32-bit architectures which expect 8-byte alignment for 8-byte integers > > and need 64-bit DMA addresses (arc, arm, mips, ppc) had their struct > > page inadvertently expanded in 2019. > > FWIW, ARC doesn't require 8 byte alignment

Re: [PATCH 1/2] mm: Fix struct page layout on 32-bit systems

2021-04-17 Thread Matthew Wilcox
On Sat, Apr 17, 2021 at 09:18:57PM +, David Laight wrote: > Ugly as well. Thank you for expressing your opinion. Again.

Re: [PATCH 2/2] mm: Indicate pfmemalloc pages in compound_head

2021-04-17 Thread Matthew Wilcox
On Sat, Apr 17, 2021 at 09:13:45PM +, David Laight wrote: > > struct {/* page_pool used by netstack */ > > - /** > > -* @dma_addr: might require a 64-bit value on > > -* 32-bit architectures. > > -

Re: [PATCH 1/2] mm: Fix struct page layout on 32-bit systems

2021-04-17 Thread Matthew Wilcox
On Sat, Apr 17, 2021 at 09:32:06PM +0300, Ilias Apalodimas wrote: > > +static inline void page_pool_set_dma_addr(struct page *page, dma_addr_t > > addr) > > +{ > > + page->dma_addr[0] = addr; > > + if (sizeof(dma_addr_t) > sizeof(unsigned long)) > > + page->dma_addr[1] = addr >> 16

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-17 Thread Matthew Wilcox
On Sat, Apr 17, 2021 at 12:31:37PM +0200, Arnd Bergmann wrote: > On Fri, Apr 16, 2021 at 5:27 PM Matthew Wilcox wrote: > > diff --git a/include/net/page_pool.h b/include/net/page_pool.h > > index b5b195305346..db7c7020746a 100644 > > --- a/include/net/page_pool.h > > ++

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-16 Thread Matthew Wilcox
On Fri, Apr 16, 2021 at 07:08:23PM +0200, Jesper Dangaard Brouer wrote: > On Fri, 16 Apr 2021 16:27:55 +0100 > Matthew Wilcox wrote: > > > On Thu, Apr 15, 2021 at 08:08:32PM +0200, Jesper Dangaard Brouer wrote: > > > See below patch. Where I swap32 the dma addre

Re: [PATCH 1/2] mm: Fix struct page layout on 32-bit systems

2021-04-16 Thread Matthew Wilcox
Replacement patch to fix compiler warning. From: "Matthew Wilcox (Oracle)" Date: Fri, 16 Apr 2021 16:34:55 -0400 Subject: [PATCH 1/2] mm: Fix struct page layout on 32-bit systems To: bro...@redhat.com Cc: linux-ker...@vger.kernel.org, linux...@kvack.org, net...@vger.

[PATCH 2/2] mm: Indicate pfmemalloc pages in compound_head

2021-04-16 Thread Matthew Wilcox (Oracle)
loc(). Since page_pool doesn't want to set its magic value on pages which are pfmemalloc, we can use bit 1 of compound_head to indicate that the page came from the memory reserves. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mm.h | 12 +++- include/linux/mm_types.h |

[PATCH 1/2] mm: Fix struct page layout on 32-bit systems

2021-04-16 Thread Matthew Wilcox (Oracle)
get_user_pages_fast() could dereference a bogus compound_head(). Fixes: c25fff7171be ("mm: add dma_addr_t to struct page") Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mm_types.h | 4 ++-- include/net/page_pool.h | 12 +++- net/core/page_pool.c | 12 +++

[PATCH 0/2] Change struct page layout for page_pool

2021-04-16 Thread Matthew Wilcox (Oracle)
functionality. It is much less urgent. I'd really like to see Mel & Michal's thoughts on it. I have only compile-tested these patches. Matthew Wilcox (Oracle) (2): mm: Fix struct page layout on 32-bit systems mm: Indicate pfmemalloc pages in compound_head include/linux/mm.h

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-16 Thread Matthew Wilcox
On Thu, Apr 15, 2021 at 08:08:32PM +0200, Jesper Dangaard Brouer wrote: > See below patch. Where I swap32 the dma address to satisfy > page->compound having bit zero cleared. (It is the simplest fix I could > come up with). I think this is slightly simpler, and as a bonus code that assumes the

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-16 Thread Matthew Wilcox
On Fri, Apr 16, 2021 at 07:32:35AM +, David Laight wrote: > From: Matthew Wilcox > > Sent: 15 April 2021 23:22 > > > > On Thu, Apr 15, 2021 at 09:11:56PM +, David Laight wrote: > > > Isn't it possible to move the field down one long? > > &

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-15 Thread Matthew Wilcox
On Thu, Apr 15, 2021 at 09:11:56PM +, David Laight wrote: > Isn't it possible to move the field down one long? > This might require an explicit zero - but this is not a common > code path - the extra write will be noise. Then it overlaps page->mapping. See emails passim.

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-15 Thread Matthew Wilcox
On Thu, Apr 15, 2021 at 08:08:32PM +0200, Jesper Dangaard Brouer wrote: > +static inline > +dma_addr_t page_pool_dma_addr_read(dma_addr_t dma_addr) > +{ > + /* Workaround for storing 64-bit DMA-addr on 32-bit machines in struct > + * page. The page->dma_addr share area with

Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

2021-04-14 Thread Matthew Wilcox
On Wed, Apr 14, 2021 at 09:13:22PM +0200, Jesper Dangaard Brouer wrote: > (If others want to reproduce). First I could not reproduce on ARM32. > Then I found out that enabling CONFIG_XEN on ARCH=arm was needed to > cause the issue by enabling CONFIG_ARCH_DMA_ADDR_T_64BIT. hmmm ... you should be

  1   2   3   >