diff -urNp 2.4.19pre10/drivers/block/ll_rw_blk.c lowlat/drivers/block/ll_rw_blk.c --- 2.4.19pre10/drivers/block/ll_rw_blk.c Tue Jun 4 06:11:52 2002 +++ lowlat/drivers/block/ll_rw_blk.c Thu Jun 6 17:20:25 2002 @@ -1130,6 +1130,7 @@ void submit_bh(int rw, struct buffer_hea kstat.pgpgin += count; break; } + conditional_schedule(); } /** diff -urNp 2.4.19pre10/fs/buffer.c lowlat/fs/buffer.c --- 2.4.19pre10/fs/buffer.c Tue Jun 4 06:12:02 2002 +++ lowlat/fs/buffer.c Thu Jun 6 17:20:25 2002 @@ -222,6 +222,8 @@ static int write_some_buffers(kdev_t dev continue; spin_unlock(&lru_list_lock); + conditional_schedule(); + write_locked_buffers(array, count); return -EAGAIN; } @@ -229,6 +231,7 @@ static int write_some_buffers(kdev_t dev __refile_buffer(bh); } spin_unlock(&lru_list_lock); + conditional_schedule(); if (count) write_locked_buffers(array, count); @@ -274,17 +277,19 @@ static int wait_for_buffers(kdev_t dev, spin_unlock(&lru_list_lock); wait_on_buffer (bh); put_bh(bh); + conditional_schedule(); return -EAGAIN; } spin_unlock(&lru_list_lock); + conditional_schedule(); return 0; } static int wait_for_locked_buffers(kdev_t dev, int index, int refile) { - do { + do spin_lock(&lru_list_lock); - } while (wait_for_buffers(dev, index, refile)); + while (wait_for_buffers(dev, index, refile)); return 0; } @@ -948,6 +953,7 @@ struct buffer_head * getblk(kdev_t dev, for (;;) { struct buffer_head * bh; + conditional_schedule(); bh = get_hash_table(dev, block, size); if (bh) return bh; diff -urNp 2.4.19pre10/fs/dcache.c lowlat/fs/dcache.c --- 2.4.19pre10/fs/dcache.c Tue Jun 4 06:12:02 2002 +++ lowlat/fs/dcache.c Thu Jun 6 17:20:25 2002 @@ -71,7 +71,7 @@ static inline void d_free(struct dentry * d_iput() operation if defined. * Called with dcache_lock held, drops it. */ -static inline void dentry_iput(struct dentry * dentry) +static void dentry_iput(struct dentry * dentry) { struct inode *inode = dentry->d_inode; if (inode) { @@ -84,6 +84,7 @@ static inline void dentry_iput(struct de iput(inode); } else spin_unlock(&dcache_lock); + conditional_schedule(); } /* diff -urNp 2.4.19pre10/fs/jbd/commit.c lowlat/fs/jbd/commit.c --- 2.4.19pre10/fs/jbd/commit.c Mon Feb 25 22:05:08 2002 +++ lowlat/fs/jbd/commit.c Thu Jun 6 17:20:25 2002 @@ -212,6 +212,16 @@ write_out_data_locked: __journal_remove_journal_head(bh); refile_buffer(bh); __brelse(bh); + if (current->need_resched) { + if (commit_transaction->t_sync_datalist) + commit_transaction->t_sync_datalist = + next_jh; + if (bufs) + break; + spin_unlock(&journal_datalist_lock); + conditional_schedule(); + goto write_out_data; + } } } if (bufs == ARRAY_SIZE(wbuf)) { diff -urNp 2.4.19pre10/fs/proc/array.c lowlat/fs/proc/array.c --- 2.4.19pre10/fs/proc/array.c Tue Jun 4 06:12:03 2002 +++ lowlat/fs/proc/array.c Thu Jun 6 17:20:25 2002 @@ -418,6 +418,8 @@ static inline void statm_pte_range(pmd_t pte_t page = *pte; struct page *ptpage; + conditional_schedule(); + address += PAGE_SIZE; pte++; if (pte_none(page)) diff -urNp 2.4.19pre10/fs/proc/generic.c lowlat/fs/proc/generic.c --- 2.4.19pre10/fs/proc/generic.c Tue Jan 22 18:53:53 2002 +++ lowlat/fs/proc/generic.c Thu Jun 6 17:20:25 2002 @@ -98,7 +98,9 @@ proc_file_read(struct file * file, char retval = n; break; } - + + conditional_schedule(); + /* This is a hack to allow mangling of file pos independent * of actual bytes read. Simply place the data at page, * return the bytes, and set `start' to the desired offset diff -urNp 2.4.19pre10/include/linux/condsched.h lowlat/include/linux/condsched.h --- 2.4.19pre10/include/linux/condsched.h Thu Jan 1 01:00:00 1970 +++ lowlat/include/linux/condsched.h Thu Jun 6 17:20:25 2002 @@ -0,0 +1,14 @@ +#ifndef _LINUX_CONDSCHED_H +#define _LINUX_CONDSCHED_H + +#ifndef __ASSEMBLY__ +#define conditional_schedule() \ +do { \ + if (unlikely(current->need_resched)) { \ + __set_current_state(TASK_RUNNING); \ + schedule(); \ + } \ +} while(0) +#endif + +#endif diff -urNp 2.4.19pre10/include/linux/sched.h lowlat/include/linux/sched.h --- 2.4.19pre10/include/linux/sched.h Tue Jun 4 06:12:12 2002 +++ lowlat/include/linux/sched.h Thu Jun 6 17:20:25 2002 @@ -13,6 +13,7 @@ extern unsigned long event; #include #include #include +#include #include #include diff -urNp 2.4.19pre10/mm/filemap.c lowlat/mm/filemap.c --- 2.4.19pre10/mm/filemap.c Tue Jun 4 06:12:12 2002 +++ lowlat/mm/filemap.c Thu Jun 6 17:20:25 2002 @@ -295,11 +295,7 @@ static int truncate_list_pages(struct li page_cache_release(page); - if (current->need_resched) { - __set_current_state(TASK_RUNNING); - schedule(); - } - + conditional_schedule(); spin_lock(&pagecache_lock); goto restart; } @@ -405,11 +401,8 @@ static int invalidate_list_pages2(struct } page_cache_release(page); - if (current->need_resched) { - __set_current_state(TASK_RUNNING); - schedule(); - } + conditional_schedule(); spin_lock(&pagecache_lock); goto restart; } @@ -699,6 +692,8 @@ static int page_cache_read(struct file * struct page **hash = page_hash(mapping, offset); struct page *page; + conditional_schedule(); + spin_lock(&pagecache_lock); page = __find_page_nolock(mapping, offset, *hash); spin_unlock(&pagecache_lock); @@ -1432,6 +1427,9 @@ page_ok: offset &= ~PAGE_CACHE_MASK; page_cache_release(page); + + conditional_schedule(); + if (ret == nr && desc->count) continue; break; @@ -3093,6 +3091,8 @@ unlock: UnlockPage(page); page_cache_release(page); + conditional_schedule(); + if (status < 0) break; } while (count);