diff options
author | Ingo Molnar <mingo@elte.hu> | 2005-01-07 21:52:14 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@evo.osdl.org> | 2005-01-07 21:52:14 -0800 |
commit | de68a62a9e393cff4f5256e15302deb59b78ed28 (patch) | |
tree | 4f74519b6247e0db3b4fa15dd46a018a45ad4c67 /mm | |
parent | a9f3cca1b083d1396720cf7981332c73b02d7459 (diff) | |
download | history-de68a62a9e393cff4f5256e15302deb59b78ed28.tar.gz |
[PATCH] sched: mm: fix scheduling latencies in filemap_sync()
The attached patch, written by Andrew Morton, fixes long scheduling
latencies in filemap_sync().
Has been tested as part of the -VP patchset.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/msync.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/mm/msync.c b/mm/msync.c index cf499f463626d6..b387bac348f94c 100644 --- a/mm/msync.c +++ b/mm/msync.c @@ -119,8 +119,8 @@ static inline int filemap_sync_pud_range(pgd_t *pgd, return error; } -static int filemap_sync(struct vm_area_struct * vma, unsigned long address, - size_t size, unsigned int flags) +static int __filemap_sync(struct vm_area_struct *vma, unsigned long address, + size_t size, unsigned int flags) { pgd_t *pgd; unsigned long end = address + size; @@ -163,6 +163,31 @@ static int filemap_sync(struct vm_area_struct * vma, unsigned long address, return error; } +#ifdef CONFIG_PREEMPT +static int filemap_sync(struct vm_area_struct *vma, unsigned long address, + size_t size, unsigned int flags) +{ + const size_t chunk = 64 * 1024; /* bytes */ + int error = 0; + + while (size) { + size_t sz = min(size, chunk); + + error |= __filemap_sync(vma, address, sz, flags); + cond_resched(); + address += sz; + size -= sz; + } + return error; +} +#else +static int filemap_sync(struct vm_area_struct *vma, unsigned long address, + size_t size, unsigned int flags) +{ + return __filemap_sync(vma, address, size, flags); +} +#endif + /* * MS_SYNC syncs the entire file - including mappings. * |