Re: [RFC PATCH 1/2] mm/gup_test: Track long-term pins per open file
From: David Hildenbrand (Arm)
Date: Mon Sep 21 2026 - 06:59:17 EST
On 9/21/26 11:42, Richard Cheng wrote:
> Long-term pin state is currently global, allowing one gup_test file
> descriptor to block, stop, or release pins owned by another client.
>
> Allocate the pin state for each open file and store it in
> file->private_data. Serialize START, READ, and STOP with the per-open
> mutex, and release only the pages owned by that file.
>
> Descriptors duplicated through dup() or fork() continue sharing state
> because they reference the same struct file. Keep the ioctl ABI and
> same-file duplicate START behavior unchanged.
>
> Reviewed-by: Koba Ko <kobak@xxxxxxxxxx>
> Signed-off-by: Richard Cheng <icheng@xxxxxxxxxx>
commit 534b19bbb67717eea2272573bc0ff7ba4ba109c1
Author: David Hildenbrand (Arm) <david@xxxxxxxxxx>
Date: Mon Aug 10 13:31:14 2026 +0200
mm/gup_test: keep longterm pin state per file
The pin longterm test currently stores its data globally, shared among
multiple concurrent users of the interface (multiple open file descriptors
-> multiple "struct file"'s). That makes the gup_test interface
problematic to use concurrently: two users, such as concurrent selftest
runs, can interfere with the same longterm pin state.
While this has not been observed as a problem so far in practice, let's
just handle it cleanly. There could be a way to trigger selftest failures
by e.g., running the cow.c and gup_longerm.c selftests concurrently, but
we usually run them sequentially. Let's add a "Fixes" tag to be safe, but
not need to CC stable.
Which is already upstream.
--
Cheers,
David