include/linux/sunrpc/svc.h
Source file repositories/reference/linux-study-clean/include/linux/sunrpc/svc.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/sunrpc/svc.h- Extension
.h- Size
- 21103 bytes
- Lines
- 633
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/in.hlinux/in6.hlinux/sunrpc/types.hlinux/sunrpc/xdr.hlinux/sunrpc/auth.hlinux/sunrpc/svcauth.hlinux/lwq.hlinux/wait.hlinux/mm.hlinux/folio_batch.hlinux/kthread.h
Detected Declarations
struct svc_poolstruct svc_servstruct svc_infostruct svc_rqststruct svc_deferred_reqstruct svc_process_infostruct svc_programstruct svc_versionstruct svc_procedurefunction pagesfunction svc_exit_threadfunction svc_thread_should_stopfunction svc_rqst_page_releasefunction svc_reserve_authfunction svcxdr_init_decodefunction svcxdr_init_encodefunction svcxdr_encode_opaque_pagesfunction svcxdr_set_auth_slackfunction svcxdr_set_accept_stat
Annotated Snippet
struct svc_pool {
unsigned int sp_id; /* pool id; also node id on NUMA */
unsigned int sp_nrthreads; /* # of threads currently running in pool */
unsigned int sp_nrthrmin; /* Min number of threads to run per pool */
unsigned int sp_nrthrmax; /* Max requested number of threads in pool */
struct lwq sp_xprts; /* pending transports */
struct list_head sp_all_threads; /* all server threads */
struct llist_head sp_idle_threads; /* idle server threads */
/* statistics on pool operation */
struct percpu_counter sp_messages_arrived;
struct percpu_counter sp_sockets_queued;
struct percpu_counter sp_threads_woken;
unsigned long sp_flags;
} ____cacheline_aligned_in_smp;
/* bits for sp_flags */
enum {
SP_TASK_PENDING, /* still work to do even if no xprt is queued */
SP_NEED_VICTIM, /* One thread needs to agree to exit */
SP_VICTIM_REMAINS, /* One thread needs to actually exit */
SP_TASK_STARTING, /* Task has started but not added to idle yet */
};
/*
* RPC service.
*
* An RPC service is a ``daemon,'' possibly multithreaded, which
* receives and processes incoming RPC messages.
* It has one or more transport sockets associated with it, and maintains
* a list of idle threads waiting for input.
*
* We currently do not support more than one RPC program per daemon.
*/
struct svc_serv {
struct svc_program * sv_programs; /* RPC programs */
struct svc_stat * sv_stats; /* RPC statistics */
spinlock_t sv_lock;
unsigned int sv_nprogs; /* Number of sv_programs */
unsigned int sv_nrthreads; /* # of running server threads */
unsigned int sv_max_payload; /* datagram payload size */
unsigned int sv_max_mesg; /* max_payload + 1 page for overheads */
unsigned int sv_xdrsize; /* XDR buffer size */
struct list_head sv_permsocks; /* all permanent sockets */
struct list_head sv_tempsocks; /* all temporary sockets */
int sv_tmpcnt; /* count of temporary "valid" sockets */
struct timer_list sv_temptimer; /* timer for aging temporary sockets */
char * sv_name; /* service name */
unsigned int sv_nrpools; /* number of thread pools */
bool sv_is_pooled; /* is this a pooled service? */
struct svc_pool * sv_pools; /* array of thread pools */
int (*sv_threadfn)(void *data);
#if defined(CONFIG_SUNRPC_BACKCHANNEL)
struct lwq sv_cb_list; /* queue for callback requests
* that arrive over the same
* connection */
bool sv_bc_enabled; /* service uses backchannel */
#endif /* CONFIG_SUNRPC_BACKCHANNEL */
};
/* This is used by pool_stats to find and lock an svc */
struct svc_info {
struct svc_serv *serv;
struct mutex *mutex;
};
void svc_destroy(struct svc_serv **svcp);
/*
* Maximum payload size supported by a kernel RPC server.
* This is use to determine the max number of pages nfsd is
* willing to return in a single READ operation.
*
* These happen to all be powers of 2, which is not strictly
* necessary but helps enforce the real limitation, which is
* that they should be multiples of PAGE_SIZE.
*
* For UDP transports, a block plus NFS,RPC, and UDP headers
* has to fit into the IP datagram limit of 64K. The largest
* feasible number for all known page sizes is probably 48K,
* but we choose 32K here. This is the same as the historical
* Linux limit; someone who cares more about NFS/UDP performance
* can test a larger number.
*
* For non-UDP transports we have more freedom. A size of 4MB is
Annotation
- Immediate include surface: `linux/in.h`, `linux/in6.h`, `linux/sunrpc/types.h`, `linux/sunrpc/xdr.h`, `linux/sunrpc/auth.h`, `linux/sunrpc/svcauth.h`, `linux/lwq.h`, `linux/wait.h`.
- Detected declarations: `struct svc_pool`, `struct svc_serv`, `struct svc_info`, `struct svc_rqst`, `struct svc_deferred_req`, `struct svc_process_info`, `struct svc_program`, `struct svc_version`, `struct svc_procedure`, `function pages`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.