mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 21:51:05 +00:00
delayacct: Account blkio completion on the correct task
Before commit:e33a9bba85
("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. Withe33a9bba85
, 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:e33a9bba85
("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>
This commit is contained in:
parent
a8750ddca9
commit
c96f5471ce
3 changed files with 33 additions and 23 deletions
|
@ -71,7 +71,7 @@ extern void delayacct_init(void);
|
|||
extern void __delayacct_tsk_init(struct task_struct *);
|
||||
extern void __delayacct_tsk_exit(struct task_struct *);
|
||||
extern void __delayacct_blkio_start(void);
|
||||
extern void __delayacct_blkio_end(void);
|
||||
extern void __delayacct_blkio_end(struct task_struct *);
|
||||
extern int __delayacct_add_tsk(struct taskstats *, struct task_struct *);
|
||||
extern __u64 __delayacct_blkio_ticks(struct task_struct *);
|
||||
extern void __delayacct_freepages_start(void);
|
||||
|
@ -122,10 +122,10 @@ static inline void delayacct_blkio_start(void)
|
|||
__delayacct_blkio_start();
|
||||
}
|
||||
|
||||
static inline void delayacct_blkio_end(void)
|
||||
static inline void delayacct_blkio_end(struct task_struct *p)
|
||||
{
|
||||
if (current->delays)
|
||||
__delayacct_blkio_end();
|
||||
__delayacct_blkio_end(p);
|
||||
delayacct_clear_flag(DELAYACCT_PF_BLKIO);
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ static inline void delayacct_tsk_free(struct task_struct *tsk)
|
|||
{}
|
||||
static inline void delayacct_blkio_start(void)
|
||||
{}
|
||||
static inline void delayacct_blkio_end(void)
|
||||
static inline void delayacct_blkio_end(struct task_struct *p)
|
||||
{}
|
||||
static inline int delayacct_add_tsk(struct taskstats *d,
|
||||
struct task_struct *tsk)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue