From: Hugh Dickins cond_resched each time around the loop in shmem_file_write and do_shmem_file_read, matching filemap.c. mm/shmem.c | 4 ++++ 1 files changed, 4 insertions(+) diff -puN mm/shmem.c~tmpfs-4-use-cond_resched mm/shmem.c --- 25/mm/shmem.c~tmpfs-4-use-cond_resched 2003-04-02 22:51:11.000000000 -0800 +++ 25-akpm/mm/shmem.c 2003-04-02 22:51:11.000000000 -0800 @@ -1211,6 +1211,8 @@ shmem_file_write(struct file *file, cons buf += bytes; if (pos > inode->i_size) inode->i_size = pos; + + cond_resched(); } while (count); *ppos = pos; @@ -1302,6 +1304,8 @@ static void do_shmem_file_read(struct fi page_cache_release(page); if (ret != nr || !desc->count) break; + + cond_resched(); } *ppos = ((loff_t) index << PAGE_CACHE_SHIFT) + offset; _