Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176292
b: refs/heads/master
c: 73848b4
h: refs/heads/master
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Dec 15, 2009
1 parent 0d58489 commit da8bd0e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 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: 08beca44dfb0ab008e365163df70dbd302ae1508
refs/heads/master: 73848b4684e84a84cfd1555af78d41158f31e16b
3 changes: 2 additions & 1 deletion trunk/mm/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ static inline int is_mlocked_vma(struct vm_area_struct *vma, struct page *page)
}

/*
* must be called with vma's mmap_sem held for read, and page locked.
* must be called with vma's mmap_sem held for read or write, and page locked.
*/
extern void mlock_vma_page(struct page *page);
extern void munlock_vma_page(struct page *page);

/*
* Clear the page's PageMlocked(). This can be useful in a situation where
Expand Down
4 changes: 4 additions & 0 deletions trunk/mm/ksm.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <linux/ksm.h>

#include <asm/tlbflush.h>
#include "internal.h"

/*
* A few notes about the KSM scanning process,
Expand Down Expand Up @@ -762,6 +763,9 @@ static int try_to_merge_one_page(struct vm_area_struct *vma,
pages_identical(page, kpage))
err = replace_page(vma, page, kpage, orig_pte);

if ((vma->vm_flags & VM_LOCKED) && !err)
munlock_vma_page(page);

unlock_page(page);
out:
return err;
Expand Down
4 changes: 2 additions & 2 deletions trunk/mm/mlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ void mlock_vma_page(struct page *page)
* not get another chance to clear PageMlocked. If we successfully
* isolate the page and try_to_munlock() detects other VM_LOCKED vmas
* mapping the page, it will restore the PageMlocked state, unless the page
* is mapped in a non-linear vma. So, we go ahead and SetPageMlocked(),
* is mapped in a non-linear vma. So, we go ahead and ClearPageMlocked(),
* perhaps redundantly.
* If we lose the isolation race, and the page is mapped by other VM_LOCKED
* vmas, we'll detect this in vmscan--via try_to_munlock() or try_to_unmap()
* either of which will restore the PageMlocked state by calling
* mlock_vma_page() above, if it can grab the vma's mmap sem.
*/
static void munlock_vma_page(struct page *page)
void munlock_vma_page(struct page *page)
{
BUG_ON(!PageLocked(page));

Expand Down

0 comments on commit da8bd0e

Please sign in to comment.