From: Balbir Singh <balbir-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: "Fernando Luis Vázquez Cao"
<fernando-gVGce1chcLdL9jVzuh4AOg@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: RFC: Attaching threads to cgroups is OK?
Date: Thu, 21 Aug 2008 15:58:55 +0530 [thread overview]
Message-ID: <48AD4367.9000409@linux.vnet.ibm.com> (raw)
In-Reply-To: <1219296306.28324.82.camel-xpvPi5bcW5X5OjGIXfuPlhrrLbDL3r4M6qtp775pBPw@public.gmane.org>
Fernando Luis Vázquez Cao wrote:
> Hi Balbir,
>
> On Thu, 2008-08-21 at 09:02 +0530, Balbir Singh wrote:
>> Fernando Luis Vázquez Cao wrote:
>>> On Wed, 2008-08-20 at 20:48 +0900, Hirokazu Takahashi wrote:
>>>> Hi,
>>>>
>>>>>> Tsuruta-san, how about your bio-cgroup's tracking concerning this?
>>>>>> If we want to use your tracking functions for each threads seperately,
>>>>>> there seems to be a problem.
>>>>>> ===cf. mm_get_bio_cgroup()===================
>>>>>> owner
>>>>>> mm_struct ----> task_struct ----> bio_cgroup
>>>>>> =============================================
>>>>>> In my understanding, the mm_struct of a thread is same as its parent's.
>>>>>> So, even if we attach the TIDs of some threads to different cgroups the
>>>>>> tracking always returns the same bio_cgroup -- its parent's group.
>>>>>> Do you have some policy about in which case we can use your tracking?
>>>>>>
>>>>> It's will be resitriction when io-controller reuse information of the owner
>>>>> of memory. But if it's very clear who issues I/O (by tracking read/write
>>>>> syscall), we may have chance to record the issuer of I/O to page_cgroup
>>>>> struct.
>>>> This might be slightly different topic though,
>>>> I've been thinking where we should add hooks to track I/O reqeust.
>>>> I think the following set of hooks is enough whether we are going to
>>>> support thread based cgroup or not.
>>>>
>>>> Hook-1: called when allocating a page, where the memory controller
>>>> already have a hoook.
>>>> Hook-2: called when making a page in page-cache dirty.
>>>>
>>>> For anonymous pages, Hook-1 is enough to track any type of I/O request.
>>>> For pages in page-cache, Hook-1 is also enough for read I/O because
>>>> the I/O is issued just once right after allocting the page.
>>>> For write I/O requests to pages in page-cache, Hook-1 will be okay
>>>> in most cases but sometimes process in another cgroup may write
>>>> the pages. In this case, Hook-2 is needed to keep accurate to track
>>>> I/O requests.
>>> This relative simplicity is what prompted me to say that we probably
>>> should try to disentangle the io tracking functionality from the memory
>>> controller a bit more (of course we still should reuse as much as we can
>>> from it). The rationale for this is that the existing I/O scheduler
>>> would benefit from proper io tracking capabilities too, so it'd be nice
>>> if we could have them even in non-cgroup-capable kernels.
>>>
>> Hook 2 referred to in the mail above exist today in the form of task IO accounting.
> Yup.
>
>>> As an aside, when the IO context of a certain IO operation is known
>>> (synchronous IO comes to mind) I think it should be cashed in the
>>> resulting bio so that we can do without the expensive accesses to
>>> bio_cgroup once it enters the block layer.
>> Will this give you everything you need for accounting and control (from the
>> block layer?)
>
> Well, it depends on what you are trying to achieve.
>
> Current IO schedulers such as CFQ only care about the io_context when
> scheduling requests. When a new request comes in CFQ assumes that it was
> originated in the context of the current task, which obviously does not
> hold true for buffered IO and aio. This problem could be solved by using
> bio-cgroup for IO tracking, but accessing the io context information is
> somewhat expensive:
>
> page->page_cgroup->bio_cgroup->io_context.
>
> If at the time of building a bio we know its io context (i.e. the
> context of the task or cgroup that generated that bio) I think we should
> store it in the bio itself, too. With this scheme, whenever the kernel
> needs to know the io_context of a particular block IO operation the
> kernel would first try to retrieve its io_context directly from the bio,
> and, if not available there, would resort to the slow path (accessing it
> through bio_cgroup). My gut feeling is that elevator-based IO resource
> controllers would benefit from such an approach, too.
>
> - Fernando
OK, that seems to make sense. Thanks for explaining.
--
Balbir
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
next prev parent reply other threads:[~2008-08-21 10:28 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-19 10:38 RFC: Attaching threads to cgroups is OK? Takuya Yoshikawa
2008-08-19 11:22 ` KAMEZAWA Hiroyuki
[not found] ` <48AAA296.8050802-gVGce1chcLdL9jVzuh4AOg@public.gmane.org>
2008-08-19 11:22 ` KAMEZAWA Hiroyuki
[not found] ` <20080819202237.edd75933.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-08-19 12:27 ` Balbir Singh
[not found] ` <48AABC31.7070207-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2008-08-19 12:52 ` Fernando Luis Vázquez Cao
[not found] ` <1219150334.14590.12.camel-xpvPi5bcW5X5OjGIXfuPlhrrLbDL3r4M6qtp775pBPw@public.gmane.org>
2008-08-20 7:12 ` Hirokazu Takahashi
[not found] ` <20080820.161247.64324924.taka-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org>
2008-08-20 8:43 ` KAMEZAWA Hiroyuki
2008-08-20 8:43 ` KAMEZAWA Hiroyuki
2008-08-22 1:03 ` Takuya Yoshikawa
[not found] ` <20080820174334.a566a775.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-08-22 1:03 ` Takuya Yoshikawa
2008-08-20 7:12 ` Hirokazu Takahashi
2008-08-20 5:52 ` Takuya Yoshikawa
2008-08-19 12:52 ` Fernando Luis Vázquez Cao
2008-08-20 5:52 ` Takuya Yoshikawa
2008-08-20 11:48 ` Hirokazu Takahashi
[not found] ` <20080820.204832.131207708.taka-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org>
2008-08-21 3:08 ` Fernando Luis Vázquez Cao
2008-08-21 3:32 ` Balbir Singh
[not found] ` <1219288081.28324.30.camel-xpvPi5bcW5X5OjGIXfuPlhrrLbDL3r4M6qtp775pBPw@public.gmane.org>
2008-08-21 3:32 ` Balbir Singh
2008-08-21 5:25 ` Fernando Luis Vázquez Cao
[not found] ` <48ACE1B4.8010000-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2008-08-21 5:25 ` Fernando Luis Vázquez Cao
[not found] ` <1219296306.28324.82.camel-xpvPi5bcW5X5OjGIXfuPlhrrLbDL3r4M6qtp775pBPw@public.gmane.org>
2008-08-21 10:28 ` Balbir Singh [this message]
2008-08-22 18:55 ` Vivek Goyal
2008-08-25 10:36 ` Fernando Luis Vázquez Cao
[not found] ` <1219660569.16371.161.camel-xpvPi5bcW5X5OjGIXfuPlhrrLbDL3r4M6qtp775pBPw@public.gmane.org>
2008-09-05 11:50 ` Hirokazu Takahashi
2008-09-05 12:00 ` Hirokazu Takahashi
[not found] ` <20080905.205016.28412219.taka-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org>
2008-09-05 12:00 ` Hirokazu Takahashi
[not found] ` <20080905.210017.44596963.taka-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org>
2008-09-05 15:38 ` Vivek Goyal
2008-09-05 15:38 ` Vivek Goyal
2008-09-08 2:58 ` Takuya Yoshikawa
[not found] ` <20080905153832.GE13742-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-09-08 2:58 ` Takuya Yoshikawa
[not found] ` <48C494EB.4080502-gVGce1chcLdL9jVzuh4AOg@public.gmane.org>
2008-09-08 11:52 ` Hirokazu Takahashi
2008-09-08 11:52 ` Hirokazu Takahashi
2008-09-08 12:47 ` Hirokazu Takahashi
2008-09-08 12:47 ` Hirokazu Takahashi
2008-09-05 11:50 ` Hirokazu Takahashi
2008-09-12 18:57 ` Vivek Goyal
[not found] ` <20080822185527.GD27964-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-08-25 10:36 ` Fernando Luis Vázquez Cao
2008-09-12 18:57 ` Vivek Goyal
2008-08-21 10:28 ` Balbir Singh
2008-08-22 18:55 ` Vivek Goyal
2008-08-21 3:08 ` Fernando Luis Vázquez Cao
2008-08-19 12:27 ` Balbir Singh
2008-08-20 11:48 ` Hirokazu Takahashi
2008-08-20 7:41 ` Hirokazu Takahashi
2008-08-20 7:41 ` Hirokazu Takahashi
-- strict thread matches above, loose matches on Subject: below --
2008-08-19 10:38 Takuya Yoshikawa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48AD4367.9000409@linux.vnet.ibm.com \
--to=balbir-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=fernando-gVGce1chcLdL9jVzuh4AOg@public.gmane.org \
--cc=menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.