Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 11327
b: refs/heads/master
c: 0c942a4
h: refs/heads/master
i:
  11325: 117860c
  11323: 765298b
  11319: ff38810
  11311: ff3e0f9
  11295: a75d3b4
  11263: 64a15b2
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Oct 30, 2005
1 parent db7413e commit 2324417
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e040f218bb49a6965a5b77edce05fe47a62dda39
refs/heads/master: 0c942a4539c09adf09097315cc174aefd0eeedf7
38 changes: 14 additions & 24 deletions trunk/mm/msync.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,21 @@ static void msync_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
unsigned long addr, unsigned long end)
{
pte_t *pte;
int progress = 0;

again:
pte = pte_offset_map(pmd, addr);
do {
unsigned long pfn;
struct page *page;

if (progress >= 64) {
progress = 0;
if (need_resched() ||
need_lockbreak(&vma->vm_mm->page_table_lock))
break;
}
progress++;
if (!pte_present(*pte))
continue;
if (!pte_maybe_dirty(*pte))
Expand All @@ -46,8 +55,12 @@ static void msync_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
if (ptep_clear_flush_dirty(vma, addr, pte) ||
page_test_and_clear_dirty(page))
set_page_dirty(page);
progress += 3;
} while (pte++, addr += PAGE_SIZE, addr != end);
pte_unmap(pte - 1);
cond_resched_lock(&vma->vm_mm->page_table_lock);
if (addr != end)
goto again;
}

static inline void msync_pmd_range(struct vm_area_struct *vma, pud_t *pud,
Expand Down Expand Up @@ -106,29 +119,6 @@ static void msync_page_range(struct vm_area_struct *vma,
spin_unlock(&mm->page_table_lock);
}

#ifdef CONFIG_PREEMPT
static inline void filemap_msync(struct vm_area_struct *vma,
unsigned long addr, unsigned long end)
{
const size_t chunk = 64 * 1024; /* bytes */
unsigned long next;

do {
next = addr + chunk;
if (next > end || next < addr)
next = end;
msync_page_range(vma, addr, next);
cond_resched();
} while (addr = next, addr != end);
}
#else
static inline void filemap_msync(struct vm_area_struct *vma,
unsigned long addr, unsigned long end)
{
msync_page_range(vma, addr, end);
}
#endif

/*
* MS_SYNC syncs the entire file - including mappings.
*
Expand All @@ -150,7 +140,7 @@ static int msync_interval(struct vm_area_struct *vma,
return -EBUSY;

if (file && (vma->vm_flags & VM_SHARED)) {
filemap_msync(vma, addr, end);
msync_page_range(vma, addr, end);

if (flags & MS_SYNC) {
struct address_space *mapping = file->f_mapping;
Expand Down

0 comments on commit 2324417

Please sign in to comment.