Skip to content

Commit

Permalink
Revert "block: prepare I/O context code for BFQ-v6r1 for 3.1"
Browse files Browse the repository at this point in the history
This reverts commit d51968e.
  • Loading branch information
pershoot committed Jun 16, 2013
1 parent 51eefb0 commit 811d09d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 75 deletions.
26 changes: 0 additions & 26 deletions block/Kconfig.iosched
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,6 @@ config CFQ_GROUP_IOSCHED
---help---
Enable group IO scheduling in CFQ.

config IOSCHED_BFQ
tristate "BFQ I/O scheduler"
depends on EXPERIMENTAL
default n
---help---
The BFQ I/O scheduler tries to distribute bandwidth among
all processes according to their weights.
It aims at distributing the bandwidth as desired, independently of
the disk parameters and with any workload. It also tries to
guarantee low latency to interactive and soft real-time
applications. If compiled built-in (saying Y here), BFQ can
be configured to support hierarchical scheduling.

config CGROUP_BFQIO
bool "BFQ hierarchical scheduling support"
depends on CGROUPS && IOSCHED_BFQ=y
default n
---help---
Enable hierarchical scheduling in BFQ, using the cgroups
filesystem interface. The name of the subsystem will be
bfqio.

choice
prompt "Default I/O scheduler"
default DEFAULT_CFQ
Expand All @@ -98,9 +76,6 @@ choice
config DEFAULT_CFQ
bool "CFQ" if IOSCHED_CFQ=y

config DEFAULT_BFQ
bool "BFQ" if IOSCHED_BFQ=y

config DEFAULT_NOOP
bool "No-op"

Expand All @@ -111,7 +86,6 @@ config DEFAULT_IOSCHED
default "deadline" if DEFAULT_DEADLINE
default "row" if DEFAULT_ROW
default "cfq" if DEFAULT_CFQ
default "bfq" if DEFAULT_BFQ
default "noop" if DEFAULT_NOOP

endmenu
Expand Down
30 changes: 13 additions & 17 deletions block/blk-ioc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/bio.h>
#include <linux/bitmap.h>
#include <linux/blkdev.h>
#include <linux/bootmem.h> /* for max_pfn/max_low_pfn */
#include <linux/slab.h>
Expand All @@ -17,12 +16,13 @@
*/
static struct kmem_cache *iocontext_cachep;

static void hlist_sched_dtor(struct io_context *ioc, struct hlist_head *list)
static void cfq_dtor(struct io_context *ioc)
{
if (!hlist_empty(list)) {
if (!hlist_empty(&ioc->cic_list)) {
struct cfq_io_context *cic;

cic = hlist_entry(list->first, struct cfq_io_context, cic_list);
cic = hlist_entry(ioc->cic_list.first, struct cfq_io_context,
cic_list);
cic->dtor(ioc);
}
}
Expand All @@ -40,9 +40,7 @@ int put_io_context(struct io_context *ioc)

if (atomic_long_dec_and_test(&ioc->refcount)) {
rcu_read_lock();

hlist_sched_dtor(ioc, &ioc->cic_list);
hlist_sched_dtor(ioc, &ioc->bfq_cic_list);
cfq_dtor(ioc);
rcu_read_unlock();

kmem_cache_free(iocontext_cachep, ioc);
Expand All @@ -52,14 +50,15 @@ int put_io_context(struct io_context *ioc)
}
EXPORT_SYMBOL(put_io_context);

static void hlist_sched_exit(struct io_context *ioc, struct hlist_head *list)
static void cfq_exit(struct io_context *ioc)
{
rcu_read_lock();

if (!hlist_empty(list)) {
if (!hlist_empty(&ioc->cic_list)) {
struct cfq_io_context *cic;

cic = hlist_entry(list->first, struct cfq_io_context, cic_list);
cic = hlist_entry(ioc->cic_list.first, struct cfq_io_context,
cic_list);
cic->exit(ioc);
}
rcu_read_unlock();
Expand All @@ -75,10 +74,9 @@ void exit_io_context(struct task_struct *task)
task->io_context = NULL;
task_unlock(task);

if (atomic_dec_and_test(&ioc->nr_tasks)) {
hlist_sched_exit(ioc, &ioc->cic_list);
hlist_sched_exit(ioc, &ioc->bfq_cic_list);
}
if (atomic_dec_and_test(&ioc->nr_tasks))
cfq_exit(ioc);

put_io_context(ioc);
}

Expand All @@ -91,14 +89,12 @@ struct io_context *alloc_io_context(gfp_t gfp_flags, int node)
atomic_long_set(&ioc->refcount, 1);
atomic_set(&ioc->nr_tasks, 1);
spin_lock_init(&ioc->lock);
bitmap_zero(ioc->ioprio_changed, IOC_IOPRIO_CHANGED_BITS);
ioc->ioprio_changed = 0;
ioc->ioprio = 0;
ioc->last_waited = 0; /* doesn't matter... */
ioc->nr_batch_requests = 0; /* because this is 0 */
INIT_RADIX_TREE(&ioc->radix_root, GFP_ATOMIC | __GFP_HIGH);
INIT_HLIST_HEAD(&ioc->cic_list);
INIT_RADIX_TREE(&ioc->bfq_radix_root, GFP_ATOMIC | __GFP_HIGH);
INIT_HLIST_HEAD(&ioc->bfq_cic_list);
ioc->ioc_data = NULL;
#if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
ioc->cgroup_changed = 0;
Expand Down
10 changes: 3 additions & 7 deletions block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -2934,6 +2934,7 @@ static void changed_ioprio(struct io_context *ioc, struct cfq_io_context *cic)
static void cfq_ioc_set_ioprio(struct io_context *ioc)
{
call_for_each_cic(ioc, changed_ioprio);
ioc->ioprio_changed = 0;
}

static void cfq_init_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq,
Expand Down Expand Up @@ -3225,13 +3226,8 @@ cfq_get_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
goto err_free;

out:
/*
* test_and_clear_bit() implies a memory barrier, paired with
* the wmb() in fs/ioprio.c, so the value seen for ioprio is the
* new one.
*/
if (unlikely(test_and_clear_bit(IOC_CFQ_IOPRIO_CHANGED,
ioc->ioprio_changed)))
smp_read_barrier_depends();
if (unlikely(ioc->ioprio_changed))
cfq_ioc_set_ioprio(ioc);

#ifdef CONFIG_CFQ_GROUP_IOSCHED
Expand Down
9 changes: 2 additions & 7 deletions fs/ioprio.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

int set_task_ioprio(struct task_struct *task, int ioprio)
{
int err, i;
int err;
struct io_context *ioc;
const struct cred *cred = current_cred(), *tcred;

Expand Down Expand Up @@ -60,17 +60,12 @@ int set_task_ioprio(struct task_struct *task, int ioprio)
err = -ENOMEM;
break;
}
/* let other ioc users see the new values */
smp_wmb();
task->io_context = ioc;
} while (1);

if (!err) {
ioc->ioprio = ioprio;
/* make sure schedulers see the new ioprio value */
wmb();
for (i = 0; i < IOC_IOPRIO_CHANGED_BITS; i++)
set_bit(i, ioc->ioprio_changed);
ioc->ioprio_changed = 1;
}

task_unlock(task);
Expand Down
21 changes: 3 additions & 18 deletions include/linux/iocontext.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef IOCONTEXT_H
#define IOCONTEXT_H

#include <linux/bitmap.h>
#include <linux/radix-tree.h>
#include <linux/rcupdate.h>

struct cfq_queue;
struct cfq_ttime {
unsigned long last_end_request;

Expand All @@ -16,15 +16,12 @@ struct cfq_ttime {
struct cfq_io_context {
void *key;

void *cfqq[2];
struct cfq_queue *cfqq[2];

struct io_context *ioc;

struct cfq_ttime ttime;

unsigned int raising_time_left;
unsigned int saved_idle_window;

struct list_head queue_list;
struct hlist_node cic_list;

Expand All @@ -34,16 +31,6 @@ struct cfq_io_context {
struct rcu_head rcu_head;
};

/*
* Indexes into the ioprio_changed bitmap. A bit set indicates that
* the corresponding I/O scheduler needs to see a ioprio update.
*/
enum {
IOC_CFQ_IOPRIO_CHANGED,
IOC_BFQ_IOPRIO_CHANGED,
IOC_IOPRIO_CHANGED_BITS
};

/*
* I/O subsystem state of the associated processes. It is refcounted
* and kmalloc'ed. These could be shared between processes.
Expand All @@ -56,7 +43,7 @@ struct io_context {
spinlock_t lock;

unsigned short ioprio;
DECLARE_BITMAP(ioprio_changed, IOC_IOPRIO_CHANGED_BITS);
unsigned short ioprio_changed;

#if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
unsigned short cgroup_changed;
Expand All @@ -70,8 +57,6 @@ struct io_context {

struct radix_tree_root radix_root;
struct hlist_head cic_list;
struct radix_tree_root bfq_radix_root;
struct hlist_head bfq_cic_list;
void __rcu *ioc_data;
};

Expand Down

0 comments on commit 811d09d

Please sign in to comment.