From patchwork Thu Sep 24 19:25:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Goyal X-Patchwork-Id: 50032 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 n8OJgNwq004906 for ; Thu, 24 Sep 2009 19:42:23 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 74A6A61AB16; Thu, 24 Sep 2009 15:33:30 -0400 (EDT) Received: from int-mx02.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 n8OJPa3r006035 for ; Thu, 24 Sep 2009 15:25:36 -0400 Received: from machine.usersys.redhat.com (dhcp-100-19-148.bos.redhat.com [10.16.19.148]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8OJPZdI007098; Thu, 24 Sep 2009 15:25:36 -0400 Received: by machine.usersys.redhat.com (Postfix, from userid 10451) id B40AA267EB; Thu, 24 Sep 2009 15:25:33 -0400 (EDT) From: Vivek Goyal To: linux-kernel@vger.kernel.org, jens.axboe@oracle.com Date: Thu, 24 Sep 2009 15:25:32 -0400 Message-Id: <1253820332-10246-29-git-send-email-vgoyal@redhat.com> In-Reply-To: <1253820332-10246-1-git-send-email-vgoyal@redhat.com> References: <1253820332-10246-1-git-send-email-vgoyal@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.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, guijianfeng@cn.fujitsu.com, fernando@oss.ntt.co.jp, mikew@google.com, jmoyer@redhat.com, nauman@google.com, mingo@elte.hu, vgoyal@redhat.com, m-ikeda@ds.jp.nec.com, riel@redhat.com, lizf@cn.fujitsu.com, fchecconi@gmail.com, s-uchida@ap.jp.nec.com, containers@lists.linux-foundation.org, akpm@linux-foundation.org, righi.andrea@gmail.com, torvalds@linux-foundation.org Subject: [dm-devel] [PATCH 28/28] io-controller: debug elevator fair queuing support 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 o More debugging help to debug elevator fair queuing support. Enabled under CONFIG_DEBUG_ELV_FAIR_QUEUING. Currently it prints vdisktime related trace messages in blktrace. Signed-off-by: Vivek Goyal Acked-by: Rik van Riel --- block/Kconfig.iosched | 9 +++++++++ block/elevator-fq.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletions(-) diff --git a/block/Kconfig.iosched b/block/Kconfig.iosched index 8b507c4..edcd317 100644 --- a/block/Kconfig.iosched +++ b/block/Kconfig.iosched @@ -15,6 +15,15 @@ config ELV_FAIR_QUEUING other ioschedulers can make use of it. If unsure, say N. +config DEBUG_ELV_FAIR_QUEUING + bool "Debug elevator fair queuing" + depends on ELV_FAIR_QUEUING + default n + ---help--- + Enable some debugging hooks for elevator fair queuing support. + Currently it just outputs more information about vdisktime in + blktrace output . + config IOSCHED_NOOP bool default y diff --git a/block/elevator-fq.c b/block/elevator-fq.c index e69de98..62691c6 100644 --- a/block/elevator-fq.c +++ b/block/elevator-fq.c @@ -37,6 +37,24 @@ static int elv_ioq_wait_busy = HZ / 125; static void check_idle_tree_release(struct io_service_tree *st); +#ifdef CONFIG_DEBUG_ELV_FAIR_QUEUING +#define elv_log_entity(entity, fmt, args...) \ +{ \ +{ \ + struct io_queue *ioq = ioq_of(entity); \ + struct io_group *iog = iog_of(entity); \ + \ + if (ioq) { \ + elv_log_ioq(ioq->efqd, ioq, fmt, ##args); \ + } else { \ + elv_log_iog((struct elv_fq_data *)iog->key, iog, fmt, ##args);\ + } \ +} \ +} +#else +#define elv_log_entity(entity, fmt, args...) +#endif + static inline struct io_queue *ioq_of(struct io_entity *entity) { if (entity->my_sd == NULL) @@ -435,6 +453,26 @@ static inline void debug_update_stats_enqueue(struct io_entity *entity) {} static inline void debug_update_stats_dequeue(struct io_entity *entity) {} #endif /* DEBUG_GROUP_IOSCHED */ +#ifdef CONFIG_DEBUG_ELV_FAIR_QUEUING +static inline void debug_entity_vdisktime(struct io_entity *entity, + unsigned long served, u64 delta) +{ + struct elv_fq_data *efqd; + struct io_group *iog; + + elv_log_entity(entity, "vdisktime=%llu service=%lu delta=%llu" + " entity->weight=%u", entity->vdisktime, + served, delta, entity->weight); + + iog = iog_of(parent_entity(entity)); + efqd = iog->key; + elv_log_iog(efqd, iog, "min_vdisktime=%llu", entity->st->min_vdisktime); +} +#else /* DEBUG_ELV_FAIR_QUEUING */ +static inline void debug_entity_vdisktime(struct io_entity *entity, + unsigned long served, u64 delta) {} +#endif /* DEBUG_ELV_FAIR_QUEUING */ + static void entity_served(struct io_entity *entity, unsigned long served, unsigned long queue_charge, unsigned long group_charge, unsigned long nr_sectors) @@ -442,10 +480,14 @@ static void entity_served(struct io_entity *entity, unsigned long served, unsigned long charge = queue_charge; for_each_entity(entity) { - entity->vdisktime += elv_delta_fair(charge, entity); + u64 delta; + + delta = elv_delta_fair(charge, entity); + entity->vdisktime += delta; update_min_vdisktime(entity->st); entity->total_time += served; entity->total_sectors += nr_sectors; + debug_entity_vdisktime(entity, charge, delta); /* Group charge can be different from queue charge */ charge = group_charge; } @@ -499,6 +541,9 @@ static void place_entity(struct io_service_tree *st, struct io_entity *entity, vdisktime = st->min_vdisktime; done: entity->vdisktime = max_vdisktime(st->min_vdisktime, vdisktime); + elv_log_entity(entity, "place_entity: vdisktime=%llu" + " min_vdisktime=%llu", entity->vdisktime, + st->min_vdisktime); } static inline void io_entity_update_prio(struct io_entity *entity)