Linux Device Mapper development
 help / color / mirror / Atom feed
From: Andrea Righi <righi.andrea@gmail.com>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: Gui Jianfeng <guijianfeng@cn.fujitsu.com>,
	Nauman Rafique <nauman@google.com>,
	dpshah@google.com, lizf@cn.fujitsu.com, mikew@google.com,
	fchecconi@gmail.com, paolo.valente@unimore.it,
	jens.axboe@oracle.com, ryov@valinux.co.jp,
	fernando@oss.ntt.co.jp, s-uchida@ap.jp.nec.com,
	taka@valinux.co.jp, jmoyer@redhat.com, dhaval@linux.vnet.ibm.com,
	balbir@linux.vnet.ibm.com, linux-kernel@vger.kernel.org,
	containers@lists.linux-foundation.org, agk@redhat.com,
	dm-devel@redhat.com, snitzer@redhat.com, m-ikeda@ds.jp.nec.com,
	akpm@linux-foundation.org
Subject: Re: [PATCH] io-controller: Add io group reference handling for request
Date: Sun, 17 May 2009 12:26:06 +0200	[thread overview]
Message-ID: <20090517102604.GA4255@linux> (raw)
In-Reply-To: <20090515140643.GB19350@redhat.com>

On Fri, May 15, 2009 at 10:06:43AM -0400, Vivek Goyal wrote:
> On Fri, May 15, 2009 at 09:48:40AM +0200, Andrea Righi wrote:
> > On Fri, May 15, 2009 at 01:15:24PM +0800, Gui Jianfeng wrote:
> > > Vivek Goyal wrote:
> > > ...
> > > >  }
> > > > @@ -1462,20 +1462,27 @@ struct io_cgroup *get_iocg_from_bio(stru
> > > >  /*
> > > >   * Find the io group bio belongs to.
> > > >   * If "create" is set, io group is created if it is not already present.
> > > > + * If "curr" is set, io group is information is searched for current
> > > > + * task and not with the help of bio.
> > > > + *
> > > > + * FIXME: Can we assume that if bio is NULL then lookup group for current
> > > > + * task and not create extra function parameter ?
> > > >   *
> > > > - * Note: There is a narrow window of race where a group is being freed
> > > > - * by cgroup deletion path and some rq has slipped through in this group.
> > > > - * Fix it.
> > > >   */
> > > > -struct io_group *io_get_io_group_bio(struct request_queue *q, struct bio *bio,
> > > > -					int create)
> > > > +struct io_group *io_get_io_group(struct request_queue *q, struct bio *bio,
> > > > +					int create, int curr)
> > > 
> > >   Hi Vivek,
> > > 
> > >   IIUC we can get rid of curr, and just determine iog from bio. If bio is not NULL,
> > >   get iog from bio, otherwise get it from current task.
> > 
> > Consider also that get_cgroup_from_bio() is much more slow than
> > task_cgroup() and need to lock/unlock_page_cgroup() in
> > get_blkio_cgroup_id(), while task_cgroup() is rcu protected.
> > 
> 
> True.
> 
> > BTW another optimization could be to use the blkio-cgroup functionality
> > only for dirty pages and cut out some blkio_set_owner(). For all the
> > other cases IO always occurs in the same context of the current task,
> > and you can use task_cgroup().
> > 
> 
> Yes, may be in some cases we can avoid setting page owner. I will get
> to it once I have got functionality going well. In the mean time if
> you have a patch for it, it will be great.
> 
> > However, this is true only for page cache pages, for IO generated by
> > anonymous pages (swap) you still need the page tracking functionality
> > both for reads and writes.
> > 
> 
> Right now I am assuming that all the sync IO will belong to task
> submitting the bio hence use task_cgroup() for that. Only for async
> IO, I am trying to use page tracking functionality to determine the owner.
> Look at elv_bio_sync(bio).
> 
> You seem to be saying that there are cases where even for sync IO, we
> can't use submitting task's context and need to rely on page tracking
> functionlity? In case of getting page (read) from swap, will it not happen
> in the context of process who will take a page fault and initiate the
> swap read?

No, for example in read_swap_cache_async():

@@ -308,6 +309,7 @@ struct page *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask,
 		 */
 		__set_page_locked(new_page);
 		SetPageSwapBacked(new_page);
+		blkio_cgroup_set_owner(new_page, current->mm);
 		err = add_to_swap_cache(new_page, entry, gfp_mask & GFP_KERNEL);
 		if (likely(!err)) {
 			/*

This is a read, but the current task is not always the owner of this
swap cache page, because it's a readahead operation.

Anyway, this is a minor corner case I think. And probably it is safe to
consider this like any other read IO and get rid of the
blkio_cgroup_set_owner().

I wonder if it would be better to attach the blkio_cgroup to the
anonymous page only when swap-out occurs. I mean, just put the
blkio_cgroup_set_owner() hook in try_to_umap() in order to keep track of
the IO generated by direct reclaim of anon memory. For all the other
cases we can simply use the submitting task's context.

BTW, O_DIRECT is another case that is possible to optimize, because all
the bios generated by direct IO occur in the same context of the current
task.

-Andrea

  reply	other threads:[~2009-05-17 10:26 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1241553525-28095-1-git-send-email-vgoyal@redhat.com>
2009-05-05 19:58 ` [PATCH 01/18] io-controller: Documentation Vivek Goyal
2009-05-05 19:58 ` [PATCH 02/18] io-controller: Common flat fair queuing code in elevaotor layer Vivek Goyal
2009-05-05 19:58 ` [PATCH 03/18] io-controller: Charge for time slice based on average disk rate Vivek Goyal
2009-05-05 19:58 ` [PATCH 04/18] io-controller: Modify cfq to make use of flat elevator fair queuing Vivek Goyal
2009-05-05 19:58 ` [PATCH 05/18] io-controller: Common hierarchical fair queuing code in elevaotor layer Vivek Goyal
2009-05-05 19:58 ` [PATCH 06/18] io-controller: cfq changes to use " Vivek Goyal
2009-05-05 19:58 ` [PATCH 07/18] io-controller: Export disk time used and nr sectors dipatched through cgroups Vivek Goyal
2009-05-05 19:58 ` [PATCH 08/18] io-controller: idle for sometime on sync queue before expiring it Vivek Goyal
2009-05-05 19:58 ` [PATCH 09/18] io-controller: Separate out queue and data Vivek Goyal
2009-05-05 19:58 ` [PATCH 10/18] io-conroller: Prepare elevator layer for single queue schedulers Vivek Goyal
2009-05-05 19:58 ` [PATCH 11/18] io-controller: noop changes for hierarchical fair queuing Vivek Goyal
2009-05-05 19:58 ` [PATCH 12/18] io-controller: deadline " Vivek Goyal
2009-05-05 19:58 ` [PATCH 13/18] io-controller: anticipatory " Vivek Goyal
2009-05-05 19:58 ` [PATCH 14/18] blkio_cgroup patches from Ryo to track async bios Vivek Goyal
2009-05-05 19:58 ` [PATCH 15/18] io-controller: map async requests to appropriate cgroup Vivek Goyal
2009-05-05 19:58 ` [PATCH 16/18] io-controller: Per cgroup request descriptor support Vivek Goyal
2009-05-05 19:58 ` [PATCH 17/18] io-controller: IO group refcounting support Vivek Goyal
2009-05-05 19:58 ` [PATCH 18/18] io-controller: Debug hierarchical IO scheduling Vivek Goyal
     [not found] ` <1241553525-28095-1-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-05 20:24   ` IO scheduler based IO Controller V2 Andrew Morton
2009-05-05 22:20     ` Peter Zijlstra
2009-05-06  3:42       ` Balbir Singh
2009-05-06 10:20         ` Fabio Checconi
2009-05-06 17:10           ` Balbir Singh
2009-05-06 18:47         ` Divyesh Shah
2009-05-06 20:42         ` Andrea Righi
2009-05-06  2:33     ` Vivek Goyal
2009-05-06 17:59       ` Nauman Rafique
2009-05-06 20:07       ` Andrea Righi
2009-05-06 21:21         ` Vivek Goyal
     [not found]           ` <20090506212121.GI8180-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-06 22:02             ` Andrea Righi
2009-05-06 22:17               ` Vivek Goyal
2009-05-06 20:32       ` Vivek Goyal
2009-05-06 21:34         ` Andrea Righi
2009-05-06 21:52           ` Vivek Goyal
2009-05-06 22:35             ` Andrea Righi
2009-05-07  1:48               ` Ryo Tsuruta
2009-05-07  9:04             ` Andrea Righi
2009-05-07 12:22               ` Andrea Righi
2009-05-07 14:11               ` Vivek Goyal
     [not found]                 ` <20090507141126.GA9463-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-07 14:45                   ` Vivek Goyal
     [not found]                     ` <20090507144501.GB9463-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-07 15:36                       ` Vivek Goyal
     [not found]                         ` <20090507153642.GC9463-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-07 15:42                           ` Vivek Goyal
2009-05-07 22:19                         ` Andrea Righi
2009-05-08 18:09                           ` Vivek Goyal
2009-05-08 20:05                             ` Andrea Righi
2009-05-08 21:56                               ` Vivek Goyal
2009-05-09  9:22                                 ` Peter Zijlstra
2009-05-14 10:31                                 ` Andrea Righi
     [not found]                                 ` <20090508215618.GJ7293-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-14 16:43                                   ` Dhaval Giani
2009-05-07 22:40                     ` Andrea Righi
2009-05-07  0:18       ` Ryo Tsuruta
     [not found]         ` <20090507.091858.226775723.ryov-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org>
2009-05-07  1:25           ` Vivek Goyal
2009-05-11 11:23             ` Ryo Tsuruta
     [not found]               ` <20090511.202309.112614168.ryov-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org>
2009-05-11 12:49                 ` Vivek Goyal
2009-05-08 14:24         ` Rik van Riel
2009-05-11 10:11           ` Ryo Tsuruta
2009-05-06  3:41     ` Balbir Singh
2009-05-06 13:28       ` Vivek Goyal
     [not found] ` <1241553525-28095-2-git-send-email-vgoyal@redhat.com>
2009-05-06  3:16   ` [PATCH 01/18] io-controller: Documentation Gui Jianfeng
2009-05-06 13:31     ` Vivek Goyal
2009-05-06  8:11 ` IO scheduler based IO Controller V2 Gui Jianfeng
     [not found]   ` <4A014619.1040000-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-05-06 16:10     ` Vivek Goyal
2009-05-07  5:36       ` Li Zefan
     [not found]         ` <4A027348.6000808-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-05-08 13:37           ` Vivek Goyal
2009-05-11  2:59             ` Gui Jianfeng
2009-05-07  5:47       ` Gui Jianfeng
     [not found] ` <1241553525-28095-19-git-send-email-vgoyal@redhat.com>
2009-05-06 21:40   ` [PATCH 18/18] io-controller: Debug hierarchical IO scheduling IKEDA, Munehiro
     [not found]     ` <4A0203DB.1090809-MDRzhb/z0dd8UrSeD/g0lQ@public.gmane.org>
2009-05-06 21:58       ` Vivek Goyal
     [not found]         ` <20090506215833.GK8180-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-06 22:19           ` IKEDA, Munehiro
     [not found]             ` <4A020CD5.2000308-MDRzhb/z0dd8UrSeD/g0lQ@public.gmane.org>
2009-05-06 22:24               ` Vivek Goyal
     [not found]                 ` <20090506222458.GM8180-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-06 23:01                   ` IKEDA, Munehiro
     [not found] ` <1241553525-28095-6-git-send-email-vgoyal@redhat.com>
2009-05-07  7:42   ` [PATCH 05/18] io-controller: Common hierarchical fair queuing code in elevaotor layer Gui Jianfeng
2009-05-07  8:05     ` Li Zefan
2009-05-08 12:45     ` Vivek Goyal
2009-05-08 21:09   ` Andrea Righi
2009-05-08 21:17     ` Vivek Goyal
     [not found] ` <1241553525-28095-18-git-send-email-vgoyal@redhat.com>
     [not found]   ` <1241553525-28095-18-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-08  2:59     ` [PATCH 17/18] io-controller: IO group refcounting support Gui Jianfeng
2009-05-08 12:44       ` Vivek Goyal
2009-05-08  9:45 ` [PATCH] io-controller: Add io group reference handling for request Gui Jianfeng
     [not found]   ` <4A03FF3C.4020506-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-05-08 13:57     ` Vivek Goyal
2009-05-08 17:41       ` Nauman Rafique
2009-05-08 18:56         ` Vivek Goyal
2009-05-08 19:06           ` Nauman Rafique
2009-05-11  1:33         ` Gui Jianfeng
2009-05-11 15:41           ` Vivek Goyal
     [not found]             ` <20090511154127.GD6036-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-15  5:15               ` Gui Jianfeng
2009-05-15  7:48                 ` Andrea Righi
2009-05-15  8:16                   ` Gui Jianfeng
     [not found]                     ` <4A0D24E6.6010807-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-05-15 14:09                       ` Vivek Goyal
2009-05-15 14:06                   ` Vivek Goyal
2009-05-17 10:26                     ` Andrea Righi [this message]
2009-05-18 14:01                       ` Vivek Goyal
2009-05-18 14:39                         ` Andrea Righi
2009-05-26 11:34                           ` Ryo Tsuruta
2009-05-27  6:56                             ` Ryo Tsuruta
2009-05-27  8:17                               ` Andrea Righi
2009-05-27 11:53                                 ` Ryo Tsuruta
2009-05-27 17:32                               ` Vivek Goyal
2009-05-19 12:18                         ` Ryo Tsuruta
2009-05-15  7:40               ` Gui Jianfeng
2009-05-15 14:01                 ` Vivek Goyal
2009-05-13  2:00 ` [PATCH] IO Controller: Add per-device weight and ioprio_class handling Gui Jianfeng
2009-05-13 14:44   ` Vivek Goyal
2009-05-14  0:59     ` Gui Jianfeng
2009-05-13 15:29   ` Vivek Goyal
2009-05-14  1:02     ` Gui Jianfeng
2009-05-13 15:59   ` Vivek Goyal
2009-05-14  1:51     ` Gui Jianfeng
2009-05-14  2:25     ` Gui Jianfeng
2009-05-13 17:17   ` Vivek Goyal
2009-05-14  1:24     ` Gui Jianfeng
2009-05-13 19:09   ` Vivek Goyal
2009-05-14  1:35     ` Gui Jianfeng
2009-05-14  7:26     ` Gui Jianfeng
2009-05-14 15:15       ` Vivek Goyal
2009-05-18 22:33       ` IKEDA, Munehiro
2009-05-20  1:44         ` Gui Jianfeng
     [not found]           ` <4A136090.5090705-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-05-20 15:41             ` IKEDA, Munehiro
     [not found] ` <1241553525-28095-8-git-send-email-vgoyal@redhat.com>
2009-05-13  2:39   ` [PATCH 07/18] io-controller: Export disk time used and nr sectors dipatched through cgroups Gui Jianfeng
2009-05-13 14:51     ` Vivek Goyal
2009-05-14  7:53       ` Gui Jianfeng
     [not found] ` <1241553525-28095-3-git-send-email-vgoyal@redhat.com>
2009-05-22  6:43   ` [PATCH 02/18] io-controller: Common flat fair queuing code in elevaotor layer Gui Jianfeng
2009-05-22 12:32     ` Vivek Goyal
2009-05-23 20:04       ` Jens Axboe
     [not found] ` <1241553525-28095-5-git-send-email-vgoyal@redhat.com>
2009-05-22  8:54   ` [PATCH 04/18] io-controller: Modify cfq to make use of flat elevator fair queuing Gui Jianfeng
2009-05-22 12:33     ` Vivek Goyal
     [not found] ` <1241553525-28095-9-git-send-email-vgoyal@redhat.com>
2009-05-13 15:00   ` [PATCH 08/18] io-controller: idle for sometime on sync queue before expiring it Vivek Goyal
2009-06-09  7:56   ` Gui Jianfeng
2009-06-09 17:51     ` Vivek Goyal
2009-06-10  1:30       ` Gui Jianfeng
2009-06-10 13:26         ` Vivek Goyal
2009-06-11  1:22           ` Gui Jianfeng

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=20090517102604.GA4255@linux \
    --to=righi.andrea@gmail.com \
    --cc=agk@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=dhaval@linux.vnet.ibm.com \
    --cc=dm-devel@redhat.com \
    --cc=dpshah@google.com \
    --cc=fchecconi@gmail.com \
    --cc=fernando@oss.ntt.co.jp \
    --cc=guijianfeng@cn.fujitsu.com \
    --cc=jens.axboe@oracle.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=m-ikeda@ds.jp.nec.com \
    --cc=mikew@google.com \
    --cc=nauman@google.com \
    --cc=paolo.valente@unimore.it \
    --cc=ryov@valinux.co.jp \
    --cc=s-uchida@ap.jp.nec.com \
    --cc=snitzer@redhat.com \
    --cc=taka@valinux.co.jp \
    --cc=vgoyal@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox