PR_SVE_SET_VL(2const)

πŸ’– PR_SVE_SET_VL(2const) πŸ’–

okay bestie, this is a page from the 2const corner of the Linux man-pages universe, and it's about SVE vector lengths on arm64. buckle up πŸŽ€


✨ NAME ✨

PR_SVE_SET_VL β€” set the thread's SVE vector length πŸ¦‹


πŸ“š LIBRARY πŸ“š

Standard C library (libc, -lc) β€” the classic πŸ’…


🧚 SYNOPSIS 🧚

#include <linux/prctl.h>  /* Definition of PR_* constants */
#include <sys/prctl.h>

int prctl(PR_SVE_SET_VL, unsigned long val);

🌸 DESCRIPTION 🌸

So, you're configuring the thread's SVE vector length, as specified by val. that's the whole vibe.

The bits of val that correspond to PR_SVE_VL_LEN_MASK must be set to the desired vector length in bytes. and here's the cute part β€” it's interpreted as an upper bound: the kernel will pick the greatest available vector length that does not exceed the value you specified. so if you're feeling ✨extra✨ and you want the absolute maximum, you set the PR_SVE_VL_LEN_MASK bits to SVE_VL_MAX (which lives in <asm/sigcontext.h>) and you get the max supported vector length. periodt.

Also, the other bits of val must be set to one of these flag combos:

  • 0L β€” do the change immediately. but at the next execve(2) in the thread, the vector length gets reset to the value configured in /proc/sys/abi/sve_default_vector_length. so it's giving temporary 😭
  • PR_SVE_VL_INHERIT β€” do the change immediately, and subsequent execve(2) calls will preserve the new vector length. long-term commitment, we love to see it 🫢
  • PR_SVE_SET_VL_ONEXEC β€” defer the change so it happens at the next execve(2) in the thread. further execve(2) calls will reset the vector length to the value configured in /proc/sys/abi/sve_default_vector_length. one-time thing, no strings πŸ’€
  • PR_SVE_SET_VL_ONEXEC | PR_SVE_VL_INHERIT β€” defer the change so it happens at the next execve(2) in the thread, and further execve(2) calls will preserve the new vector length. delayed and permanent, main character energy πŸ‘‘

In all cases, any previously pending deferred change is canceled. gone. cancelled, as the kids say 🚫

On success, a nonnegative value is returned that describes the selected configuration. if PR_SVE_SET_VL_ONEXEC was included in val, then the configuration described by the return value will take effect at the next execve(2). otherwise, the configuration is already in effect when the PR_SVE_SET_VL call returns. either way, the value is encoded in the exact same way as the return value of PR_SVE_GET_VL. and heads up: there is no explicit flag in the return value corresponding to PR_SVE_SET_VL_ONEXEC. iykyk πŸ™ˆ

The configuration (including any pending deferred change) is inherited across fork(2) and clone(2). it runs in the family πŸ’œ


πŸ’« RETURN VALUE πŸ’«

On success, PR_SVE_SET_VL returns the nonnegative value described above. on error, -1 is returned, and errno is set to indicate the error. classic. 😀


🚨 ERRORS 🚨

  • EINVAL β€” SVE is not available on this platform. not today, bestie πŸ’€
  • EINVAL β€” the value in the bits of val corresponding to PR_SVE_VL_LEN_MASK is outside the range [SVE_VL_MIN, SVE_VL_MAX] or is not a multiple of 16.
  • EINVAL β€” the other bits of val are invalid or unsupported.

πŸ“ FILES πŸ“

  • /proc/sys/abi/sve_default_vector_length

🌈 STANDARDS 🌈

Linux. arm64 only. sorry x86 girlies, this one's not for you πŸŽ€


πŸ•°οΈ HISTORY πŸ•°οΈ

Linux 4.15 (arm64). vintage but iconic ✨


⚠️ CAVEATS ⚠️

Because the compiler or run-time environment may be using SVE, using this call without the PR_SVE_SET_VL_ONEXEC flag may crash the calling process. 😭

The conditions for using it safely are complex and system-dependent. so like… don't use it unless you really know what you are doing. fr fr. this is not a vibe-check-and-see situation, this is a read-the-docs-three-times situation πŸ™


πŸ‘€ SEE ALSO πŸ‘€

For more information, see the kernel source file Documentation/arch/arm64/sve.rst.


and that's the whole page, bestie! this one's from Linux man-pages 6.20, dated 2026-02-08, and it's PR_SVE_SET_VL(2const). go forth and vector responsibly πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: Linux-man-pages-copyleft
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms