LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* How does CFQ handle the fairness of process write
@ 2011-01-23  0:49 Yuehai Xu
  2011-01-24  8:32 ` Nauman Rafique
  0 siblings, 1 reply; 2+ messages in thread
From: Yuehai Xu @ 2011-01-23  0:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jens Axboe, yhxu

Hi all,

Suppose there are two processes writing lots of data to disk, these
data are written to cache at first, and then, kernel threads might
flush them to disk later. However, from the point of block device, the
kernel thread is just another process that issues write requests. So,
how does CFQ handle the fairness between the two processes? It is
impossible for CFQ to keep the fairness of the two queues for each
process since many write requests are dispatched by kernel thread,
which has another queue in CFQ. And both the requests from two
processes are mixed together in this kernel thread queue.

Is this description correct? In that case, how does CFQ keep the
fairness for two processes since CFQ seems unable to know the exact
process the request belongs to.

I appreciate your help.

Thanks,
Yuehai

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

* Re: How does CFQ handle the fairness of process write
  2011-01-23  0:49 How does CFQ handle the fairness of process write Yuehai Xu
@ 2011-01-24  8:32 ` Nauman Rafique
  0 siblings, 0 replies; 2+ messages in thread
From: Nauman Rafique @ 2011-01-24  8:32 UTC (permalink / raw)
  To: Yuehai Xu; +Cc: linux-kernel, Jens Axboe, yhxu

Yuehai,
You have got it right. CFQ is not able to attribute writes to the
threads which actually submit the writes, unless the writes are done
in a synchronous mode (the ones coming through fsync, etc) or in
O_DIRECT mode where the writes are submitted in the context of the
thread itself.

Some attempts have been made in the past to help with this problem. In
the patch series at http://lkml.org/lkml/2010/7/8/478, Munehiro Ikeda
added support for tracking the cgroup (not thread) of the writer
threads, but the patches were not merged. You can read the discussion
there to find out the objections to getting the patches merged (which
I don't necessarily agree with).Tracking the actual thread (instead of
cgroup) of the writer would be the next logical step after those
patches are merged.

In summary, it is a known problem, and hopefully would get fixed one day.

On Sun, Jan 23, 2011 at 9:49 AM, Yuehai Xu <yuehaixu@gmail.com> wrote:
> Hi all,
>
> Suppose there are two processes writing lots of data to disk, these
> data are written to cache at first, and then, kernel threads might
> flush them to disk later. However, from the point of block device, the
> kernel thread is just another process that issues write requests. So,
> how does CFQ handle the fairness between the two processes? It is
> impossible for CFQ to keep the fairness of the two queues for each
> process since many write requests are dispatched by kernel thread,
> which has another queue in CFQ. And both the requests from two
> processes are mixed together in this kernel thread queue.
>
> Is this description correct? In that case, how does CFQ keep the
> fairness for two processes since CFQ seems unable to know the exact
> process the request belongs to.
>
> I appreciate your help.
>
> Thanks,
> Yuehai
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

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

end of thread, other threads:[~2011-01-24  8:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-23  0:49 How does CFQ handle the fairness of process write Yuehai Xu
2011-01-24  8:32 ` Nauman Rafique

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).