Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

SUNRPC: Fix the execution time statistics in the face of RPC restarts

If the rpc_task gets restarted, then we want to ensure that we don't
double-count the execution time statistics, timeout data, etc.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

+23 -7
+23 -7
net/sunrpc/sched.c
··· 590 590 task->tk_ops->rpc_call_prepare(task, task->tk_calldata); 591 591 } 592 592 593 + static void 594 + rpc_init_task_statistics(struct rpc_task *task) 595 + { 596 + /* Initialize retry counters */ 597 + task->tk_garb_retry = 2; 598 + task->tk_cred_retry = 2; 599 + task->tk_rebind_retry = 2; 600 + 601 + /* starting timestamp */ 602 + task->tk_start = ktime_get(); 603 + } 604 + 605 + static void 606 + rpc_reset_task_statistics(struct rpc_task *task) 607 + { 608 + task->tk_timeouts = 0; 609 + task->tk_flags &= ~(RPC_CALL_MAJORSEEN|RPC_TASK_KILLED|RPC_TASK_SENT); 610 + 611 + rpc_init_task_statistics(task); 612 + } 613 + 593 614 /* 594 615 * Helper that calls task->tk_ops->rpc_call_done if it exists 595 616 */ ··· 623 602 WARN_ON(RPC_ASSASSINATED(task)); 624 603 /* Always release the RPC slot and buffer memory */ 625 604 xprt_release(task); 605 + rpc_reset_task_statistics(task); 626 606 } 627 607 } 628 608 } ··· 826 804 task->tk_calldata = task_setup_data->callback_data; 827 805 INIT_LIST_HEAD(&task->tk_task); 828 806 829 - /* Initialize retry counters */ 830 - task->tk_garb_retry = 2; 831 - task->tk_cred_retry = 2; 832 - task->tk_rebind_retry = 2; 833 - 834 807 task->tk_priority = task_setup_data->priority - RPC_PRIORITY_LOW; 835 808 task->tk_owner = current->tgid; 836 809 ··· 835 818 if (task->tk_ops->rpc_call_prepare != NULL) 836 819 task->tk_action = rpc_prepare_task; 837 820 838 - /* starting timestamp */ 839 - task->tk_start = ktime_get(); 821 + rpc_init_task_statistics(task); 840 822 841 823 dprintk("RPC: new task initialized, procpid %u\n", 842 824 task_pid_nr(current));