]> git.baikalelectronics.ru Git - kernel.git/commit
delayacct: Account blkio completion on the correct task
authorJosh Snyder <joshs@netflix.com>
Mon, 18 Dec 2017 16:15:10 +0000 (16:15 +0000)
committerIngo Molnar <mingo@kernel.org>
Tue, 16 Jan 2018 02:29:36 +0000 (03:29 +0100)
commit2ba5bfbb4ab069e97680ccb3dfebcabdef39a73c
tree84feeca0e7b0819b55216e1fea50a3e0e79d445b
parentec7bafaec0d4384e040fa62714e4d6220f837d23
delayacct: Account blkio completion on the correct task

Before commit:

  07b3b0888c37 ("sched/core: move IO scheduling accounting from io_schedule_timeout() into scheduler")

delayacct_blkio_end() was called after context-switching into the task which
completed I/O.

This resulted in double counting: the task would account a delay both waiting
for I/O and for time spent in the runqueue.

With 07b3b0888c37, delayacct_blkio_end() is called by try_to_wake_up().
In ttwu, we have not yet context-switched. This is more correct, in that
the delay accounting ends when the I/O is complete.

But delayacct_blkio_end() relies on 'get_current()', and we have not yet
context-switched into the task whose I/O completed. This results in the
wrong task having its delay accounting statistics updated.

Instead of doing that, pass the task_struct being woken to delayacct_blkio_end(),
so that it can update the statistics of the correct task.

Signed-off-by: Josh Snyder <joshs@netflix.com>
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Balbir Singh <bsingharora@gmail.com>
Cc: <stable@vger.kernel.org>
Cc: Brendan Gregg <bgregg@netflix.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-block@vger.kernel.org
Fixes: 07b3b0888c37 ("sched/core: move IO scheduling accounting from io_schedule_timeout() into scheduler")
Link: http://lkml.kernel.org/r/1513613712-571-1-git-send-email-joshs@netflix.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/delayacct.h
kernel/delayacct.c
kernel/sched/core.c