lkml.org 
[lkml]   [2004]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[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.

Ingo

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>

--- linux/mm/msync.c.orig
+++ linux/mm/msync.c
@@ -92,8 +92,8 @@ static inline int filemap_sync_pmd_range
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 * dir;
unsigned long end = address + size;
@@ -131,6 +131,31 @@ static int filemap_sync(struct vm_area_s
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.
*
\
 
 \ /
  Last update: 2005-03-22 14:06    [W:0.888 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site