Skip to content

drm/asahi: keep GEM_USERPTR pins within the user's RLIMIT_MEMLOCK across fork and exit - #2777

Closed
funkzy wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
funkzy:pr/asahi-userptr-user-limit
Closed

funkzy wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
funkzy:pr/asahi-userptr-user-limit

Conversation

@funkzy

@funkzy funkzy commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Change of approach

The earlier version charged the pins with the driver's own copy of the user_struct::locked_vm charge loop and added
the driver to the condition in <linux/sched/user.h>, described as following io_uring and iommufd. That loop is a
sixth copy: io_uring, iommufd, secretmem, the network zerocopy path and XDP umem each carry one, and each user adds
its option to that condition, because the kernel has no shared helper for this count. This version keeps the code
and labels it a narrow fix, here and in the commit message, and names the shared helper as a follow-up for the
owners of that code (under Still to run).

Problem

GEM_USERPTR counts the pages it pins in the calling mm's pinned_vm and compares that count with RLIMIT_MEMLOCK.
The object belongs to the DRM file, not to the mm. A forked child starts with nothing counted, its pins land in the
file it shares with its parent, and they stay pinned after it exits, counted against an mm that no longer runs
anything. So the limit doesn't bound what one user can pin.

Why this shape

The limit was checked in one place, UserPages::pin(), against a count that belongs to an mm, while the pinned
object belongs to the DRM file and can outlive the process that made it. The per-mm count (mm->pinned_vm, as RDMA
umem and amdxdna use it) has that property wherever the pinned object outlives the process; counting per DRM file
instead would still give each file of the user its own full limit. The change uses the count the kernel already keeps
for pins owned by a file rather than a process: user_struct::locked_vm, which io_uring (__io_account_mem()) and
iommufd charge the same way. Every process of the user then draws on one limit, a pin is charged until its object is
freed, and a CAP_IPC_LOCK caller is not charged at all, as in both. The mm's pinned_vm still counts the pages for
/proc. Only the G17 backend creates user-memory objects, so this is the only place they are charged.

The charge itself is narrow. The structural fix is one charge and uncharge helper for user_struct::locked_vm, used
by all six, with a Kconfig symbol its users select in place of the growing condition in <linux/sched/user.h>. It
changes code owned by mm, io_uring, iommufd and networking, so it is a follow-up for those owners rather than part of
this PR. The copy here keeps their arithmetic, adding only an overflow check, so such a helper can replace it.

Change

  • asahi_user_account() and asahi_user_unaccount() in user_pages.c, beside the driver's other pin helpers: the
    same arithmetic as __io_account_mem() plus an overflow check, with iommufd's underflow warning on release (a
    narrow copy, above). UserPages holds the charged user with a reference until it is dropped.
  • <linux/sched/user.h>: the driver is added to the condition for user_struct::locked_vm, as iommufd and
    secretmem were (the Kconfig symbol above would replace that condition).
  • The UAPI comment for DRM_IOCTL_ASAHI_GEM_USERPTR says what is counted.
  • A process with a smaller page size (the fragment pins of CONFIG_MM_SUBPAGE, drm/asahi: GEM_USERPTR in processes with a smaller page size #2226) is charged the same native
    pages.
  • For applications: Borealis's VK_EXT_external_memory_host imports are the userspace that creates these objects.
    They now share one RLIMIT_MEMLOCK across all of the user's processes, where each process had its own before. Under
    systemd's default (8 MiB for a user session) the sum of a user's host imports is what is limited; an import past
    it fails with VK_ERROR_OUT_OF_DEVICE_MEMORY, as one that took a single process past its own limit did before.
    The Gallium driver doesn't create these objects, and under virtio (agx_has_userptr()) they aren't used.

Testing

  • KUnit, new case pins_count_against_the_user in asahi_gem_user_memory. A caller with CAP_IPC_LOCK is not
    charged, while its mm still counts the pages. With CAP_IPC_LOCK dropped and RLIMIT_MEMLOCK set just above what the
    test's user holds, pins within the limit are charged and given back. Once pages are charged to the user as another
    of its processes would charge them, the next pin is refused, although the test's own mm has none. The case and its
    helpers are built only with built-in KUnit and a built-in driver, where the suite runs before userspace and nothing
    else charges the test's user; it is reported as skipped otherwise. Its checks are error returns, so it undoes its
    changes before its one assertion. On integration/aurora cacf355 plus this change only, 375 of 377 cases pass
    in 76 suites and 2 skip, as on integration alone, where the removed memlock_limit_policy case runs instead.
  • J775D (Mac Studio, M5 Ultra), this PR's own base: kit asahi-userptr-user-limit-1 (integration/aurora
    000ab96 plus arm64: dts: apple: t6050-j775d: Give the Mac Studio (M5 Ultra) a working GPU, and its M and P core capacities (754/1024) to the scheduler #1973, the J775D GPU node, without which the J775D has no GPU and so no GEM_USERPTR, plus this
    change at 1121847) against kit asahi-userptr-user-limit-1b (the same base and arm64: dts: apple: t6050-j775d: Give the Mac Studio (M5 Ultra) a working GPU, and its M and P core capacities (754/1024) to the scheduler #1973 alone), window
    ryan2775d@20261122-1247. One boot each through the 27.0 firmware and Aura main dff1235d, default kernel command
    line, read-only root. Both come up with the GPU's render node.
    • One unprivileged user (no CAP_IPC_LOCK) at RLIMIT_MEMLOCK 16 MiB: 8 forked children each pin 8 MiB through
      GEM_USERPTR into the DRM file they share, and exit. With this change 2 pin and 6 are refused with ENOMEM, so the
      user holds 16 MiB; without it all 8 pin, 64 MiB. Once the file is closed a new pin succeeds on both, so the
      charge is given back.
    • Failed units: 2 on both, the same two. iwd fails because integration's defconfig lacks the kernel crypto
      options it needs, and systemd-networkd-persistent-storage because the test boots mount the root read-only.
    • Kernel errors at err level and above: the same 7 lines on both (two from a DCP, one from the KVM's USB
      receiver, four refusals of a cpufreq boost request). The boot with this change also has a USB descriptor-read
      timeout from the KVM, which a boot of integration alone in the same session also has. No WARNING, BUG or Oops.
      ALARM has no SELinux, so there is no AVC count.
  • Extra row, not this PR's own: kit trackh-g10 (the posted version of this change, 464023d, whose amendment
    changes only its KUnit case) against kit trackh-gb (without it), on integration/aurora cacf355 plus what
    the J775D's GPU needs under the 27.2 firmware: drm/asahi: t6050: identify the K114/K116 27.2 (26B8125) G17S firmware (on #1173) #1650 (its M5 InitData), arm64: dts: apple: t6050-j775d: Give the Mac Studio (M5 Ultra) a working GPU, and its M and P core capacities (754/1024) to the scheduler #1973, and two commits of ours not yet
    posted, "drm/asahi: t6050: Run the Mac Studio's (M5 Ultra) GPU under the 27.2 boot stub: admit its 26B123 G17D
    firmware" and "drm/asahi: t6050: Give the M5 Ultra's 27.2 firmware the power-controller status config of its own
    26B123 layout". One boot each through the 27.2 firmware with our daily Aura build, read-only root.
    • Userspace at the default limit (8 MiB, systemd's DefaultLimitMEMLOCK, which every process of the desktop
      session has), with a Borealis build that advertises VK_EXT_external_memory_host:
      dEQP-VK.memory.external_memory_host.* passes 4 and reports 8 not supported (image formats) of 12, 0 failed,
      with and without this change. Among the installed applications, FFmpeg's Vulkan upload doesn't import host
      memory (no pinned pages while it runs), and the desktop session holds no pinned pages on either kernel. No
      installed workload was found that imports host memory, so none is affected.
    • Both kernels bring up the same co-processors and the desktop on the GPU, with the same 2 failed units and no new
      kernel error at err level and above.
  • No-regression check of the fragment-pin path of a 4K process (CONFIG_MM_SUBPAGE, which the J775D kits have; off
    at run time without user4k=on), also extra evidence, not this PR's own: on the extra row's 27.2 base
    (integration/aurora cacf355 plus the same four), kit
    ryan2777row (with this change at 4540607a7b4d, the same patch as this head) against kit trackh-gb, booted with
    user4k=on, running tools/testing/selftests/arm64/user4k/gem-userptr. The selftest's results don't depend on
    whether the pins are charged to the mm or to the user, so both arms are expected to match. On both it passes 3 of
    3, as root and as an unprivileged user at the default 8 MiB limit. Native pages mapped whole and in order pin
    32 KiB and give it back on close, and the two mixed-page layouts get EFAULT with nothing pinned. With
    RLIMIT_MEMLOCK at 16 KiB all three are refused with ENOMEM before any page is pinned. The same 2 failed units and
    the same err-level lines on both, no WARNING, BUG or Oops.
  • Builds: on integration/aurora cacf355, with integration's own config (defconfig plus asahi.config), and as the J775D kernel; no
    warning in the files this change touches. Also with CONFIG_KUNIT=m, and with CONFIG_KUNIT=y and aurora as a
    module: both complete, aurora.ko links without the test helpers, and there is no warning in these files.
  • run-host-tests.py in the build VM: 451 of 451 pass with this change, as on the base.
  • checkpatch --strict: no errors.

Still to run

  • Follow-up, for the owners of mm, io_uring, iommufd and networking: one charge and uncharge helper for
    user_struct::locked_vm in place of the six copies (__io_account_mem(), incr_user_locked_vm(), secretmem,
    mm_account_pinned_pages(), XDP umem and this driver's), and a Kconfig symbol in place of the condition in
    <linux/sched/user.h>.
  • Rows from other G17 Macs are welcome.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

The accounting looks correct to me.

  • drivers/gpu/drm/asahi/user_pages.c:39-65 matches __io_account_mem(): CAP_IPC_LOCK is checked in init_user_ns (so root inside a user namespace is still charged), the cmpxchg loop is overflow-checked, and the release drops the reference it took. The charge is tied to the user_struct reference, not to the mm or the task. A child that exits keeps its pins charged until the object is freed, and a setuid() after pinning still uncharges the original user.
  • gem.rs:505-530 and :605-608: the charge is taken before UserPages exists, and every failure after that (the reserve(), the GUP or fragment pin) goes through Drop, which gives back exactly counted pages to the stored user, once. I don't see a leak or a double uncharge.
  • The pool is now shared with io_uring fixed buffers, iommufd and SO_ZEROCOPY, so one of a user's processes using those leaves less room for Borealis host imports, and the reverse. That's the usual kernel model, and the UAPI comment says so. Worth knowing for anyone who hits ENOMEM from VK_EXT_external_memory_host under the default 8 MiB.
  • Minor: the KUnit helpers at user_pages.c:67-100 (override_creds(), writing rlim_cur) are built whenever CONFIG_KUNIT is set, not only when this suite is. The test also asserts exact locked_vm values for the root user. If the suite runs as a module on a live system, root's io_uring or perf mmaps could make it flaky. Not a blocker.

The only hardware row is the J775D. Rows from the other G17 Macs (A18 Pro, M4 Pro) would be good: dEQP-VK.memory.external_memory_host.* at the default limit, plus a normal desktop session, at this head.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-PR checklist review on 464023d790812a1522cdf7b3d8eb8aa1c790c309 (CI: host-tests green; note SEP source checks / rust-build / kunit workflows did not trigger for drivers/gpu/drm/asahi/ paths).

Blockers (REQUEST_CHANGES)

  1. Build failure with CONFIG_KUNIT=m (-Dwarnings / dead_code):

    • #[kernel::macros::kunit_tests(asahi_gem_user_memory)] expands to #[cfg(CONFIG_KUNIT = "y")] (rust/macros/kunit.rs:44), so mod user_memory_tests is compiled out when CONFIG_KUNIT=m (standard on distro kernels).
    • However, drivers/gpu/drm/asahi/gem.rs:1075 gates the four private extern "C" KUnit helpers with #[cfg(CONFIG_KUNIT)], which Kbuild defines for both =y and =m (scripts/kconfig/confdata.c:799). Under CONFIG_KUNIT=m, all four extern "C" declarations have no callers and fail the build with error: function ... is never used under -Dwarnings (dead_code).
    • Every other KUnit helper in drivers/gpu/drm/asahi/ (g17/kick.rs, pairs.rs, preparation.rs, queue/admission.rs, runtime.rs) uses #[cfg(CONFIG_KUNIT = "y")].
    • Matching that on the C side, drivers/gpu/drm/asahi/user_pages.c:67 and user_pages.h:21 should use #ifdef CONFIG_KUNIT (i.e. IS_BUILTIN(CONFIG_KUNIT)) instead of #if IS_ENABLED(CONFIG_KUNIT), so the test-only asahi_test_drop_ipc_lock() / asahi_test_user_locked_vm_add() / asahi_test_set_memlock() helpers are not compiled into production aurora.ko when CONFIG_KUNIT=m.
  2. KUnit test cleanup underflows global root_user->locked_vm on early error return (drivers/gpu/drm/asahi/gem.rs:887-914):

    • Inside the cleanup closure in pins_count_against_the_user(), UserPages::pin(addr, 2 * PAGE_SIZE, true)? (line 889) runs before asahi_test_user_locked_vm_add(held) (line 897).
    • If that ? returns Err (before held is added), line 911 still unconditionally executes asahi_test_user_locked_vm_add(-held), subtracting 1024 from the global root_user->locked_vm that was never added and leaving it negative for the rest of the kernel run.
    • Track whether held was added (e.g., let mut held_added = false;) and only subtract -held if it was actually added.

Code Review of Core Accounting Path (Looks Good)

  • asahi_user_account() / asahi_user_unaccount() in user_pages.c: Matches io_uring (ns_capable_noaudit(&init_user_ns, CAP_IPC_LOCK) + atomic cmpxchg loop on user->locked_vm, plus check_add_overflow which is strictly safer) and iommufd's underflow WARN_ON while still calling free_uid(user).
  • UserPages::pin() / Drop: user and mm accounting unwind cleanly if pages.reserve(), asahi_pin_user_fragments(), or pin_user_pages_fast() fail after this is constructed.
  • include/linux/sched/user.h: Adding IS_ENABLED(CONFIG_DRM_ASAHI) to user_struct::locked_vm matches IS_ENABLED(CONFIG_IOMMUFD).
  • asahi_test_drop_ipc_lock() / asahi_test_restore_creds(): prepare_creds() + override_creds() + put_cred(revert_creds()) refcounting is correct for this kernel's rcu_replace_pointer-based override_creds/revert_creds.

Pre-PR Checklist (§1–§6)

  • §1 No model gating: Pass — applies to all GPUs supporting user-memory objects (File::supports_user_memory()).
  • §2 Production-ready: Pass — default command line, no hacks.
  • §3 Safety: Pass — uses standard RLIMIT_MEMLOCK + user_struct::locked_vm.
  • §4 Clean-room & attribution: Pass — clean human commit identity and Signed-off-by; Assisted-by: in PR body.
  • §5 Evidence: Strong J775D A/B row (including Borealis dEQP-VK.memory.external_memory_host.* and cross-process fork/exit ENOMEM verification), though as noted in ## Still to run the CONFIG_MM_SUBPAGE fragment-pin path (user4k/gem-userptr) and other G17 Macs remain to be run; also please re-verify a build with CONFIG_KUNIT=m after fixing the cfg gate above.
  • §6 Naming: Pass (correctly uses Borealis).

Assisted-by: LLM (Gemini 4 Neon)

…oss fork and exit

GEM_USERPTR counts the pages it pins in the calling mm's pinned_vm and
compares that count with RLIMIT_MEMLOCK. The object belongs to the DRM
file, not to the mm. A forked child starts with nothing counted, its
pins land in the file it shares with its parent, and they stay pinned
after it exits, counted against an mm that no longer runs anything. The
limit therefore does not bound what one user can pin.

Charge the pins to the user instead, in user_struct::locked_vm, as
io_uring does for its registered buffers (__io_account_mem()) and
iommufd for its pinned pages: every process of the user shares the
count, and a pin stays charged until its object is freed. As in both,
a CAP_IPC_LOCK caller is not charged. The mm's pinned_vm still counts
the pages, as it did. The UAPI comment says so, and the driver joins
the users of user_struct::locked_vm in <linux/sched/user.h>, as
iommufd did.

Only the G17 backend takes user-memory objects
(File::supports_user_memory()), so other GPUs do not run this code. A
process with a smaller page size is charged the same native pages. A
KUnit case checks that a CAP_IPC_LOCK caller is not charged; that,
without it, pages charged to the test's user as another process of that
user would charge them make the next pin fail although the test's own
mm has none; and that dropped pins are given back. The case and its
helpers in user_pages.c are built only with built-in KUnit and a
built-in driver, where the suite runs before userspace and nothing else
charges the test's user, and it undoes its changes before its final
assertion.

This is a narrow fix. The charge loop in user_pages.c is the sixth copy
of one that io_uring (__io_account_mem()), iommufd
(incr_user_locked_vm()), secretmem, the network zerocopy path
(mm_account_pinned_pages()) and XDP umem each carry, and every user of
user_struct::locked_vm adds its option to the condition in
<linux/sched/user.h>. The structural fix is one charge and uncharge
helper for user_struct::locked_vm, with a Kconfig symbol that its users
select in place of that condition. It changes code owned by mm,
io_uring, iommufd and networking, so it is left as a follow-up for
those owners. This copy keeps their arithmetic, adding only an overflow
check, so that such a helper can replace it.

Fixes: ecc94a2 ("drm/asahi: GEM_USERPTR, buffer objects over the caller's memory")
Reported-by: Erik Bourget <erik@ebourget.net>
Suggested-by: Erik Bourget <erik@ebourget.net>
Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
@funkzy
funkzy force-pushed the pr/asahi-userptr-user-limit branch from 464023d to 1121847 Compare November 22, 2026 21:43
@funkzy

funkzy commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, dj and Ryan. Both blockers were real; the commit is amended (now 1121847).

  • Change of approach: the earlier version described its charge loop and its line in <linux/sched/user.h> as following io_uring and iommufd. That loop is a sixth copy (io_uring, iommufd, secretmem, the network zerocopy path and XDP umem each carry one), and each user adds its option to that header's condition, because the kernel has no shared helper for user_struct::locked_vm. This version keeps the code and labels it narrow in the commit message and the body; the shared helper, with a Kconfig symbol in place of the condition, is named there as a follow-up for the owners of mm, io_uring, iommufd and networking.
  • CONFIG_KUNIT=m: confirmed. kunit_tests compiles the test module only with CONFIG_KUNIT="y", while #[cfg(CONFIG_KUNIT)] is also set for =m, so the extern block had no users. The helpers and their extern block are now built only with built-in KUnit and a built-in driver (#[cfg(all(CONFIG_KUNIT = "y", CONFIG_DRM_ASAHI = "y"))], and IS_BUILTIN(CONFIG_KUNIT) && !defined(MODULE) in user_pages.c/.h, as clpc.c does), so they aren't in a modular aurora.ko. That also covers Ryan's note about them being built whenever KUnit is set. A CONFIG_KUNIT=m build of this head (integration's config plus our J775D fragment, which adds nothing to aurora) completes: aurora.ko links without the helpers, and there is no warning from gem.rs or user_pages.c. So does a CONFIG_KUNIT=y build with aurora as a module. With CONFIG_WERROR=y added, the posted and the amended commit both stop on the same 15 unrelated Rust lint errors this config already has in aurora; the posted one adds 4 for these helpers, the amended one none. None of our other open PRs has a KUnit helper gated this way.
  • Cleanup: confirmed. The cleanup now takes back only what the test added. A failed assert also ends the test thread before any cleanup, so every check made while the test has changed the user's count, credentials or limit is now an error return, and the only assertion runs after the cleanup.
  • Exact counts on a live system (Ryan): done. pins_count_against_the_user runs only with aurora built in, where the suite runs before userspace and nothing else charges the test's user, and it's reported as skipped otherwise.
  • Shared pool: agreed, that is the intended model, and the UAPI comment says so.
  • Testing at this head: a J775D row on current integration/aurora plus only arm64: dts: apple: t6050-j775d: Give the Mac Studio (M5 Ultra) a working GPU, and its M and P core capacities (754/1024) to the scheduler #1973 (its GPU node), with and without this change: one user at a 16 MiB limit whose 8 forked children each pin 8 MiB and exit now holds 16 MiB (6 refused with ENOMEM), against 64 MiB without it, and closing the file gives the charge back; the same failed units and no new kernel error from the change. KUnit built in: 375 of 377 cases pass in 76 suites with 2 skip, asahi_gem_user_memory 5 of 5. Host tests 451 of 451, as on the base. The body's earlier "361 of 363" counted only suites that print a totals line; counting every case it is 375 of 377 on the base as well.
  • Subpage path: the J775D kits do have CONFIG_MM_SUBPAGE (ARM64_USER4K_EXPERIMENTAL defaults on); it is off at run time without user4k=on. So a no-regression check of the fragment-pin path runs on the J775D (the selftest's results don't depend on whether the pins are charged to the mm or the user, so both arms are expected to match): the 27.2 GPU base of the extra row in the body, booted with user4k=on, with and without this change, running tools/testing/selftests/arm64/user4k/gem-userptr. On both kernels it passes 3 of 3, as root and as an unprivileged user at the default 8 MiB limit: the native pages mapped whole and in order pin 32 KiB and give it back on close, and the two mixed-page layouts get EFAULT with nothing pinned. With RLIMIT_MEMLOCK at 16 KiB, all three are refused with ENOMEM before any page is pinned. The same 2 failed units and the same 9 err-level lines on both, no WARNING, BUG or Oops.
  • Rows: Ryan, could you run this head on your J616s and the A18 Pro: dEQP-VK.memory.external_memory_host.* at the default memory-lock limit, plus a normal desktop session?

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks. Re-checked at 1121847 against 464023d.

  • The runtime code is unchanged (asahi_user_account()/asahi_user_unaccount(), UserPages::pin()/Drop, sched/user.h, UAPI comment), so my earlier notes on the accounting still hold.
  • KUnit helpers: fixed. user_pages.c:67/user_pages.h:21 and the extern block at gem.rs:1087 are now built only with built-in KUnit and a built-in driver. pins_count_against_the_user carries #[cfg(CONFIG_DRM_ASAHI = "y")], which kunit_tests copies onto the generated case, so a modular build reports it as skipped. The exact-count concern is gone too, since the case now only runs before userspace.
  • The new cleanup looks right. added is only set once the count has been raised, every check after the creds and limit change is an error return, and the restore runs before the one remaining assertion. An unexpected successful pin in the ENOMEM check is dropped at once.

The J775D fork-and-exit row is at this head, and the earlier dEQP row at 464023d still applies, because the runtime code is identical. Still missing: the same dEQP-VK.memory.external_memory_host.* run at the default limit, plus a desktop session, on the A18 Pro (T8140) and M4 Pro (T6040).

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Not on integration/aurora yet: on daa9e2d GEM_USERPTR pins are still counted only in the calling mm's pinned_vm. The commit applies cleanly on daa9e2d. Both blockers from the review of 464023d (the CONFIG_KUNIT=m build and the test cleanup) are addressed at 1121847, but the requested-changes review has not been refreshed since; @DjDeveloperr, could you re-check that head? The hardware rows still missing are dEQP-VK.memory.external_memory_host.* at the default memory-lock limit plus a normal desktop session with Borealis on the A18 Pro and the M4 Pro.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Rows at the default memory-lock limit (8 MiB soft and hard, desktop user, no prlimit) on a MacBook Neo, fleet85:

  • dEQP-VK.memory.external_memory_host.*: 4 pass, 8 not supported, 0 fail. These cases import buffers small enough to fit under 8 MiB.
  • Geekbench 6.7.1 Vulkan imports a 90.7 MiB host buffer and aborts at start: allocate_buffer_host(...) returned -2. The same happens on an M4 Pro.

Charging user_struct::locked_vm keeps the same 8 MiB limit, so this PR would not change that result. #2961 proposes a different bound: the GPU memory ledger that already limits GEM_CREATE, with no RLIMIT_MEMLOCK check. With it, Geekbench completes at the default limit. Review of that approach is welcome there. If it lands, the per-user accounting here would no longer be needed.

@funkzy

funkzy commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the rows, Ryan. Closing this in favour of #2961, which fixes the underlying cause cleanly by removing the RLIMIT_MEMLOCK check on pinned_vm and leaving memacct::LEDGER as the single bound for GEM_USERPTR (which let Geekbench 6.7.1 Vulkan run under default limits on #2961's M4 Pro and A18 Pro rows). Happy to reopen this if #2961 changes direction.

Assisted-by: LLM (Gemini:Neon)

@funkzy funkzy closed this Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants