linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Karol Wachowski <karol.wachowski@linux.intel.com>
To: yi.zhang@huawei.com, tytso@mit.edu
Cc: linux-ext4@vger.kernel.org, adilger.kernel@dilger.ca
Subject: Re: Possible regression in pin_user_pages_fast() behavior after commit 7ac67301e82f ("ext4: enable large folio for regular file")
Date: Fri, 17 Oct 2025 15:30:03 +0200	[thread overview]
Message-ID: <a5452767-40bf-4621-8bbd-b693224ce6fd@linux.intel.com> (raw)
In-Reply-To: <844e5cd4-462e-4b88-b3b5-816465a3b7e3@linux.intel.com>

Actually the threshold after which is starts to hang is 2 megabytes.

On 10/17/2025 3:24 PM, Karol Wachowski wrote:
> 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
>

  reply	other threads:[~2025-10-17 13:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=a5452767-40bf-4621-8bbd-b693224ce6fd@linux.intel.com \
    --to=karol.wachowski@linux.intel.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yi.zhang@huawei.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;
as well as URLs for NNTP newsgroup(s).