mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC] blkio_delay_total is calculated mistakenly
@ 2017-02-15  1:27 Weiwei Jia
  2017-02-15  3:00 ` Greg KH
  2017-03-02 13:51 ` Weiwei Jia
  0 siblings, 2 replies; 4+ messages in thread
From: Weiwei Jia @ 2017-02-15  1:27 UTC (permalink / raw)
  To: gregkh, bsingharora; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 909 bytes --]

Hi,

When I read Linux Kernel source codes about how "blkio_delay_total"
(delay waiting for synchronous block I/O to complete for one task) is
calculated in Linux/kernel/delayacct.c file [1], I find that
"blkio_delay_total" adds "task->delays->blkio_delay" to be the total
delay time for one task to wait for synchronous I/O dynamically but
"tsk->delays->blkio_delay" has already been calculated as the total
delay time that one task is waiting for synchronous I/O [2]
dynamically. I think "blkio_delay_total" should not add
"task->delays->blkio_delay" since "task->delays->blkio_delay" is
already the total delay time we want.

Am I missing anything?

BTW, the patch in the attachment may solve this problem if I don't
miss anything. Thank you.


[1] http://lxr.free-electrons.com/source/kernel/delayacct.c?v=4.7#L121
[2] http://lxr.free-electrons.com/source/kernel/delayacct.c?v=4.7#L52

Thanks,
Weiwei Jia

[-- Attachment #2: 0001-fix-the-mistake-blkio_delay_total-calculation-way.patch --]
[-- Type: text/x-patch, Size: 983 bytes --]

From 8c290bce66f0ef2b117c8f47a13bbf2d80c500f0 Mon Sep 17 00:00:00 2001
From: Weiwei Jia <harryxiyou@gmail.com>
Date: Tue, 14 Feb 2017 20:18:34 -0500
Subject: [PATCH] fix the mistake blkio_delay_total calculation way

Signed-off-by: Weiwei Jia <harryxiyou@gmail.com>

---
 kernel/delayacct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/delayacct.c b/kernel/delayacct.c
index 435c14a..0d8a6cc 100644
--- a/kernel/delayacct.c
+++ b/kernel/delayacct.c
@@ -118,7 +118,7 @@ int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk)
 	/* zero XXX_total, non-zero XXX_count implies XXX stat overflowed */
 
 	spin_lock_irqsave(&tsk->delays->lock, flags);
-	tmp = d->blkio_delay_total + tsk->delays->blkio_delay;
+	tmp = tsk->delays->blkio_delay;
 	d->blkio_delay_total = (tmp < d->blkio_delay_total) ? 0 : tmp;
 	tmp = d->swapin_delay_total + tsk->delays->swapin_delay;
 	d->swapin_delay_total = (tmp < d->swapin_delay_total) ? 0 : tmp;
-- 
2.1.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-02 14:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-15  1:27 [RFC] blkio_delay_total is calculated mistakenly Weiwei Jia
2017-02-15  3:00 ` Greg KH
2017-02-15  3:12   ` Weiwei Jia
2017-03-02 13:51 ` Weiwei Jia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®