public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* Possible regression in pin_user_pages_fast() behavior after commit 7ac67301e82f ("ext4: enable large folio for regular file")
@ 2025-10-17 13:24 Karol Wachowski
  2025-10-17 13:30 ` Karol Wachowski
  0 siblings, 1 reply; 9+ messages in thread
From: Karol Wachowski @ 2025-10-17 13:24 UTC (permalink / raw)
  To: yi.zhang, tytso; +Cc: linux-ext4, adilger.kernel

Hi,

I’m not entirely sure if this is right way to report this.

I’ve encountered what appears to be a regression (or at least a
behavioral change) related to pin_user_pages_fast() when used with
FOLL_LONGTERM on a Copy-on-Write (CoW) mapping (i.e. VM_MAYWRITE without
VM_SHARED). Specifically, the call never finishes when the requested
size exceeds 8 MB.

The same scenario works correctly prior to the following change:
commit 7ac67301e82f02b77a5c8e7377a1f414ef108b84
Author: Zhang Yi <yi.zhang@huawei.com>
Date:   Mon May 12 14:33:19 2025 +0800

    ext4: enable large folio for regular file

It seems the issue manifests when pin_user_pages_fast() falls back to
_gup_longterm_locked(). In that case, we end up calling
handle_mm_fault() with FAULT_FLAG_UNSHARE, which splits the PMD. 
From ftrace, it looks like the kernel enters an apparent infinite loop
of handle_mm_fault() which in turn invokes filemap_map_pages() from the
ext4 ops.

  1)   1.553 us    |      handle_mm_fault();
  1)   0.126 us    |      __cond_resched();
  1)   0.055 us    |      vma_pgtable_walk_begin();
  1)   0.057 us    |      _raw_spin_lock();
  1)   0.111 us    |      _raw_spin_unlock();
  1)   0.050 us    |      vma_pgtable_walk_end();
  1)   1.521 us    |      handle_mm_fault();
  1)   0.122 us    |      __cond_resched();
  1)   0.055 us    |      vma_pgtable_walk_begin();
  1)   0.288 us    |      _raw_spin_lock();
  1)   0.053 us    |      _raw_spin_unlock();
  1)   0.048 us    |      vma_pgtable_walk_end();
  1)   1.484 us    |      handle_mm_fault();
  1)   0.124 us    |      __cond_resched();
  1)   0.056 us    |      vma_pgtable_walk_begin();
  1)   0.272 us    |      _raw_spin_lock();
  1)   0.051 us    |      _raw_spin_unlock();
  1)   0.050 us    |      vma_pgtable_walk_end();
  1)   1.566 us    |      handle_mm_fault();
  1)   0.211 us    |      __cond_resched();
  1)   0.107 us    |      vma_pgtable_walk_begin();
  1)   0.054 us    |      _raw_spin_lock();
  1)   0.052 us    |      _raw_spin_unlock();
  1)   0.049 us    |      vma_pgtable_walk_end();

I haven’t been able to gather more detailed diagnostics yet, but I’d
appreciate any guidance on whether this is a known issue, or if
additional debugging information would be helpful.

-
Karol


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-10-23  7:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-17 13:24 Possible regression in pin_user_pages_fast() behavior after commit 7ac67301e82f ("ext4: enable large folio for regular file") Karol Wachowski
2025-10-17 13:30 ` Karol Wachowski
2025-10-20  7:11   ` Zhang Yi
2025-10-20  8:47     ` Karol Wachowski
2025-10-22  2:46       ` Zhang Yi
2025-10-22  8:30         ` David Hildenbrand
2025-10-23  3:04           ` Zhang Yi
2025-10-23  7:24             ` David Hildenbrand
2025-10-23  7:34               ` Zhang Yi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox