From 548ac1def5c7e55ef312d7aa320dbd890a040d1f Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 2 Apr 2003 16:27:26 -0800 Subject: [PATCH] [PATCH] tmpfs 5/6: use cond_resched 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 file changed, 4 insertions(+) diff --git a/mm/shmem.c b/mm/shmem.c index a1bff8caab34f..ca44cbbf438ea 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1211,6 +1211,8 @@ shmem_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos) 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 file *filp, loff_t *ppos, read_descriptor_ page_cache_release(page); if (ret != nr || !desc->count) break; + + cond_resched(); } *ppos = ((loff_t) index << PAGE_CACHE_SHIFT) + offset; -- 2.53.0