Commit f09a1ad6 authored by Jeff Layton's avatar Jeff Layton Committed by Kamal Mostafa

nfs: fix high load average due to callback thread sleeping

commit 5d05e54a upstream.

Chuck pointed out a problem that crept in with commit 6ffa30d3 (nfs:
don't call blocking operations while !TASK_RUNNING). Linux counts tasks
in uninterruptible sleep against the load average, so this caused the
system's load average to be pinned at at least 1 when there was a
NFSv4.1+ mount active.

Not a huge problem, but it's probably worth fixing before we get too
many complaints about it. This patch converts the code back to use
TASK_INTERRUPTIBLE sleep, simply has it flush any signals on each loop
iteration. In practice no one should really be signalling this thread at
all, so I think this is reasonably safe.

With this change, there's also no need to game the hung task watchdog so
we can also convert the schedule_timeout call back to a normal schedule.
Reported-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarJeff Layton <jeff.layton@primarydata.com>
Tested-by: default avatarChuck Lever <chuck.lever@oracle.com>
Fixes: commit 6ffa30d3 (“nfs: don't call blocking . . .”)
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent d6cfb99d
...@@ -128,7 +128,7 @@ nfs41_callback_svc(void *vrqstp) ...@@ -128,7 +128,7 @@ nfs41_callback_svc(void *vrqstp)
if (try_to_freeze()) if (try_to_freeze())
continue; continue;
prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_UNINTERRUPTIBLE); prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_INTERRUPTIBLE);
spin_lock_bh(&serv->sv_cb_lock); spin_lock_bh(&serv->sv_cb_lock);
if (!list_empty(&serv->sv_cb_list)) { if (!list_empty(&serv->sv_cb_list)) {
req = list_first_entry(&serv->sv_cb_list, req = list_first_entry(&serv->sv_cb_list,
...@@ -142,10 +142,10 @@ nfs41_callback_svc(void *vrqstp) ...@@ -142,10 +142,10 @@ nfs41_callback_svc(void *vrqstp)
error); error);
} else { } else {
spin_unlock_bh(&serv->sv_cb_lock); spin_unlock_bh(&serv->sv_cb_lock);
/* schedule_timeout to game the hung task watchdog */ schedule();
schedule_timeout(60 * HZ);
finish_wait(&serv->sv_cb_waitq, &wq); finish_wait(&serv->sv_cb_waitq, &wq);
} }
flush_signals(current);
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment