per device dirty throttling -v9
Subsystems (21)
Quoted 18 lines
Per device dirty throttling patches
These patches aim to improve
balance_dirty_pages()and directly address three issues:
1) inter device starvation
2) stacked device deadlocks
3) inter process starvation1 and 2 are a direct result from removing the global dirty limit and using per device dirty limits. By giving each device its own dirty limit is will no longer starve another device, and the cyclic dependancy on the dirty limit is broken.
In order to efficiently distribute the dirty limit across the independant devices a floating proportion is used, this will allocate a share of the total limit proportional to the device's recent activity.
Quoted 8 lines
3 is done by also scaling the dirty limit proportional to the current task's recent dirty rate.
Changes since -v8:
- cleanup of the proportion code
- fixpercpu_counter_add(&counter, -(unsigned long))
- fix per task dirty rate code
- fwd port to .23-rc2-mm2
Peter,
any chance to get a rollup against 2.6.22-stable?
The 2.6.23 series may not be usable for me due to the
nosharedcache changes for NFS (the new default will massively disturb the user-space automounter).
Cheers
Martin
------------------------------------------------------
Martin Knoblauch
email: k n o b i AT knobisoft DOT de www: http://www.knobisoft.de
Quoted 7 lines · Martin Knoblauch
Peter,
any chance to get a rollup against 2.6.22-stable?
The 2.6.23 series may not be usable for me due to the
nosharedcache changes for NFS (the new default will massively disturb the user-space automounter).
I'll see what I can do, bit busy with other stuff atm, hopefully after the weekend.
Quoted 4 lines · --- Peter Zijlstra
Quoted 2 lines · Martin Knoblauch
Peter,
Quoted 9 lines
Quoted 5 lines
any chance to get a rollup against 2.6.22-stable?
The 2.6.23 series may not be usable for me due to the
nosharedcache changes for NFS (the new default will massively disturb the user-space automounter).I'll see what I can do, bit busy with other stuff atm, hopefully after the weekend.
Hi Peter,
that would be highly appreciated. Thanks a lot in advance.
Martin
------------------------------------------------------
Martin Knoblauch
email: k n o b i AT knobisoft DOT de www: http://www.knobisoft.de
Quoted 6 lines · --- Peter Zijlstra
Quoted 4 lines · Martin Knoblauch
Peter,
any chance to get a rollup against 2.6.22-stable?
Quoted 8 lines
Quoted 3 lines
The 2.6.23 series may not be usable for me due to the
nosharedcache changes for NFS (the new default will massively disturb the user-space automounter).I'll see what I can do, bit busy with other stuff atm, hopefully after
the weekend.
Hi Peter,
any progress on a version against 2.6.22.5? I have seen the very
positive report from Jeffrey W. Baker and would really love to test your patch. But as I said, anything newer than 2.6.22.x might not be an option due to the NFS changes.
Kind regards
Martin
------------------------------------------------------
Martin Knoblauch
email: k n o b i AT knobisoft DOT de www: http://www.knobisoft.de
Quoted 16 lines · Martin Knoblauch
Quoted 6 lines · --- Peter Zijlstra
Quoted 4 lines · Martin Knoblauch
Peter,
any chance to get a rollup against 2.6.22-stable?
Quoted 8 lines
Quoted 3 lines
The 2.6.23 series may not be usable for me due to the
nosharedcache changes for NFS (the new default will massively disturb the user-space automounter).I'll see what I can do, bit busy with other stuff atm, hopefully after
the weekend.
Quoted 6 lines
Hi Peter,
any progress on a version against 2.6.22.5? I have seen the very
positive report from Jeffrey W. Baker and would really love to test your patch. But as I said, anything newer than 2.6.22.x might not be an option due to the NFS changes.
mindless port, seems to compile and boot on my test box ymmv.
I think .5 should not present anything other than trivial rejects if anything. But I'm not keeping -stable in my git remotes so I can't say for sure.
fs/nfs/write.c +8 -3
@@ -237,10 +237,8 @@ static void nfs_end_page_writeback(strucstruct nfs_server *nfss =NFS_SERVER (inode);end_page_writeback (page); -if (atomic_long_dec_return (&nfss->writeback) <NFS_CONGESTION_OFF_THRESH ) { +if (atomic_long_dec_return (&nfss->writeback) <NFS_CONGESTION_OFF_THRESH )clear_bdi_congested (&nfss->backing_dev_info,WRITE ); -congestion_end (WRITE ); - } }/*
@@ -466,6 +464,7 @@ nfs_mark_request_commit(struct nfs_pageset_bit (PG_NEED_COMMIT , &(req)->wb_flags);spin_unlock (&nfsi->req_lock);inc_zone_page_state (req->wb_page,NR_UNSTABLE_NFS ); +inc_bdi_stat (req->wb_page->mapping->backing_dev_info,BDI_RECLAIMABLE );__mark_inode_dirty (inode,I_DIRTY_DATASYNC ); }
@@ -552,6 +551,8 @@ static void nfs_cancel_commit_list(strucwhile (!list_empty (head)) { req =nfs_list_entry (head->next);dec_zone_page_state (req->wb_page,NR_UNSTABLE_NFS ); +dec_bdi_stat (req->wb_page->mapping->backing_dev_info, +BDI_RECLAIMABLE );nfs_list_remove_request (req);clear_bit (PG_NEED_COMMIT , &(req)->wb_flags);nfs_inode_remove_request (req);
@@ -1207,6 +1208,8 @@ nfs_commit_list(struct inode *inode, strnfs_list_remove_request (req);nfs_mark_request_commit (req);dec_zone_page_state (req->wb_page,NR_UNSTABLE_NFS ); +dec_bdi_stat (req->wb_page->mapping->backing_dev_info, +BDI_RECLAIMABLE );nfs_clear_page_writeback (req); }return -ENOMEM ;
@@ -1232,6 +1235,8 @@ static void nfs_commit_done(struct rpc_tnfs_list_remove_request (req);clear_bit (PG_NEED_COMMIT , &(req)->wb_flags);dec_zone_page_state (req->wb_page,NR_UNSTABLE_NFS ); +dec_bdi_stat (req->wb_page->mapping->backing_dev_info, +BDI_RECLAIMABLE ); dprintk("NFS: commit (%s/%Ld %d@%Ld)", req->wb_context->dentry->d_inode->i_sb->s_id,
include/linux/backing-dev.h +93 -1
120 lines not on this page · raw message
mm/backing-dev.c +35 -13
57 lines not on this page · raw message
fs/ext2/balloc.c +2 -2
@@ -124,7 +124,7 @@ static int reserve_blocks(struct super_breturn 0 ; } -percpu_counter_mod (&sbi->s_freeblocks_counter, -count); +percpu_counter_sub (&sbi->s_freeblocks_counter, count); sb->s_dirt =1 ;return count; }
@@ -134,7 +134,7 @@ static void release_blocks(struct super_if (count) {struct ext2_sb_info *sbi =EXT2_SB (sb); -percpu_counter_mod (&sbi->s_freeblocks_counter, count); +percpu_counter_add (&sbi->s_freeblocks_counter, count); sb->s_dirt =1 ; } }
fs/ext2/ialloc.c +1 -1
@@ -542,7 +542,7 @@ got: goto fail; } -percpu_counter_mod (&sbi->s_freeinodes_counter,-1 ); +percpu_counter_add (&sbi->s_freeinodes_counter,-1 );if (S_ISDIR (mode))percpu_counter_inc (&sbi->s_dirs_counter);
fs/ext3/balloc.c +2 -2
@@ -570,7 +570,7 @@ do_more:cpu_to_le16 (le16_to_cpu (desc->bg_free_blocks_count) + group_freed);spin_unlock (sb_bgl_lock (sbi, block_group)); -percpu_counter_mod (&sbi->s_freeblocks_counter, count); +percpu_counter_add (&sbi->s_freeblocks_counter, count);/* We dirtied the bitmap block */ BUFFER_TRACE (bitmap_bh,"dirtied bitmap block" );
@@ -1633,7 +1633,7 @@ allocated: gdp->bg_free_blocks_count =cpu_to_le16 (le16_to_cpu (gdp->bg_free_blocks_count)-num);spin_unlock (sb_bgl_lock (sbi, group_no)); -percpu_counter_mod (&sbi->s_freeblocks_counter, -num); +percpu_counter_sub (&sbi->s_freeblocks_counter, num);BUFFER_TRACE (gdp_bh,"journal_dirty_metadata for group descriptor" ); err =ext3_journal_dirty_metadata (handle, gdp_bh);
fs/ext3/resize.c +2 -2
@@ -884,9 +884,9 @@ int ext3_group_add(struct super_block *s input->reserved_blocks);/* Update the free space counts */ -percpu_counter_mod (&sbi->s_freeblocks_counter, +percpu_counter_add (&sbi->s_freeblocks_counter, input->free_blocks_count); -percpu_counter_mod (&sbi->s_freeinodes_counter, +percpu_counter_add (&sbi->s_freeinodes_counter,EXT3_INODES_PER_GROUP (sb));ext3_journal_dirty_metadata (handle, sbi->s_sbh);
fs/ext4/balloc.c +2 -2
@@ -587,7 +587,7 @@ do_more:cpu_to_le16 (le16_to_cpu (desc->bg_free_blocks_count) + group_freed);spin_unlock (sb_bgl_lock (sbi, block_group)); -percpu_counter_mod (&sbi->s_freeblocks_counter, count); +percpu_counter_add (&sbi->s_freeblocks_counter, count);/* We dirtied the bitmap block */ BUFFER_TRACE (bitmap_bh,"dirtied bitmap block" );
@@ -1647,7 +1647,7 @@ allocated: gdp->bg_free_blocks_count =cpu_to_le16 (le16_to_cpu (gdp->bg_free_blocks_count)-num);spin_unlock (sb_bgl_lock (sbi, group_no)); -percpu_counter_mod (&sbi->s_freeblocks_counter, -num); +percpu_counter_sub (&sbi->s_freeblocks_counter, num);BUFFER_TRACE (gdp_bh,"journal_dirty_metadata for group descriptor" ); err =ext4_journal_dirty_metadata (handle, gdp_bh);
fs/ext4/resize.c +2 -2
@@ -893,9 +893,9 @@ int ext4_group_add(struct super_block *s input->reserved_blocks);/* Update the free space counts */ -percpu_counter_mod (&sbi->s_freeblocks_counter, +percpu_counter_add (&sbi->s_freeblocks_counter, input->free_blocks_count); -percpu_counter_mod (&sbi->s_freeinodes_counter, +percpu_counter_add (&sbi->s_freeinodes_counter,EXT4_INODES_PER_GROUP (sb));ext4_journal_dirty_metadata (handle, sbi->s_sbh);
include/linux/percpu_counter.h +52 -8
110 lines not on this page · raw message
lib/percpu_counter.c +33 -7
@@ -5,15 +5,41 @@#include <linux/percpu_counter.h> #include <linux/module.h> -void percpu_counter_mod (struct percpu_counter *fbc,s32 amount) +void percpu_counter_set (struct percpu_counter *fbc,s64 amount) { -long count; +int cpu; + +spin_lock (&fbc->lock); +for_each_possible_cpu (cpu) { +s32 *pcount =per_cpu_ptr (fbc->counters, cpu); + *pcount =0 ; + } + fbc->count = amount; +spin_unlock (&fbc->lock); +} +EXPORT_SYMBOL (percpu_counter_set); + +static struct lock_class_key percpu_counter_irqsafe; + +int percpu_counter_init_irq (struct percpu_counter *fbc,s64 amount) +{ +int err; + + err =percpu_counter_init (fbc, amount); +if (!err) +lockdep_set_class (&fbc->lock, &percpu_counter_irqsafe); +return err; +} + +void __percpu_counter_add (struct percpu_counter *fbc,s64 amount,s32 batch) +{ +s64 count;s32 *pcount;int cpu =get_cpu (); pcount =per_cpu_ptr (fbc->counters, cpu); count = *pcount + amount; -if (count >=FBC_BATCH || count <= -FBC_BATCH ) { +if (count >= batch || count <= -batch) {spin_lock (&fbc->lock); fbc->count += count; *pcount =0 ;
@@ -23,13 +49,13 @@ void percpu_counter_mod(struct percpu_co }put_cpu (); } -EXPORT_SYMBOL (percpu_counter_mod); +EXPORT_SYMBOL (__percpu_counter_add);/* * Add up all the per-cpu counts, return the result. This is a more accurate * but much slower version of percpu_counter_read_positive() */ -s64 percpu_counter_sum (struct percpu_counter *fbc) +s64 __percpu_counter_sum (struct percpu_counter *fbc) {s64 ret;int cpu;
@@ -41,6 +67,6 @@ s64 percpu_counter_sum(struct percpu_cou ret += *pcount; }spin_unlock (&fbc->lock); -return ret <0 ?0 : ret; +return ret; } -EXPORT_SYMBOL (percpu_counter_sum); +EXPORT_SYMBOL (__percpu_counter_sum);
fs/ext3/super.c +10 -5
@@ -1406,6 +1406,7 @@ static int ext3_fill_super (struct superint i;int needs_recovery;__le32 features; +int err; sbi =kzalloc (sizeof (*sbi),GFP_KERNEL );if (!sbi)
@@ -1665,12 +1666,16 @@ static int ext3_fill_super (struct superget_random_bytes (&sbi->s_next_generation,sizeof (u32));spin_lock_init (&sbi->s_next_gen_lock); -percpu_counter_init (&sbi->s_freeblocks_counter, + err =percpu_counter_init (&sbi->s_freeblocks_counter,ext3_count_free_blocks (sb)); -percpu_counter_init (&sbi->s_freeinodes_counter, + err |=percpu_counter_init (&sbi->s_freeinodes_counter,ext3_count_free_inodes (sb)); -percpu_counter_init (&sbi->s_dirs_counter, + err |=percpu_counter_init (&sbi->s_dirs_counter,ext3_count_dirs (sb)); +if (err) { +printk (KERN_ERR "EXT3-fs: insufficient memory\n" ); + goto failed_mount3; + }/* per fileystem reservation list head & lock */ spin_lock_init (&sbi->s_rsv_window_lock);
@@ -2448,12 +2453,12 @@ static int ext3_statfs (struct dentry * buf->f_type =EXT3_SUPER_MAGIC ; buf->f_bsize = sb->s_blocksize; buf->f_blocks =le32_to_cpu (es->s_blocks_count) - overhead; - buf->f_bfree =percpu_counter_sum (&sbi->s_freeblocks_counter); + buf->f_bfree =percpu_counter_sum_positive (&sbi->s_freeblocks_counter); buf->f_bavail = buf->f_bfree -le32_to_cpu (es->s_r_blocks_count);if (buf->f_bfree <le32_to_cpu (es->s_r_blocks_count)) buf->f_bavail =0 ; buf->f_files =le32_to_cpu (es->s_inodes_count); - buf->f_ffree =percpu_counter_sum (&sbi->s_freeinodes_counter); + buf->f_ffree =percpu_counter_sum_positive (&sbi->s_freeinodes_counter); buf->f_namelen =EXT3_NAME_LEN ; fsid =le64_to_cpup ((void *)es->s_uuid) ^le64_to_cpup ((void *)es->s_uuid +sizeof (u64));
fs/ext4/super.c +10 -5
@@ -1465,6 +1465,7 @@ static int ext4_fill_super (struct superint needs_recovery;__le32 features;__u64 blocks_count; +int err; sbi =kzalloc (sizeof (*sbi),GFP_KERNEL );if (!sbi)
@@ -1737,12 +1738,16 @@ static int ext4_fill_super (struct superget_random_bytes (&sbi->s_next_generation,sizeof (u32));spin_lock_init (&sbi->s_next_gen_lock); -percpu_counter_init (&sbi->s_freeblocks_counter, + err =percpu_counter_init (&sbi->s_freeblocks_counter,ext4_count_free_blocks (sb)); -percpu_counter_init (&sbi->s_freeinodes_counter, + err |=percpu_counter_init (&sbi->s_freeinodes_counter,ext4_count_free_inodes (sb)); -percpu_counter_init (&sbi->s_dirs_counter, + err |=percpu_counter_init (&sbi->s_dirs_counter,ext4_count_dirs (sb)); +if (err) { +printk (KERN_ERR "EXT4-fs: insufficient memory\n" ); + goto failed_mount3; + }/* per fileystem reservation list head & lock */ spin_lock_init (&sbi->s_rsv_window_lock);
@@ -2523,12 +2528,12 @@ static int ext4_statfs (struct dentry * buf->f_type =EXT4_SUPER_MAGIC ; buf->f_bsize = sb->s_blocksize; buf->f_blocks =ext4_blocks_count (es) - overhead; - buf->f_bfree =percpu_counter_sum (&sbi->s_freeblocks_counter); + buf->f_bfree =percpu_counter_sum_positive (&sbi->s_freeblocks_counter); buf->f_bavail = buf->f_bfree -ext4_r_blocks_count (es);if (buf->f_bfree <ext4_r_blocks_count (es)) buf->f_bavail =0 ; buf->f_files =le32_to_cpu (es->s_inodes_count); - buf->f_ffree =percpu_counter_sum (&sbi->s_freeinodes_counter); + buf->f_ffree =percpu_counter_sum_positive (&sbi->s_freeinodes_counter); buf->f_namelen =EXT4_NAME_LEN ; fsid =le64_to_cpup ((void *)es->s_uuid) ^le64_to_cpup ((void *)es->s_uuid +sizeof (u64));
fs/file_table.c +1 -1
@@ -98,7 +98,7 @@ struct file *get_empty_filp(void)* percpu_counters are inaccurate. Do an expensive check before * we go and fail. */ -if (percpu_counter_sum (&nr_files) >= files_stat.max_files) +if (percpu_counter_sum_positive (&nr_files) >= files_stat.max_files) goto over; }
fs/ext2/super.c +8 -3
@@ -652,6 +652,7 @@ static int ext2_fill_super(struct super_int db_count;int i, j;__le32 features; +int err; sbi =kzalloc (sizeof (*sbi),GFP_KERNEL );if (!sbi)
@@ -907,12 +908,16 @@ static int ext2_fill_super(struct super_get_random_bytes (&sbi->s_next_generation,sizeof (u32));spin_lock_init (&sbi->s_next_gen_lock); -percpu_counter_init (&sbi->s_freeblocks_counter, + err =percpu_counter_init (&sbi->s_freeblocks_counter,ext2_count_free_blocks (sb)); -percpu_counter_init (&sbi->s_freeinodes_counter, + err |=percpu_counter_init (&sbi->s_freeinodes_counter,ext2_count_free_inodes (sb)); -percpu_counter_init (&sbi->s_dirs_counter, + err |=percpu_counter_init (&sbi->s_dirs_counter,ext2_count_dirs (sb)); +if (err) { +printk (KERN_ERR "EXT2-fs: insufficient memory\n" ); + goto failed_mount3; + }/* * set up enough so that it can read an inode */
block/ll_rw_blk.c +119 -3
164 lines not on this page · raw message
drivers/block/rd.c +19 -1
@@ -411,6 +411,9 @@ static void __exit rd_cleanup(void)blk_cleanup_queue (rd_queue[i]); }unregister_blkdev (RAMDISK_MAJOR ,"ramdisk" ); + +bdi_destroy (&rd_file_backing_dev_info); +bdi_destroy (&rd_backing_dev_info); }/*
@@ -419,7 +422,19 @@ static void __exit rd_cleanup(void)static int __init rd_init (void ) {int i; -int err = -ENOMEM ; +int err; + + err =bdi_init (&rd_backing_dev_info); +if (err) + goto out2; + + err =bdi_init (&rd_file_backing_dev_info); +if (err) { +bdi_destroy (&rd_backing_dev_info); + goto out2; + } + + err = -ENOMEM ;if (rd_blocksize >PAGE_SIZE || rd_blocksize <512 || (rd_blocksize & (rd_blocksize-1 ))) {
@@ -473,6 +488,9 @@ out:put_disk (rd_disks[i]);blk_cleanup_queue (rd_queue[i]); } +bdi_destroy (&rd_backing_dev_info); +bdi_destroy (&rd_file_backing_dev_info); +out2:return err; }
drivers/char/mem.c +5 -0
@@ -977,6 +977,11 @@ static struct class *mem_class;static int __init chr_dev_init (void ) {int i; +int err; + + err =bdi_init (&zero_bdi); +if (err) +return err;if (register_chrdev (MEM_MAJOR ,"mem" ,&memory_fops))printk ("unable to get major %d for memory devs\n" ,MEM_MAJOR );
fs/char_dev.c +1 -0
@@ -546,6 +546,7 @@ static struct kobject *base_probe(dev_tvoid __init chrdev_init (void ) { cdev_map =kobj_map_init (base_probe, &chrdevs_lock); +bdi_init (&directly_mappable_cdev_bdi); }
fs/fuse/inode.c +9 -0
@@ -401,6 +401,7 @@ static int fuse_show_options(struct seq_static struct fuse_conn *new_conn (void ) {struct fuse_conn *fc; +int err; fc =kzalloc (sizeof (*fc),GFP_KERNEL );if (fc) {
@@ -416,10 +417,17 @@ static struct fuse_conn *new_conn(void)atomic_set (&fc->num_waiting,0 ); fc->bdi.ra_pages = (VM_MAX_READAHEAD *1024 ) /PAGE_CACHE_SIZE ; fc->bdi.unplug_io_fn = default_unplug_io_fn; + err =bdi_init (&fc->bdi); +if (err) { +kfree (fc); + fc =NULL ; + goto out; + } fc->reqctr =0 ; fc->blocked =1 ;get_random_bytes (&fc->scramble_key,sizeof (fc->scramble_key)); } +out:return fc; }
@@ -429,6 +437,7 @@ void fuse_conn_put(struct fuse_conn *fc)if (fc->destroy_req)fuse_request_free (fc->destroy_req);mutex_destroy (&fc->inst_mutex); +bdi_destroy (&fc->bdi);kfree (fc); } }
fs/nfs/client.c +6 -0
@@ -658,6 +658,7 @@ static void nfs_server_set_fsinfo(structif (server->rsize >NFS_MAX_FILE_IO_SIZE ) server->rsize =NFS_MAX_FILE_IO_SIZE ; server->rpages = (server->rsize +PAGE_CACHE_SIZE -1 ) >>PAGE_CACHE_SHIFT ; + server->backing_dev_info.ra_pages = server->rpages *NFS_MAX_READAHEAD ;if (server->wsize > max_rpc_payload)
@@ -708,6 +709,10 @@ static int nfs_probe_fsinfo(struct nfs_s goto out_error;nfs_server_set_fsinfo (server, &fsinfo); + error =bdi_init (&server->backing_dev_info); +if (error) + goto out_error; +/* Get some general file system info */ if (server->namelen ==0 ) {
@@ -787,6 +792,7 @@ void nfs_free_server(struct nfs_server *nfs_put_client (server->nfs_client);nfs_free_iostats (server->io_stats); +bdi_destroy (&server->backing_dev_info);kfree (server);nfs_release_automount_timer ();dprintk ("<-- nfs_free_server()\n" );
fs/hugetlbfs/inode.c +8 -1
@@ -802,11 +802,15 @@ static int __init init_hugetlbfs_fs(voidint error;struct vfsmount *vfsmount; + error =bdi_init (&hugetlbfs_backing_dev_info); +if (error) +return error; + hugetlbfs_inode_cachep =kmem_cache_create ("hugetlbfs_inode_cache" ,sizeof (struct hugetlbfs_inode_info ),0 ,0 , init_once,NULL );if (hugetlbfs_inode_cachep ==NULL ) -return -ENOMEM ; + goto out2; error =register_filesystem (&hugetlbfs_fs_type);if (error)
@@ -824,6 +828,8 @@ static int __init init_hugetlbfs_fs(void out:if (error)kmem_cache_destroy (hugetlbfs_inode_cachep); + out2: +bdi_destroy (&hugetlbfs_backing_dev_info);return error; }
@@ -831,6 +837,7 @@ static void __exit exit_hugetlbfs_fs(voi {kmem_cache_destroy (hugetlbfs_inode_cachep);unregister_filesystem (&hugetlbfs_fs_type); +bdi_destroy (&hugetlbfs_backing_dev_info); }module_init (init_hugetlbfs_fs)
fs/ocfs2/dlm/dlmfs.c +8 -1
@@ -588,13 +588,17 @@ static int __init init_dlmfs_fs(void)dlmfs_print_version (); + status =bdi_init (&dlmfs_backing_dev_info); +if (status) +return status; + dlmfs_inode_cache =kmem_cache_create ("dlmfs_inode_cache" ,sizeof (struct dlmfs_inode_private ),0 , (SLAB_HWCACHE_ALIGN |SLAB_RECLAIM_ACCOUNT |SLAB_MEM_SPREAD ), dlmfs_init_once,NULL );if (!dlmfs_inode_cache) -return -ENOMEM ; + goto bail; cleanup_inode =1 ; user_dlm_worker =create_singlethread_workqueue ("user_dlm" );
@@ -611,6 +615,7 @@ bail:kmem_cache_destroy (dlmfs_inode_cache);if (cleanup_worker)destroy_workqueue (user_dlm_worker); +bdi_destroy (&dlmfs_backing_dev_info); }else printk ("OCFS2 User DLM kernel interface loaded\n" );return status;
@@ -624,6 +629,8 @@ static void __exit exit_dlmfs_fs(void)destroy_workqueue (user_dlm_worker);kmem_cache_destroy (dlmfs_inode_cache); + +bdi_destroy (&dlmfs_backing_dev_info); }MODULE_AUTHOR ("Oracle" );
fs/configfs/configfs_internal.h +2 -0
@@ -55,6 +55,8 @@ extern int configfs_is_root(struct confiextern struct inode *configfs_new_inode (mode_t mode,struct configfs_dirent *);extern int configfs_create (struct dentry *,int mode,int (*init)(struct inode *)); +extern int configfs_inode_init (void ); +extern void configfs_inode_exit (void );extern int configfs_create_file (struct config_item *,const struct configfs_attribute *); extern int configfs_make_dirent(struct configfs_dirent *,
fs/configfs/inode.c +8 -0
@@ -256,4 +256,12 @@ void configfs_hash_and_remove(struct denmutex_unlock (&dir->d_inode->i_mutex); } +int __init configfs_inode_init (void ) +{ +return bdi_init (&configfs_backing_dev_info); +} +void __exit configfs_inode_exit(void) +{ +bdi_destroy (&configfs_backing_dev_info); +}
fs/configfs/mount.c +9 -0
@@ -154,8 +154,16 @@ static int __init configfs_init(void)subsystem_unregister (&config_subsys);kmem_cache_destroy (configfs_dir_cachep); configfs_dir_cachep =NULL ; + goto out; } + err =configfs_inode_init (); +if (err) { +unregister_filesystem (&configfs_fs_type); +subsystem_unregister (&config_subsys); +kmem_cache_destroy (configfs_dir_cachep); + configfs_dir_cachep =NULL ; + } out:return err; }
@@ -166,6 +174,7 @@ static void __exit configfs_exit(void)subsystem_unregister (&config_subsys);kmem_cache_destroy (configfs_dir_cachep); configfs_dir_cachep =NULL ; +configfs_inode_exit (); }MODULE_AUTHOR ("Oracle" );
fs/ramfs/inode.c +11 -1
@@ -222,7 +222,17 @@ module_exit(exit_ramfs_fs)int __init init_rootfs (void ) { -return register_filesystem (&rootfs_fs_type); +int err; + + err =bdi_init (&ramfs_backing_dev_info); +if (err) +return err; + + err =register_filesystem (&rootfs_fs_type); +if (err) +bdi_destroy (&ramfs_backing_dev_info); + +return err; }MODULE_LICENSE ("GPL" );
fs/sysfs/inode.c +5 -0
@@ -44,6 +44,11 @@ void sysfs_delete_inode(struct inode *inreturn generic_delete_inode (inode); } +int __init sysfs_inode_init (void ) +{ +return bdi_init (&sysfs_backing_dev_info); +} +int sysfs_setattr (struct dentry * dentry,struct iattr * iattr) {struct inode * inode = dentry->d_inode;
fs/sysfs/mount.c +4 -0
@@ -98,6 +98,10 @@ int __init sysfs_init(void)if (!sysfs_dir_cachep) goto out; + err =sysfs_inode_init (); +if (err) + goto out_err; + err =register_filesystem (&sysfs_fs_type);if (!err) { sysfs_mount =kern_mount (&sysfs_fs_type);
fs/sysfs/sysfs.h +1 -0
@@ -17,6 +17,7 @@ extern struct kmem_cache *sysfs_dir_cachextern void sysfs_delete_inode (struct inode *inode);extern struct inode *sysfs_new_inode (mode_t mode,struct sysfs_dirent *);extern int sysfs_create (struct dentry *,int mode,int (*init)(struct inode *)); +extern int sysfs_inode_init (void );extern int sysfs_dirent_exist (struct sysfs_dirent *,const unsigned char *); extern int sysfs_make_dirent(struct sysfs_dirent *, struct dentry *, void *,
mm/shmem.c +6 -0
@@ -2490,6 +2490,10 @@ static int __init init_tmpfs(void) {int error; + error =bdi_init (&shmem_backing_dev_info); +if (error) + goto out4; + error =init_inodecache ();if (error) goto out3;
@@ -2514,6 +2518,8 @@ out1: out2:destroy_inodecache (); out3: +bdi_destroy (&shmem_backing_dev_info); +out4: shm_mnt =ERR_PTR (error);return error; }
mm/swap.c +4 -0
@@ -505,6 +505,10 @@ void __init swap_setup(void) {unsigned long megs = num_physpages >> (20 -PAGE_SHIFT ); +#ifdef CONFIG_SWAP +bdi_init (swapper_space.backing_dev_info); +#endif +/* Use a smaller cluster for small-memory machines */ if (megs <16 ) page_cluster =2 ;
mm/readahead.c +6 -0
@@ -75,6 +75,12 @@ static inline void ra_off(struct file_rareturn ; } +static int __init readahead_init (void ) +{ +return bdi_init (&default_backing_dev_info); +} +subsys_initcall (readahead_init); +/* * Set the initial window size, round to next power of 2 and square * for small size, x 4 for medium, and x 2 for large
fs/buffer.c +2 -0
@@ -726,6 +726,8 @@ int __set_page_dirty_buffers(struct pageif (page->mapping) {/* Race with truncate? */ if (mapping_cap_account_dirty (mapping)) {__inc_zone_page_state (page,NR_FILE_DIRTY ); +__inc_bdi_stat (mapping->backing_dev_info, +BDI_RECLAIMABLE );task_io_account_write (PAGE_CACHE_SIZE ); } radix_tree_tag_set(&mapping->page_tree,
mm/page-writeback.c +236 -32
410 lines not on this page · raw message
mm/truncate.c +2 -0
@@ -72,6 +72,8 @@ void cancel_dirty_page(struct page *pagestruct address_space *mapping = page->mapping;if (mapping &&mapping_cap_account_dirty (mapping)) {dec_zone_page_state (page,NR_FILE_DIRTY ); +dec_bdi_stat (mapping->backing_dev_info, +BDI_RECLAIMABLE );if (account_size)task_io_account_cancelled_write (account_size); }
lib/proportions.c new file +385 -0
385 lines not on this page · raw message
include/linux/proportions.h new file +119 -0
119 lines not on this page · raw message
lib/Makefile +2 -1
@@ -5,7 +5,8 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \ rbtree.o radix-tree.o dump_stack.o \ idr.o int_sqrt.o bitmap.o extable.o prio_tree.o \ - sha1.o irq_regs.o reciprocal_div.o + sha1.o irq_regs.o reciprocal_div.o \ + proportions.o lib-$(CONFIG_MMU) += ioremap.o lib-$(CONFIG_SMP) += cpumask.o
kernel/sysctl.c +5 -1
@@ -160,6 +160,10 @@ extern ctl_table inotify_table[];int sysctl_legacy_va_layout;#endif +extern int dirty_ratio_handler (ctl_table *table,int write, +struct file *filp,void __user *buffer,size_t *lenp, +loff_t *ppos); +/* The default sysctl tables: */
@@ -675,7 +679,7 @@ static ctl_table vm_table[] = { .data = &vm_dirty_ratio, .maxlen = sizeof(vm_dirty_ratio), .mode = 0644, - .proc_handler = &proc_dointvec_minmax, + .proc_handler = &dirty_ratio_handler, .strategy = &sysctl_intvec, .extra1 = &zero, .extra2 = &one_hundred,
include/linux/sched.h +2 -0
@@ -83,6 +83,7 @@ struct sched_param {#include <linux/timer.h> #include <linux/hrtimer.h> #include <linux/task_io_accounting.h> +#include <linux/proportions.h> #include <asm/processor.h>
@@ -1076,6 +1077,7 @@ struct task_struct {#ifdef CONFIG_FAULT_INJECTION int make_it_fail;#endif +struct prop_local_single dirties; };static inline pid_t process_group (struct task_struct *tsk)
kernel/fork.c +10 -0
@@ -106,6 +106,7 @@ static struct kmem_cache *mm_cachep;void free_task (struct task_struct *tsk) { +prop_local_destroy_single (&tsk->dirties);free_thread_info (tsk->stack);rt_mutex_debug_task_free (tsk);free_task_struct (tsk);
@@ -162,6 +163,7 @@ static struct task_struct *dup_task_stru {struct task_struct *tsk;struct thread_info *ti; +int err;prepare_to_copy (orig);
@@ -177,6 +179,14 @@ static struct task_struct *dup_task_stru *tsk = *orig; tsk->stack = ti; + + err =prop_local_init_single (&tsk->dirties); +if (err) { +free_thread_info (ti); +free_task_struct (tsk); +return NULL ; + } +setup_thread_stack (tsk, orig);#ifdef CONFIG_CC_STACKPROTECTOR
include/linux/init_task.h +1 -0
@@ -167,6 +167,7 @@ extern struct group_info init_groups; [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \ [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \ }, \ + .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \ INIT_TRACE_IRQFLAGS \ INIT_LOCKDEP \ }
Quoted 23 lines · --- Peter Zijlstra
Quoted 16 lines · Martin Knoblauch
Quoted 6 lines · --- Peter Zijlstra
Quoted 4 lines · Martin Knoblauch
Peter,
any chance to get a rollup against 2.6.22-stable?
Quoted 8 lines
Quoted 3 lines
The 2.6.23 series may not be usable for me due to the
nosharedcache changes for NFS (the new default will massively disturb the user-space automounter).I'll see what I can do, bit busy with other stuff atm, hopefully after
the weekend.Quoted 5 lines
Hi Peter,
any progress on a version against 2.6.22.5? I have seen the very
positive report from Jeffrey W. Baker and would really love to test your patch. But as I said, anything newer than 2.6.22.x might notbe an
Quoted 8 lines
Quoted 1 line
option due to the NFS changes.
mindless port, seems to compile and boot on my test box ymmv.
I think .5 should not present anything other than trivial rejects if anything. But I'm not keeping -stable in my git remotes so I can't say
for sure.
Hi Peter,
thanks a lot. It applies to 2.6.22.5 almost cleanly, with just one
8-line offset in readahead.c.
I will report testing-results separately.
Thanks
Martin
------------------------------------------------------
Martin Knoblauch
email: k n o b i AT knobisoft DOT de www: http://www.knobisoft.de
RFC: [PATCH] Small patch on top of per device dirty throttling -v9
In reply to Peter ZijlstraQuoted 19 lines · --- Peter Zijlstra
Quoted 18 lines · Martin Knoblauch
Quoted 6 lines · --- Peter Zijlstra
Quoted 4 lines · Martin Knoblauch
Peter,
any chance to get a rollup against 2.6.22-stable?
Quoted 8 lines
Quoted 3 lines
The 2.6.23 series may not be usable for me due to the
nosharedcache changes for NFS (the new default will massively disturb the user-space automounter).I'll see what I can do, bit busy with other stuff atm, hopefully after
the weekend.Hi Peter,
Quoted 8 lines
Quoted 3 lines
any progress on a version against 2.6.22.5? I have seen the very
positive report from Jeffrey W. Baker and would really love to test your patch. But as I said, anything newer than 2.6.22.x might notbe an
Quoted 1 line
option due to the NFS changes.
mindless port, seems to compile and boot on my test box ymmv.
Hi Peter,
while doing my tests I observed that setting dirty_ratio below 5% did
not make a difference at all. Just by chance I found that this apparently is an enforced limit in mm/page-writeback.c.
With below patch I have lowered the limit to 2%. With that, things
look a lot better on my systems. Load during write stays below 1.5 for one writer. Responsiveness is good.
This may even help without the throttling patch. Not sure that this is the right thing to do, but it helps :-)
Cheers
Martin
mm/page-writeback.c +5 -2
@@ -311,8 +311,11 @@if (dirty_ratio > unmapped_ratio /2 ) dirty_ratio = unmapped_ratio /2 ; -if (dirty_ratio <5 ) - dirty_ratio =5 ; +/* +** MKN: Lower enforced limit from 5% to 2% +*/ +if (dirty_ratio <2 ) + dirty_ratio =2 ; background_ratio = dirty_background_ratio;if (background_ratio >= dirty_ratio)
------------------------------------------------------
Martin Knoblauch
email: k n o b i AT knobisoft DOT de www: http://www.knobisoft.de