public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	containers@lists.linux-foundation.org, dm-devel@redhat.com,
	jens.axboe@oracle.com, nauman@google.com, dpshah@google.com,
	lizf@cn.fujitsu.com, mikew@google.com, fchecconi@gmail.com,
	paolo.valente@unimore.it, 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, righi.andrea@gmail.com,
	m-ikeda@ds.jp.nec.com, jbaron@redhat.com, agk@redhat.com,
	snitzer@redhat.com, akpm@linux-foundation.org,
	peterz@infradead.org
Subject: Re: [PATCH 04/19] io-controller: Modify cfq to make use of flat elevator fair queuing
Date: Mon, 15 Jun 2009 16:56:50 +0800	[thread overview]
Message-ID: <4A360CD2.8060707@cn.fujitsu.com> (raw)
In-Reply-To: <1244513342-11758-5-git-send-email-vgoyal@redhat.com>

Vivek Goyal wrote:
> This patch changes cfq to use fair queuing code from elevator layer.
> 
> Signed-off-by: Nauman Rafique <nauman@google.com>
> Signed-off-by: Fabio Checconi <fabio@gandalf.sssup.it>
> Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
> Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
> ---
>  block/Kconfig.iosched     |    3 +-
>  block/cfq-iosched.c       | 1097 +++++++++------------------------------------
>  include/linux/iocontext.h |    4 -
>  3 files changed, 219 insertions(+), 885 deletions(-)
> 
> diff --git a/block/Kconfig.iosched b/block/Kconfig.iosched
> index 3398134..dd5224d 100644
> --- a/block/Kconfig.iosched
> +++ b/block/Kconfig.iosched
> @@ -3,7 +3,7 @@ if BLOCK
>  menu "IO Schedulers"
>  
>  config ELV_FAIR_QUEUING
> -	bool "Elevator Fair Queuing Support"
> +	bool
>  	default n
>  	---help---
>  	  Traditionally only cfq had notion of multiple queues and it did
> @@ -46,6 +46,7 @@ config IOSCHED_DEADLINE
>  
>  config IOSCHED_CFQ
>  	tristate "CFQ I/O scheduler"
> +	select ELV_FAIR_QUEUING
>  	default y
>  	---help---
>  	  The CFQ I/O scheduler tries to distribute bandwidth equally
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index a55a9bd..f90c534 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -12,7 +12,6 @@
>  #include <linux/rbtree.h>
>  #include <linux/ioprio.h>
>  #include <linux/blktrace_api.h>
> -
>  /*
>   * tunables
>   */
> @@ -23,15 +22,7 @@ static const int cfq_fifo_expire[2] = { HZ / 4, HZ / 8 };
>  static const int cfq_back_max = 16 * 1024;
>  /* penalty of a backwards seek */
>  static const int cfq_back_penalty = 2;
> -static const int cfq_slice_sync = HZ / 10;
> -static int cfq_slice_async = HZ / 25;
>  static const int cfq_slice_async_rq = 2;
> -static int cfq_slice_idle = HZ / 125;
> -
> -/*
> - * offset from end of service tree
> - */
> -#define CFQ_IDLE_DELAY		(HZ / 5)
>  
>  /*
>   * below this threshold, we consider thinktime immediate
> @@ -43,7 +34,7 @@ static int cfq_slice_idle = HZ / 125;
>  
>  #define RQ_CIC(rq)		\
>  	((struct cfq_io_context *) (rq)->elevator_private)
> -#define RQ_CFQQ(rq)		(struct cfq_queue *) ((rq)->elevator_private2)
> +#define RQ_CFQQ(rq)	(struct cfq_queue *) (ioq_sched_queue((rq)->ioq))
>  
>  static struct kmem_cache *cfq_pool;
>  static struct kmem_cache *cfq_ioc_pool;
> @@ -53,8 +44,6 @@ static struct completion *ioc_gone;
>  static DEFINE_SPINLOCK(ioc_gone_lock);
>  
>  #define CFQ_PRIO_LISTS		IOPRIO_BE_NR
> -#define cfq_class_idle(cfqq)	((cfqq)->ioprio_class == IOPRIO_CLASS_IDLE)
> -#define cfq_class_rt(cfqq)	((cfqq)->ioprio_class == IOPRIO_CLASS_RT)
>  
>  #define sample_valid(samples)	((samples) > 80)
>  
> @@ -75,12 +64,6 @@ struct cfq_rb_root {
>   */
>  struct cfq_data {
>  	struct request_queue *queue;
> -
> -	/*
> -	 * rr list of queues with requests and the count of them
> -	 */
> -	struct cfq_rb_root service_tree;
> -
>  	/*
>  	 * Each priority tree is sorted by next_request position.  These
>  	 * trees are used when determining if two or more queues are
> @@ -88,39 +71,10 @@ struct cfq_data {
>  	 */
>  	struct rb_root prio_trees[CFQ_PRIO_LISTS];
>  
> -	unsigned int busy_queues;
> -	/*
> -	 * Used to track any pending rt requests so we can pre-empt current
> -	 * non-RT cfqq in service when this value is non-zero.
> -	 */
> -	unsigned int busy_rt_queues;
> -
> -	int rq_in_driver;
>  	int sync_flight;
>  
> -	/*
> -	 * queue-depth detection
> -	 */
> -	int rq_queued;
> -	int hw_tag;
> -	int hw_tag_samples;
> -	int rq_in_driver_peak;
> -
> -	/*
> -	 * idle window management
> -	 */
> -	struct timer_list idle_slice_timer;
> -	struct work_struct unplug_work;
> -
> -	struct cfq_queue *active_queue;
>  	struct cfq_io_context *active_cic;
>  
> -	/*
> -	 * async queue for each priority case
> -	 */
> -	struct cfq_queue *async_cfqq[2][IOPRIO_BE_NR];
> -	struct cfq_queue *async_idle_cfqq;
> -
>  	sector_t last_position;
>  	unsigned long last_end_request;
>  
> @@ -131,9 +85,7 @@ struct cfq_data {
>  	unsigned int cfq_fifo_expire[2];
>  	unsigned int cfq_back_penalty;
>  	unsigned int cfq_back_max;
> -	unsigned int cfq_slice[2];
>  	unsigned int cfq_slice_async_rq;
> -	unsigned int cfq_slice_idle;
>  
>  	struct list_head cic_list;
>  };
> @@ -142,16 +94,11 @@ struct cfq_data {
>   * Per process-grouping structure
>   */
>  struct cfq_queue {
> -	/* reference count */
> -	atomic_t ref;
> +	struct io_queue *ioq;
>  	/* various state flags, see below */
>  	unsigned int flags;
>  	/* parent cfq_data */
>  	struct cfq_data *cfqd;
> -	/* service_tree member */
> -	struct rb_node rb_node;
> -	/* service_tree key */
> -	unsigned long rb_key;
>  	/* prio tree member */
>  	struct rb_node p_node;
>  	/* prio tree root we belong to, if any */
> @@ -167,33 +114,23 @@ struct cfq_queue {
>  	/* fifo list of requests in sort_list */
>  	struct list_head fifo;
>  
> -	unsigned long slice_end;
> -	long slice_resid;
>  	unsigned int slice_dispatch;
>  
>  	/* pending metadata requests */
>  	int meta_pending;
> -	/* number of requests that are on the dispatch list or inside driver */
> -	int dispatched;
>  
>  	/* io prio of this group */
> -	unsigned short ioprio, org_ioprio;
> -	unsigned short ioprio_class, org_ioprio_class;
> +	unsigned short org_ioprio;
> +	unsigned short org_ioprio_class;
>  
>  	pid_t pid;
>  };
>  
>  enum cfqq_state_flags {
> -	CFQ_CFQQ_FLAG_on_rr = 0,	/* on round-robin busy list */
> -	CFQ_CFQQ_FLAG_wait_request,	/* waiting for a request */
> -	CFQ_CFQQ_FLAG_must_dispatch,	/* must be allowed a dispatch */
>  	CFQ_CFQQ_FLAG_must_alloc,	/* must be allowed rq alloc */
>  	CFQ_CFQQ_FLAG_must_alloc_slice,	/* per-slice must_alloc flag */
>  	CFQ_CFQQ_FLAG_fifo_expire,	/* FIFO checked in this slice */
> -	CFQ_CFQQ_FLAG_idle_window,	/* slice idling enabled */
>  	CFQ_CFQQ_FLAG_prio_changed,	/* task priority has changed */
> -	CFQ_CFQQ_FLAG_slice_new,	/* no requests dispatched in slice */
> -	CFQ_CFQQ_FLAG_sync,		/* synchronous queue */
>  	CFQ_CFQQ_FLAG_coop,		/* has done a coop jump of the queue */
>  };
>  
> @@ -211,16 +148,10 @@ static inline int cfq_cfqq_##name(const struct cfq_queue *cfqq)		\
>  	return ((cfqq)->flags & (1 << CFQ_CFQQ_FLAG_##name)) != 0;	\
>  }
>  
> -CFQ_CFQQ_FNS(on_rr);
> -CFQ_CFQQ_FNS(wait_request);
> -CFQ_CFQQ_FNS(must_dispatch);
>  CFQ_CFQQ_FNS(must_alloc);
>  CFQ_CFQQ_FNS(must_alloc_slice);
>  CFQ_CFQQ_FNS(fifo_expire);
> -CFQ_CFQQ_FNS(idle_window);
>  CFQ_CFQQ_FNS(prio_changed);
> -CFQ_CFQQ_FNS(slice_new);
> -CFQ_CFQQ_FNS(sync);
>  CFQ_CFQQ_FNS(coop);
>  #undef CFQ_CFQQ_FNS
>  
> @@ -259,66 +190,32 @@ static inline int cfq_bio_sync(struct bio *bio)
>  	return 0;
>  }
>  
> -/*
> - * scheduler run of queue, if there are requests pending and no one in the
> - * driver that will restart queueing
> - */
> -static inline void cfq_schedule_dispatch(struct cfq_data *cfqd)
> +static inline struct io_group *cfqq_to_io_group(struct cfq_queue *cfqq)
>  {
> -	if (cfqd->busy_queues) {
> -		cfq_log(cfqd, "schedule dispatch");
> -		kblockd_schedule_work(cfqd->queue, &cfqd->unplug_work);
> -	}
> +	return ioq_to_io_group(cfqq->ioq);
>  }
>  
> -static int cfq_queue_empty(struct request_queue *q)
> +static inline int cfq_class_idle(struct cfq_queue *cfqq)
>  {
> -	struct cfq_data *cfqd = q->elevator->elevator_data;
> -
> -	return !cfqd->busy_queues;
> +	return elv_ioq_class_idle(cfqq->ioq);
>  }
>  
> -/*
> - * Scale schedule slice based on io priority. Use the sync time slice only
> - * if a queue is marked sync and has sync io queued. A sync queue with async
> - * io only, should not get full sync slice length.
> - */
> -static inline int cfq_prio_slice(struct cfq_data *cfqd, int sync,
> -				 unsigned short prio)
> -{
> -	const int base_slice = cfqd->cfq_slice[sync];
> -
> -	WARN_ON(prio >= IOPRIO_BE_NR);
> -
> -	return base_slice + (base_slice/CFQ_SLICE_SCALE * (4 - prio));
> -}
> -
> -static inline int
> -cfq_prio_to_slice(struct cfq_data *cfqd, struct cfq_queue *cfqq)
> +static inline int cfq_class_rt(struct cfq_queue *cfqq)
>  {
> -	return cfq_prio_slice(cfqd, cfq_cfqq_sync(cfqq), cfqq->ioprio);
> +	return elv_ioq_class_rt(cfqq->ioq);
>  }

Hi Vivek,

cfq_class_rt isn't needed now, clean it up.

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
---
 block/cfq-iosched.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 705e7ba..23b24b9 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -234,11 +234,6 @@ static inline int cfq_class_idle(struct cfq_queue *cfqq)
 	return elv_ioq_class_idle(cfqq->ioq);
 }
 
-static inline int cfq_class_rt(struct cfq_queue *cfqq)
-{
-	return elv_ioq_class_rt(cfqq->ioq);
-}
-
 static inline int cfq_cfqq_sync(struct cfq_queue *cfqq)
 {
 	return elv_ioq_sync(cfqq->ioq);
-- 
1.5.4.rc3



  parent reply	other threads:[~2009-06-15  8:59 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09  2:08 [RFC] IO scheduler based IO controller V4 Vivek Goyal
2009-06-09  2:08 ` [PATCH 01/19] io-controller: Documentation Vivek Goyal
2009-06-09  2:08 ` [PATCH 02/19] io-controller: Common flat fair queuing code in elevaotor layer Vivek Goyal
2009-06-09  8:45   ` Gui Jianfeng
2009-06-16  3:54   ` Gui Jianfeng
2009-06-16 13:02     ` Vivek Goyal
2009-06-16 19:44   ` Divyesh Shah
2009-06-17 12:59     ` Vivek Goyal
2009-06-09  2:08 ` [PATCH 03/19] io-controller: Charge for time slice based on average disk rate Vivek Goyal
2009-06-09  2:08 ` [PATCH 04/19] io-controller: Modify cfq to make use of flat elevator fair queuing Vivek Goyal
2009-06-11  6:12   ` Gui Jianfeng
2009-06-11 14:21     ` Vivek Goyal
2009-06-15  8:56   ` Gui Jianfeng [this message]
2009-06-15 13:02     ` Vivek Goyal
2009-06-17  2:22   ` Gui Jianfeng
2009-06-17 13:00     ` Vivek Goyal
2009-06-09  2:08 ` [PATCH 05/19] io-controller: Common hierarchical fair queuing code in elevaotor layer Vivek Goyal
2009-06-09  2:08 ` [PATCH 06/19] io-controller: cfq changes to use " Vivek Goyal
2009-06-09  2:08 ` [PATCH 07/19] io-controller: Export disk time used and nr sectors dipatched through cgroups Vivek Goyal
2009-06-09  2:08 ` [PATCH 08/19] io-controller: idle for sometime on sync queue before expiring it Vivek Goyal
2009-06-09  2:08 ` [PATCH 09/19] io-controller: Separate out queue and data Vivek Goyal
2009-06-09  2:08 ` [PATCH 10/19] io-conroller: Prepare elevator layer for single queue schedulers Vivek Goyal
2009-06-11  8:10   ` Gui Jianfeng
2009-06-11 14:41     ` Vivek Goyal
2009-06-12  0:37       ` Gui Jianfeng
2009-06-15 13:00         ` Vivek Goyal
2009-06-09  2:08 ` [PATCH 11/19] io-controller: noop changes for hierarchical fair queuing Vivek Goyal
2009-06-09  2:08 ` [PATCH 12/19] io-controller: deadline " Vivek Goyal
2009-06-09  2:08 ` [PATCH 13/19] io-controller: anticipatory " Vivek Goyal
2009-06-09  2:08 ` [PATCH 14/19] blkio_cgroup patches from Ryo to track async bios Vivek Goyal
2009-06-09  2:08 ` [PATCH 15/19] io-controller: map async requests to appropriate cgroup Vivek Goyal
2009-06-17  9:17   ` Gui Jianfeng
2009-06-17 13:00     ` Vivek Goyal
2009-06-09  2:08 ` [PATCH 16/19] io-controller: Per cgroup request descriptor support Vivek Goyal
2009-06-09  2:09 ` [PATCH 17/19] io-controller: Support per cgroup per device weights and io class Vivek Goyal
2009-06-10  7:44   ` Gui Jianfeng
2009-06-10 13:22     ` Vivek Goyal
2009-06-09  2:09 ` [PATCH 18/19] io-controller: Debug hierarchical IO scheduling Vivek Goyal
2009-06-19  1:40   ` Gui Jianfeng
2009-06-19 14:05     ` Vivek Goyal
2009-06-19  6:26   ` Gui Jianfeng
2009-06-19 14:08     ` Vivek Goyal
2009-06-09  2:09 ` [PATCH 19/19] io-controller: experimental debug patch for async queue wait before expiry Vivek Goyal
2009-06-09  4:22 ` [RFC] IO scheduler based IO controller V4 Gui Jianfeng
2009-06-09 13:52   ` Vivek Goyal
2009-06-10  1:05     ` 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=4A360CD2.8060707@cn.fujitsu.com \
    --to=guijianfeng@cn.fujitsu.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=jbaron@redhat.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=peterz@infradead.org \
    --cc=righi.andrea@gmail.com \
    --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