On Thu, 8 Oct 2009 12:01:36 +0800 Wu Fengguang <fengguang.wu@xxxxxxxxx> wrote: > On Thu, Oct 08, 2009 at 10:40:37AM +0800, KAMEZAWA Hiroyuki wrote: > > Thank you for clarification. > > Then, hmm, %iotwait (which 'top' shows) didn't work as desgined and we need > > to update throttle_vm_writeout() and some in vmscan.c. Thanks for input. > > Thanks, you also reminds me to do io_schedule() in the nfs writeback > wait queue :) > good side effect ;) > > BTW, I'm glad if I can know "how many threads/ios are throttoled now" per bdi. > > Good suggestion. How about this patch? > Seems attractive. Hmm.. == struct dirty_throttle_task { + pid_t owner_pid; == and show it ? (too verbose ? Regards, -Kame > CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> > Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx> > --- > fs/fs-writeback.c | 1 + > include/linux/backing-dev.h | 2 ++ > mm/backing-dev.c | 33 +++++++++++++++++++++++++++++++++ > 3 files changed, 36 insertions(+) > > --- linux.orig/include/linux/backing-dev.h 2009-10-08 11:46:28.000000000 +0800 > +++ linux/include/linux/backing-dev.h 2009-10-08 11:47:39.000000000 +0800 > @@ -101,6 +101,7 @@ struct backing_dev_info { > #ifdef CONFIG_DEBUG_FS > struct dentry *debug_dir; > struct dentry *debug_stats; > + struct dentry *debug_throttle; > #endif > }; > > @@ -116,6 +117,7 @@ struct backing_dev_info { > #define DIRTY_THROTTLE_PAGES_STOP (1 << 22) > > struct dirty_throttle_task { > + unsigned long start_time; > long nr_pages; > struct list_head list; > struct completion complete; > --- linux.orig/mm/backing-dev.c 2009-10-08 11:47:37.000000000 +0800 > +++ linux/mm/backing-dev.c 2009-10-08 11:59:06.000000000 +0800 > @@ -115,6 +115,23 @@ static int bdi_debug_stats_show(struct s > return 0; > } > > +static int bdi_debug_throttle_show(struct seq_file *m, void *v) > +{ > + struct backing_dev_info *bdi = m->private; > + struct dirty_throttle_task *tt; > + unsigned long flags; > + > + spin_lock_irqsave(&bdi->throttle_lock, flags); > + list_for_each_entry(tt, &bdi->throttle_list, list) { > + seq_printf(m, "goal=%lukb\twaited=%lums\n", > + tt->nr_pages << (PAGE_SHIFT - 10), > + (jiffies - tt->start_time) * 1000 / HZ); > + } > + spin_unlock_irqrestore(&bdi->throttle_lock, flags); > + > + return 0; > +} > + > static int bdi_debug_stats_open(struct inode *inode, struct file *file) > { > return single_open(file, bdi_debug_stats_show, inode->i_private); > @@ -127,15 +144,31 @@ static const struct file_operations bdi_ > .release = single_release, > }; > > +static int bdi_debug_throttle_open(struct inode *inode, struct file *file) > +{ > + return single_open(file, bdi_debug_throttle_show, inode->i_private); > +} > + > +static const struct file_operations bdi_debug_throttle_fops = { > + .open = bdi_debug_throttle_open, > + .read = seq_read, > + .llseek = seq_lseek, > + .release = single_release, > +}; > + > static void bdi_debug_register(struct backing_dev_info *bdi, const char *name) > { > bdi->debug_dir = debugfs_create_dir(name, bdi_debug_root); > bdi->debug_stats = debugfs_create_file("stats", 0444, bdi->debug_dir, > bdi, &bdi_debug_stats_fops); > + bdi->debug_throttle = debugfs_create_file("throttle_list", 0444, > + bdi->debug_dir, bdi, > + &bdi_debug_throttle_fops); > } > > static void bdi_debug_unregister(struct backing_dev_info *bdi) > { > + debugfs_remove(bdi->debug_throttle); > debugfs_remove(bdi->debug_stats); > debugfs_remove(bdi->debug_dir); > } > --- linux.orig/fs/fs-writeback.c 2009-10-08 11:44:27.000000000 +0800 > +++ linux/fs/fs-writeback.c 2009-10-08 11:47:39.000000000 +0800 > @@ -284,6 +284,7 @@ static void bdi_calc_write_bandwidth(str > void bdi_writeback_wait(struct backing_dev_info *bdi, long nr_pages) > { > struct dirty_throttle_task tt = { > + .start_time = jiffies, > .nr_pages = nr_pages, > .complete = COMPLETION_INITIALIZER_ONSTACK(tt.complete), > }; > -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html