aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-11-30 23:59:29 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-12-05 18:30:53 -0500
commitc05eecf636101dd4347b2d8fa457626bf0088e0a (patch)
tree6362560cd66efedd12793552b124417e4fe68a74 /net/sunrpc
parentb75ad4cda5a6cd3431b1c65c2739c5ebd2c4b9da (diff)
SUNRPC: Don't allow low priority tasks to pre-empt higher priority ones
Currently, the priority queues attempt to be 'fair' to lower priority tasks by scheduling them after a certain number of higher priority tasks have run. The problem is that both the transport send queue and the NFSv4.1 session slot queue have strong ordering requirements. This patch therefore removes the fairness code in favour of strong ordering of task priorities. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/sched.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index 1aefc9fef866..d17a704aaf5f 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -98,6 +98,23 @@ __rpc_add_timer(struct rpc_wait_queue *queue, struct rpc_task *task)
98 list_add(&task->u.tk_wait.timer_list, &queue->timer_list.list); 98 list_add(&task->u.tk_wait.timer_list, &queue->timer_list.list);
99} 99}
100 100
101static void rpc_set_waitqueue_priority(struct rpc_wait_queue *queue, int priority)
102{
103 queue->priority = priority;
104}
105
106static void rpc_set_waitqueue_owner(struct rpc_wait_queue *queue, pid_t pid)
107{
108 queue->owner = pid;
109 queue->nr = RPC_BATCH_COUNT;
110}
111
112static void rpc_reset_waitqueue_priority(struct rpc_wait_queue *queue)
113{
114 rpc_set_waitqueue_priority(queue, queue->maxpriority);
115 rpc_set_waitqueue_owner(queue, 0);
116}
117
101/* 118/*
102 * Add new request to a priority queue. 119 * Add new request to a priority queue.
103 */ 120 */
@@ -109,9 +126,11 @@ static void __rpc_add_wait_queue_priority(struct rpc_wait_queue *queue,
109 struct rpc_task *t; 126 struct rpc_task *t;
110 127
111 INIT_LIST_HEAD(&task->u.tk_wait.links); 128 INIT_LIST_HEAD(&task->u.tk_wait.links);
112 q = &queue->tasks[queue_priority];
113 if (unlikely(queue_priority > queue->maxpriority)) 129 if (unlikely(queue_priority > queue->maxpriority))
114 q = &queue->tasks[queue->maxpriority]; 130 queue_priority = queue->maxpriority;
131 if (queue_priority > queue->priority)
132 rpc_set_waitqueue_priority(queue, queue_priority);
133 q = &queue->tasks[queue_priority];
115 list_for_each_entry(t, q, u.tk_wait.list) { 134 list_for_each_entry(t, q, u.tk_wait.list) {
116 if (t->tk_owner == task->tk_owner) { 135 if (t->tk_owner == task->tk_owner) {
117 list_add_tail(&task->u.tk_wait.list, &t->u.tk_wait.links); 136 list_add_tail(&task->u.tk_wait.list, &t->u.tk_wait.links);
@@ -180,24 +199,6 @@ static void __rpc_remove_wait_queue(struct rpc_wait_queue *queue, struct rpc_tas
180 task->tk_pid, queue, rpc_qname(queue)); 199 task->tk_pid, queue, rpc_qname(queue));
181} 200}
182 201
183static inline void rpc_set_waitqueue_priority(struct rpc_wait_queue *queue, int priority)
184{
185 queue->priority = priority;
186 queue->count = 1 << (priority * 2);
187}
188
189static inline void rpc_set_waitqueue_owner(struct rpc_wait_queue *queue, pid_t pid)
190{
191 queue->owner = pid;
192 queue->nr = RPC_BATCH_COUNT;
193}
194
195static inline void rpc_reset_waitqueue_priority(struct rpc_wait_queue *queue)
196{
197 rpc_set_waitqueue_priority(queue, queue->maxpriority);
198 rpc_set_waitqueue_owner(queue, 0);
199}
200
201static void __rpc_init_priority_wait_queue(struct rpc_wait_queue *queue, const char *qname, unsigned char nr_queues) 202static void __rpc_init_priority_wait_queue(struct rpc_wait_queue *queue, const char *qname, unsigned char nr_queues)
202{ 203{
203 int i; 204 int i;
@@ -464,8 +465,7 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q
464 /* 465 /*
465 * Check if we need to switch queues. 466 * Check if we need to switch queues.
466 */ 467 */
467 if (--queue->count) 468 goto new_owner;
468 goto new_owner;
469 } 469 }
470 470
471 /* 471 /*