[PATCH RFC 1/3] SUNRPC: add a second per-pool ready queue for high-priority transports
Benjamin Coddington <ben.coddington-F/[email protected]>
| Newsgroups | gmane.linux.nfs |
|---|---|
| Message-ID | <335f2842438344832fb46b2822a6c831119bec0a.1782314746.git.bcodding@hammerspace.com> |
A pool's ready transports are tracked in a single lockless queue, sp_xprts, and dispatched in FIFO order. A transport's position in that queue is independent of how much work it already has in flight, so a connection that keeps many requests pending is serviced on equal terms with one that has been idle -- the idle flow's next request waits behind the busy flow's backlog. Add a second queue, sp_xprts_hi, alongside sp_xprts and initialise it with each pool. Nothing is enqueued to it yet, so this is no functional change; a later patch routes transports with no requests in flight onto it and drains it ahead of sp_xprts, giving an idle flow's request a latency floor that a backlogged flow cannot push it below. Signed-off-by: Benjamin Coddington <bcodding-F/[email protected]> --- include/linux/sunrpc/svc.h | 1 + net/sunrpc/svc.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 3a0152d926fb..89fa90f6d360 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -39,6 +39,7 @@ struct svc_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 lwq sp_xprts_hi; /* high-priority pending transports */ struct list_head sp_all_threads; /* all server threads */ struct llist_head sp_idle_threads; /* idle server threads */ diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index dd80a2eaaa74..7ead2db314c7 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -566,6 +566,7 @@ __svc_create(struct svc_program *prog, int nprogs, struct svc_stat *stats, pool->sp_id = i; lwq_init(&pool->sp_xprts); + lwq_init(&pool->sp_xprts_hi); INIT_LIST_HEAD(&pool->sp_all_threads); init_llist_head(&pool->sp_idle_threads); -- 2.53.0