diff -urNp ref/drivers/block/ll_rw_blk.c 2.4.20pre5aa1/drivers/block/ll_rw_blk.c --- ref/drivers/block/ll_rw_blk.c Thu Aug 29 02:13:09 2002 +++ 2.4.20pre5aa1/drivers/block/ll_rw_blk.c Fri Aug 30 01:23:08 2002 @@ -1207,6 +1207,7 @@ void submit_bh(int rw, struct buffer_hea kstat.pgpgin += count; break; } + cond_resched(); } /** diff -urNp ref/fs/buffer.c 2.4.20pre5aa1/fs/buffer.c --- ref/fs/buffer.c Fri Aug 30 01:23:06 2002 +++ 2.4.20pre5aa1/fs/buffer.c Fri Aug 30 01:23:08 2002 @@ -221,6 +221,8 @@ static int write_some_buffers(kdev_t dev continue; spin_unlock(&lru_list_lock); + cond_resched(); + write_locked_buffers(array, count); return -EAGAIN; } @@ -228,6 +230,7 @@ static int write_some_buffers(kdev_t dev __refile_buffer(bh); } spin_unlock(&lru_list_lock); + cond_resched(); if (count) write_locked_buffers(array, count); @@ -273,17 +276,19 @@ static int wait_for_buffers(kdev_t dev, spin_unlock(&lru_list_lock); wait_on_buffer (bh); put_bh(bh); + cond_resched(); return -EAGAIN; } spin_unlock(&lru_list_lock); + cond_resched(); 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; } @@ -952,6 +957,7 @@ struct buffer_head * getblk(kdev_t dev, for (;;) { struct buffer_head * bh; + cond_resched(); bh = get_hash_table(dev, block, size); if (bh) { touch_buffer(bh); @@ -1119,8 +1125,10 @@ struct buffer_head * bread(kdev_t dev, i struct buffer_head * bh; bh = getblk(dev, block, size); - if (buffer_uptodate(bh)) + if (buffer_uptodate(bh)) { + cond_resched(); return bh; + } ll_rw_block(READ, 1, &bh); wait_on_buffer(bh); if (buffer_uptodate(bh)) diff -urNp ref/fs/dcache.c 2.4.20pre5aa1/fs/dcache.c --- ref/fs/dcache.c Thu Aug 29 02:13:16 2002 +++ 2.4.20pre5aa1/fs/dcache.c Fri Aug 30 01:23:08 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); + cond_resched(); } /* diff -urNp ref/fs/jbd/commit.c 2.4.20pre5aa1/fs/jbd/commit.c --- ref/fs/jbd/commit.c Thu Aug 29 02:13:17 2002 +++ 2.4.20pre5aa1/fs/jbd/commit.c Fri Aug 30 01:23:08 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); + cond_resched(); + goto write_out_data; + } } } if (bufs == ARRAY_SIZE(wbuf)) { diff -urNp ref/fs/proc/array.c 2.4.20pre5aa1/fs/proc/array.c --- ref/fs/proc/array.c Fri Aug 9 14:52:20 2002 +++ 2.4.20pre5aa1/fs/proc/array.c Fri Aug 30 01:23:08 2002 @@ -418,6 +418,8 @@ static inline void statm_pte_range(pmd_t pte_t page = *pte; struct page *ptpage; + cond_resched(); + address += PAGE_SIZE; pte++; if (pte_none(page)) diff -urNp ref/fs/proc/generic.c 2.4.20pre5aa1/fs/proc/generic.c --- ref/fs/proc/generic.c Fri Aug 9 14:52:20 2002 +++ 2.4.20pre5aa1/fs/proc/generic.c Fri Aug 30 01:23:08 2002 @@ -98,7 +98,9 @@ proc_file_read(struct file * file, char retval = n; break; } - + + cond_resched(); + /* 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 ref/mm/filemap.c 2.4.20pre5aa1/mm/filemap.c --- ref/mm/filemap.c Fri Aug 30 01:23:06 2002 +++ 2.4.20pre5aa1/mm/filemap.c Fri Aug 30 01:23:08 2002 @@ -299,11 +299,7 @@ static int truncate_list_pages(struct li page_cache_release(page); - if (current->need_resched) { - __set_current_state(TASK_RUNNING); - schedule(); - } - + cond_resched(); spin_lock(&pagecache_lock); goto restart; } @@ -409,11 +405,8 @@ static int invalidate_list_pages2(struct } page_cache_release(page); - if (current->need_resched) { - __set_current_state(TASK_RUNNING); - schedule(); - } + cond_resched(); spin_lock(&pagecache_lock); goto restart; } @@ -581,6 +574,7 @@ int filemap_fdatasync(struct address_spa UnlockPage(page); page_cache_release(page); + cond_resched(); spin_lock(&pagecache_lock); } spin_unlock(&pagecache_lock); @@ -703,6 +697,8 @@ static int page_cache_read(struct file * struct page **hash = page_hash(mapping, offset); struct page *page; + cond_resched(); + spin_lock(&pagecache_lock); page = __find_page_nolock(mapping, offset, *hash); spin_unlock(&pagecache_lock); @@ -1456,6 +1452,9 @@ page_ok: offset &= ~PAGE_CACHE_MASK; page_cache_release(page); + + cond_resched(); + if (ret == nr && desc->count) continue; break; @@ -3125,6 +3124,8 @@ unlock: UnlockPage(page); page_cache_release(page); + cond_resched(); + if (status < 0) break; } while (count);