diff -urN 2.4.11/fs/buffer.c lowlat/fs/buffer.c --- 2.4.11/fs/buffer.c Wed Oct 10 02:16:08 2001 +++ lowlat/fs/buffer.c Thu Oct 11 09:15:31 2001 @@ -231,6 +231,7 @@ static void write_unlocked_buffers(kdev_t dev) { do { + conditional_schedule(); spin_lock(&lru_list_lock); } while (write_some_buffers(dev)); run_task_queue(&tq_disk); @@ -280,6 +281,7 @@ static int wait_for_locked_buffers(kdev_t dev, int index, int refile) { do { + conditional_schedule(); spin_lock(&lru_list_lock); } while (wait_for_buffers(dev, index, refile)); return 0; diff -urN 2.4.11/fs/proc/array.c lowlat/fs/proc/array.c --- 2.4.11/fs/proc/array.c Sun Sep 23 21:11:40 2001 +++ lowlat/fs/proc/array.c Thu Oct 11 09:15:31 2001 @@ -414,6 +414,8 @@ pte_t page = *pte; struct page *ptpage; + conditional_schedule(); + address += PAGE_SIZE; pte++; if (pte_none(page)) diff -urN 2.4.11/fs/proc/generic.c lowlat/fs/proc/generic.c --- 2.4.11/fs/proc/generic.c Sun Sep 23 21:11:40 2001 +++ lowlat/fs/proc/generic.c Thu Oct 11 09:15:31 2001 @@ -98,7 +98,9 @@ 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 -urN 2.4.11/include/linux/condsched.h lowlat/include/linux/condsched.h --- 2.4.11/include/linux/condsched.h Thu Jan 1 01:00:00 1970 +++ lowlat/include/linux/condsched.h Thu Oct 11 09:15:31 2001 @@ -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 -urN 2.4.11/include/linux/sched.h lowlat/include/linux/sched.h --- 2.4.11/include/linux/sched.h Sun Sep 23 21:11:42 2001 +++ lowlat/include/linux/sched.h Thu Oct 11 09:15:31 2001 @@ -13,6 +13,7 @@ #include #include #include +#include #include #include diff -urN 2.4.11/mm/filemap.c lowlat/mm/filemap.c --- 2.4.11/mm/filemap.c Wed Oct 10 02:16:27 2001 +++ lowlat/mm/filemap.c Thu Oct 11 09:16:27 2001 @@ -1264,6 +1264,9 @@ offset &= ~PAGE_CACHE_MASK; page_cache_release(page); + + conditional_schedule(); + if (ret == nr && desc->count) continue; break; @@ -2750,6 +2753,8 @@ SetPageReferenced(page); UnlockPage(page); page_cache_release(page); + + conditional_schedule(); if (status < 0) break;