svc_set_num_threads(9)
π
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 forserv(0means 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms