Commit de68a62a authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds

[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: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a9f3cca1
...@@ -119,7 +119,7 @@ static inline int filemap_sync_pud_range(pgd_t *pgd, ...@@ -119,7 +119,7 @@ static inline int filemap_sync_pud_range(pgd_t *pgd,
return error; return error;
} }
static int filemap_sync(struct vm_area_struct * vma, unsigned long address, static int __filemap_sync(struct vm_area_struct *vma, unsigned long address,
size_t size, unsigned int flags) size_t size, unsigned int flags)
{ {
pgd_t *pgd; pgd_t *pgd;
...@@ -163,6 +163,31 @@ static int filemap_sync(struct vm_area_struct * vma, unsigned long address, ...@@ -163,6 +163,31 @@ static int filemap_sync(struct vm_area_struct * vma, unsigned long address,
return error; 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. * MS_SYNC syncs the entire file - including mappings.
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment