svc_set_num_threads(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… svc_set_num_threads β€” the svc_set_num_threads(9) page, bestie edition

okay so you found the svc_set_num_threads(9) page from the Kernel API Manual and you want the tea β˜• β€” welcome, this is the one that lets you flex the thread count on a serv. Let's go πŸŽ€


✨ NAME ✨

svc_set_num_threads β€” adjust number of threads in serv 🧡✨


🌸 SYNOPSIS 🌸

int svc_set_num_threads (struct svc_serv *serv , unsigned int
       min_threads , unsigned int nrservs );

yes she's an int, yes she returns, yes we love a function with range πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • serv β€” RPC service to adjust. this is your main character, the struct we're doing all this for πŸ‘‘
  • min_threads β€” min number of threads to run per pool. the floor, the bare minimum, the "at least give me this" πŸ₯Ί
  • nrservs β€” New number of threads for serv (0 means kill all threads πŸ’€ β€” yes, all of them, no cap)

πŸ’– DESCRIPTION πŸ’–

Create or destroy threads in serv to bring it to nrservs. that's the whole assignment, fr fr. and if there are multiple pools? then the new threads or victims get distributed evenly among them. balanced. fair. iconic. βš–οΈβœ¨

now here's the spicy part πŸ”₯ β€” when nrservs is non-zero but smaller than the number of pools, even distribution would leave some pools empty. and since each pool maps to a NUMA node and only services transports steered to that node, every pool is instead guaranteed at least one thread. so the resulting total may therefore exceed nrservs. lowkey math you didn't sign up for, but it's for a good reason 🫢

⚠️ Caller must ensure mutual exclusion between this and server startup or shutdown. do not be out here racing, bestie, that's not the vibe πŸ™ˆ

Returns zero on success or a negative errno if an error occurred while starting a thread. and on failure? some pools may have already been adjusted β€” the caller is responsible for recovery 😭 so like, clean up after yourself, no one else is gonna do it πŸ§ΉπŸ’œ


🌈 SEE ALSO 🌈

Kernel file ./net/sunrpc/svc.c plus sunrpc_get_pool_mode(9), svc_serv_nrpools(9), svc_pool_for_cpu(9), svc_create(9), svc_create_pooled(9), svc_pool_wake_idle_thread(9), svc_new_thread(9), svc_set_pool_threads(9), svc_serv_maxthreads(9), svc_rqst_replace_page(9), svc_rqst_release_pages(9), svc_exit_thread(9), svc_register(9), svc_stat_alloc_counts(9), svc_stat_free_counts(9), svc_process(9), svc_process_bc(9), svc_max_payload(9), svc_proc_name(9), svc_encode_result_payload(9), svc_fill_symlink_pathname(9) β€” the whole friend group, go say hi πŸ«‚πŸ’–


and that's the page!! πŸŽ€ brought to you from ./net/sunrpc, dated October 2026 β€” mwah, stay threaded, stay pooled, and pls read the mutual exclusion warning again πŸ’…β­

πŸ“¦ where this page comes from