Skip to content

Commit

Permalink
Revert "bdi: add a user-tunable cpu_list for the bdi flusher threads"
Browse files Browse the repository at this point in the history
This reverts commit 8fa72d2.

People disagree about how this should be done, so let's revert this for
now so that nobody starts using the new tuning interface.  Tejun is
thinking about a more generic interface for thread pool affinity.

Requested-by: Tejun Heo <[email protected]>
Acked-by: Jeff Moyer <[email protected]>
Acked-by: Jens Axboe <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
torvalds committed Dec 17, 2012
1 parent fa4c95b commit 9360b53
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 88 deletions.
4 changes: 0 additions & 4 deletions include/linux/backing-dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <linux/writeback.h>
#include <linux/atomic.h>
#include <linux/sysctl.h>
#include <linux/mutex.h>

struct page;
struct device;
Expand Down Expand Up @@ -106,9 +105,6 @@ struct backing_dev_info {

struct timer_list laptop_mode_wb_timer;

cpumask_t *flusher_cpumask; /* used for writeback thread scheduling */
struct mutex flusher_cpumask_lock;

#ifdef CONFIG_DEBUG_FS
struct dentry *debug_dir;
struct dentry *debug_stats;
Expand Down
84 changes: 0 additions & 84 deletions mm/backing-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <linux/module.h>
#include <linux/writeback.h>
#include <linux/device.h>
#include <linux/slab.h>
#include <trace/events/writeback.h>

static atomic_long_t bdi_seq = ATOMIC_LONG_INIT(0);
Expand Down Expand Up @@ -222,63 +221,12 @@ static ssize_t max_ratio_store(struct device *dev,
}
BDI_SHOW(max_ratio, bdi->max_ratio)

static ssize_t cpu_list_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct backing_dev_info *bdi = dev_get_drvdata(dev);
struct bdi_writeback *wb = &bdi->wb;
cpumask_var_t newmask;
ssize_t ret;
struct task_struct *task;

if (!alloc_cpumask_var(&newmask, GFP_KERNEL))
return -ENOMEM;

ret = cpulist_parse(buf, newmask);
if (!ret) {
spin_lock_bh(&bdi->wb_lock);
task = wb->task;
if (task)
get_task_struct(task);
spin_unlock_bh(&bdi->wb_lock);

mutex_lock(&bdi->flusher_cpumask_lock);
if (task) {
ret = set_cpus_allowed_ptr(task, newmask);
put_task_struct(task);
}
if (ret == 0) {
cpumask_copy(bdi->flusher_cpumask, newmask);
ret = count;
}
mutex_unlock(&bdi->flusher_cpumask_lock);

}
free_cpumask_var(newmask);

return ret;
}

static ssize_t cpu_list_show(struct device *dev,
struct device_attribute *attr, char *page)
{
struct backing_dev_info *bdi = dev_get_drvdata(dev);
ssize_t ret;

mutex_lock(&bdi->flusher_cpumask_lock);
ret = cpulist_scnprintf(page, PAGE_SIZE-1, bdi->flusher_cpumask);
mutex_unlock(&bdi->flusher_cpumask_lock);

return ret;
}

#define __ATTR_RW(attr) __ATTR(attr, 0644, attr##_show, attr##_store)

static struct device_attribute bdi_dev_attrs[] = {
__ATTR_RW(read_ahead_kb),
__ATTR_RW(min_ratio),
__ATTR_RW(max_ratio),
__ATTR_RW(cpu_list),
__ATTR_NULL,
};

Expand Down Expand Up @@ -480,7 +428,6 @@ static int bdi_forker_thread(void *ptr)
writeback_inodes_wb(&bdi->wb, 1024,
WB_REASON_FORKER_THREAD);
} else {
int ret;
/*
* The spinlock makes sure we do not lose
* wake-ups when racing with 'bdi_queue_work()'.
Expand All @@ -490,14 +437,6 @@ static int bdi_forker_thread(void *ptr)
spin_lock_bh(&bdi->wb_lock);
bdi->wb.task = task;
spin_unlock_bh(&bdi->wb_lock);
mutex_lock(&bdi->flusher_cpumask_lock);
ret = set_cpus_allowed_ptr(task,
bdi->flusher_cpumask);
mutex_unlock(&bdi->flusher_cpumask_lock);
if (ret)
printk_once("%s: failed to bind flusher"
" thread %s, error %d\n",
__func__, task->comm, ret);
wake_up_process(task);
}
bdi_clear_pending(bdi);
Expand Down Expand Up @@ -570,17 +509,6 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,
dev_name(dev));
if (IS_ERR(wb->task))
return PTR_ERR(wb->task);
} else {
int node;
/*
* Set up a default cpumask for the flusher threads that
* includes all cpus on the same numa node as the device.
* The mask may be overridden via sysfs.
*/
node = dev_to_node(bdi->dev);
if (node != NUMA_NO_NODE)
cpumask_copy(bdi->flusher_cpumask,
cpumask_of_node(node));
}

bdi_debug_register(bdi, dev_name(dev));
Expand Down Expand Up @@ -706,15 +634,6 @@ int bdi_init(struct backing_dev_info *bdi)

bdi_wb_init(&bdi->wb, bdi);

if (!bdi_cap_flush_forker(bdi)) {
bdi->flusher_cpumask = kmalloc(sizeof(cpumask_t), GFP_KERNEL);
if (!bdi->flusher_cpumask)
return -ENOMEM;
cpumask_setall(bdi->flusher_cpumask);
mutex_init(&bdi->flusher_cpumask_lock);
} else
bdi->flusher_cpumask = NULL;

for (i = 0; i < NR_BDI_STAT_ITEMS; i++) {
err = percpu_counter_init(&bdi->bdi_stat[i], 0);
if (err)
Expand All @@ -737,7 +656,6 @@ int bdi_init(struct backing_dev_info *bdi)
err:
while (i--)
percpu_counter_destroy(&bdi->bdi_stat[i]);
kfree(bdi->flusher_cpumask);
}

return err;
Expand Down Expand Up @@ -765,8 +683,6 @@ void bdi_destroy(struct backing_dev_info *bdi)

bdi_unregister(bdi);

kfree(bdi->flusher_cpumask);

/*
* If bdi_unregister() had already been called earlier, the
* wakeup_timer could still be armed because bdi_prune_sb()
Expand Down

0 comments on commit 9360b53

Please sign in to comment.