Re: /proc/stat iowait?, io_schedule()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for the response.

OK, so it seems like if you call io_schedule, then the kernel takes
idle time and accumulates that into io_wait if the count of # of
threads currently blocked in that mode is >= 1. So, to get total idle
time you need to add io_wait and idle (which I see being done in
Bootchart java code). Presumably then, large io_wait times could
indicate that you are IO bound - good to know.

But, it would seem then that any code that has this kind of blocking
IO operations then would need to use io_schedule and not any of the
other kernel synchronization primitives then because the regular
primitives (completions) wouldn't use io_schedule(), they would just
use schedule()? If so, that seems like a drag since its not likely
that all such blocking time would really be accounted for?



On Mon, Mar 30, 2009 at 12:47 AM, Mulyadi Santosa
<mulyadi.santosa@xxxxxxxxx> wrote:
> Hi...
>
> On Mon, Mar 30, 2009 at 4:55 AM, David Neiss <davidaneiss@xxxxxxxxx> wrote:
>> So, having kernel code which does:
>>
>> set_current_state(TASK_INTERRUPTIBLE);
>> schedule();
>>
>> causes blocking, as expected, and /proc/stat shows increasing idle
>> task time and non increasing io wait time. Fine.
>>
>> Changing schedule() to io_schedule(), time now seems to be split
>> between idle task and io_wait time.
>>
>> Question, why does the system impute any running time to io_wait time?
>>  The task that got blocked is presumably not doing anything and just
>> sitting there inactive until it gets woken up, so I would expect just
>> idle time to be increasing. I know its trying to account for io_wait
>> time, but how does it know how many jiffies to be adding to io_wait
>> time? Googling on io_wait and/or io_schedule are not turning up much.
>> So, I'm obviously not understanding things here. Any input?
>
> Interesting, never thought about it before. As usual, lxr help us to
> locate the related function:
> void __sched io_schedule(void)
> {
>        struct rq *rq = &__raw_get_cpu_var(runqueues);
>
>        delayacct_blkio_start();
>        atomic_inc(&rq->nr_iowait);
>        schedule();
>        atomic_dec(&rq->nr_iowait);
>        delayacct_blkio_end();
> }
>
> further checking of delayacct_blkio_start roughly tells me that it
> starts to account for io_wait. So that's the answer, this is the
> function that does the accounting.
>
> However, due to the way time accounting done in Linux (in every
> ticks), there could be imprecisionness.
>
> regards,
>
> Mulyadi.
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux