On Wed, 19 Jun 2024, Dave Chinner wrote: > > I'm not sure that the NFS server needs to reinvent the wheel here... > Workqueues provide threads, but we still have to provide the 'struct work_struct'. For nfsd that is essentially 'struct svc_rqst' which is not small by itself, and includes pre-allocated buffer space for the largest possible request+reply - typically a little over 1MB. If we allocate a new svc_rqst for each incoming request and hand it to workqueue, then we are probably doing a lot more allocating and freeing than at present. If we keep a pool of svc_rqst and re-use them - and if we actually have several pools, one for each NUMA node - then it seems very little extra effort to permanently associate a thread with each svc_rqst. It's not clear that workqueue would buy us anything. Certainly we could usefully learn from workqueue and make use of the same primitives that it uses, but I don't see there would be a win from using it directly. Thanks, NeilBrown