From patchwork Sat Oct 3 05:56:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Galbraith X-Patchwork-Id: 51503 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n936qioA023656 for ; Sat, 3 Oct 2009 06:52:44 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id CF4F16198D7; Sat, 3 Oct 2009 02:52:43 -0400 (EDT) Received: from int-mx01.intmail.prod.int.phx2.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n936qggk003661 for ; Sat, 3 Oct 2009 02:52:42 -0400 Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.12]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n936lwAg027351 for ; Sat, 3 Oct 2009 02:52:41 -0400 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.redhat.com (8.13.8/8.13.8) with SMTP id n935uQtp024110 for ; Sat, 3 Oct 2009 01:56:27 -0400 Received: (qmail invoked by alias); 03 Oct 2009 05:56:24 -0000 Received: from p4FE1941A.dip0.t-ipconnect.de (EHLO [192.168.178.27]) [79.225.148.26] by mail.gmx.net (mp008) with SMTP; 03 Oct 2009 07:56:24 +0200 X-Authenticated: #14349625 X-Provags-ID: V01U2FsdGVkX18VIctGB7sVpRnyNCEaN1NKZEkTUaY1OzIPumtY0r 95kO8eotZPFTCG From: Mike Galbraith To: Jens Axboe In-Reply-To: <1254548931.8299.18.camel@marge.simson.net> References: <20091002092839.GA26962@kernel.dk> <20091002145610.GD31616@kernel.dk> <20091002171129.GG31616@kernel.dk> <20091002172046.GA2376@elte.hu> <20091002172554.GJ31616@kernel.dk> <20091002172842.GA4884@elte.hu> <20091002173732.GK31616@kernel.dk> <1254507215.8667.7.camel@marge.simson.net> <20091002181903.GN31616@kernel.dk> <1254548931.8299.18.camel@marge.simson.net> Date: Sat, 03 Oct 2009 07:56:18 +0200 Message-Id: <1254549378.8299.21.camel@marge.simson.net> Mime-Version: 1.0 X-Y-GMX-Trusted: 0 X-FuHaFi: 0.41 X-RedHat-Spam-Score: -0.919 (AWL) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.12 X-loop: dm-devel@redhat.com Cc: dhaval@linux.vnet.ibm.com, peterz@infradead.org, dm-devel@redhat.com, dpshah@google.com, agk@redhat.com, balbir@linux.vnet.ibm.com, paolo.valente@unimore.it, jmarchan@redhat.com, fernando@oss.ntt.co.jp, Ulrich Lukas , mikew@google.com, jmoyer@redhat.com, nauman@google.com, Ingo Molnar , Vivek Goyal , m-ikeda@ds.jp.nec.com, riel@redhat.com, lizf@cn.fujitsu.com, fchecconi@gmail.com, containers@lists.linux-foundation.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, righi.andrea@gmail.com, Linus Torvalds Subject: [dm-devel] Re: IO scheduler based IO controller V10 X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com Index: linux-2.6/block/cfq-iosched.c =================================================================== --- linux-2.6.orig/block/cfq-iosched.c +++ linux-2.6/block/cfq-iosched.c @@ -174,6 +174,9 @@ struct cfq_data { unsigned int cfq_slice_async_rq; unsigned int cfq_slice_idle; unsigned int cfq_desktop; + unsigned int cfq_desktop_dispatch; + + unsigned long desktop_dispatch_ts; struct list_head cic_list; @@ -1283,6 +1286,7 @@ static int cfq_dispatch_requests(struct struct cfq_data *cfqd = q->elevator->elevator_data; struct cfq_queue *cfqq; unsigned int max_dispatch; + unsigned long delay; if (!cfqd->busy_queues) return 0; @@ -1297,19 +1301,26 @@ static int cfq_dispatch_requests(struct /* * Drain async requests before we start sync IO */ - if (cfq_cfqq_idle_window(cfqq) && cfqd->rq_in_driver[BLK_RW_ASYNC]) + if (cfq_cfqq_idle_window(cfqq) && cfqd->rq_in_driver[BLK_RW_ASYNC]) { + cfqd->desktop_dispatch_ts = jiffies; return 0; + } /* * If this is an async queue and we have sync IO in flight, let it wait */ - if (cfqd->sync_flight && !cfq_cfqq_sync(cfqq)) + if (cfqd->sync_flight && !cfq_cfqq_sync(cfqq)) { + cfqd->desktop_dispatch_ts = jiffies; return 0; + } max_dispatch = cfqd->cfq_quantum; if (cfq_class_idle(cfqq)) max_dispatch = 1; + if (cfqd->busy_queues > 1) + cfqd->desktop_dispatch_ts = jiffies; + /* * Does this cfqq already have too much IO in flight? */ @@ -1327,6 +1338,16 @@ static int cfq_dispatch_requests(struct return 0; /* + * Don't start overloading until we've been alone for a bit. + */ + if (cfqd->cfq_desktop_dispatch) { + delay = cfqd->desktop_dispatch_ts + cfq_slice_sync; + + if (time_before(jiffies, max_delay)) + return 0; + } + + /* * we are the only queue, allow up to 4 times of 'quantum' */ if (cfqq->dispatched >= 4 * max_dispatch) @@ -1942,7 +1963,7 @@ static void cfq_update_idle_window(struct cfq_data *cfqd, struct cfq_queue *cfqq, struct cfq_io_context *cic) { - int old_idle, enable_idle; + int old_idle, enable_idle, seeky = 0; /* * Don't idle for async or idle io prio class @@ -1950,10 +1971,20 @@ cfq_update_idle_window(struct cfq_data * if (!cfq_cfqq_sync(cfqq) || cfq_class_idle(cfqq)) return; + if (cfqd->hw_tag) { + if (CIC_SEEKY(cic)) + seeky = 1; + /* + * If seeky or incalculable seekiness, delay overloading. + */ + if (seeky || !sample_valid(cic->seek_samples)) + cfqd->desktop_dispatch_ts = jiffies; + } + enable_idle = old_idle = cfq_cfqq_idle_window(cfqq); if (!atomic_read(&cic->ioc->nr_tasks) || !cfqd->cfq_slice_idle || - (!cfqd->cfq_desktop && cfqd->hw_tag && CIC_SEEKY(cic))) + (!cfqd->cfq_desktop && seeky)) enable_idle = 0; else if (sample_valid(cic->ttime_samples)) { if (cic->ttime_mean > cfqd->cfq_slice_idle) @@ -2483,6 +2514,9 @@ static void *cfq_init_queue(struct reque cfqd->cfq_slice_async_rq = cfq_slice_async_rq; cfqd->cfq_slice_idle = cfq_slice_idle; cfqd->cfq_desktop = 1; + cfqd->cfq_desktop_dispatch = 1; + + cfqd->desktop_dispatch_ts = INITIAL_JIFFIES; cfqd->hw_tag = 1; return cfqd; @@ -2553,6 +2587,7 @@ SHOW_FUNCTION(cfq_slice_sync_show, cfqd- SHOW_FUNCTION(cfq_slice_async_show, cfqd->cfq_slice[0], 1); SHOW_FUNCTION(cfq_slice_async_rq_show, cfqd->cfq_slice_async_rq, 0); SHOW_FUNCTION(cfq_desktop_show, cfqd->cfq_desktop, 0); +SHOW_FUNCTION(cfq_desktop_dispatch_show, cfqd->cfq_desktop_dispatch, 0); #undef SHOW_FUNCTION #define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX, __CONV) \ @@ -2585,6 +2620,7 @@ STORE_FUNCTION(cfq_slice_async_store, &c STORE_FUNCTION(cfq_slice_async_rq_store, &cfqd->cfq_slice_async_rq, 1, UINT_MAX, 0); STORE_FUNCTION(cfq_desktop_store, &cfqd->cfq_desktop, 0, 1, 0); +STORE_FUNCTION(cfq_desktop_dispatch_store, &cfqd->cfq_desktop_dispatch, 0, 1, 0); #undef STORE_FUNCTION #define CFQ_ATTR(name) \ @@ -2601,6 +2637,7 @@ static struct elv_fs_entry cfq_attrs[] = CFQ_ATTR(slice_async_rq), CFQ_ATTR(slice_idle), CFQ_ATTR(desktop), + CFQ_ATTR(desktop_dispatch), __ATTR_NULL };