Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356630
b: refs/heads/master
c: 5117b3b
h: refs/heads/master
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Feb 24, 2013
1 parent 3a69f2f commit 8bcfd8b
Show file tree
Hide file tree
Showing 4 changed files with 21 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: bc56620b493496b8a6962080b644ccc537f4d526
refs/heads/master: 5117b3b835f288314a2d4e5512bc1747e3a7c8ed
1 change: 1 addition & 0 deletions trunk/include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1651,6 +1651,7 @@ static inline struct page *follow_page(struct vm_area_struct *vma,
#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */
#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */
#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */
#define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */

typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
void *data);
Expand Down
2 changes: 1 addition & 1 deletion trunk/mm/ksm.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ static int break_ksm(struct vm_area_struct *vma, unsigned long addr)

do {
cond_resched();
page = follow_page(vma, addr, FOLL_GET);
page = follow_page(vma, addr, FOLL_GET | FOLL_MIGRATION);
if (IS_ERR_OR_NULL(page))
break;
if (PageKsm(page))
Expand Down
20 changes: 18 additions & 2 deletions trunk/mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1548,8 +1548,24 @@ struct page *follow_page_mask(struct vm_area_struct *vma,
ptep = pte_offset_map_lock(mm, pmd, address, &ptl);

pte = *ptep;
if (!pte_present(pte))
goto no_page;
if (!pte_present(pte)) {
swp_entry_t entry;
/*
* KSM's break_ksm() relies upon recognizing a ksm page
* even while it is being migrated, so for that case we
* need migration_entry_wait().
*/
if (likely(!(flags & FOLL_MIGRATION)))
goto no_page;
if (pte_none(pte) || pte_file(pte))
goto no_page;
entry = pte_to_swp_entry(pte);
if (!is_migration_entry(entry))
goto no_page;
pte_unmap_unlock(ptep, ptl);
migration_entry_wait(mm, pmd, address);
goto split_fallthrough;
}
if ((flags & FOLL_NUMA) && pte_numa(pte))
goto no_page;
if ((flags & FOLL_WRITE) && !pte_write(pte))
Expand Down

0 comments on commit 8bcfd8b

Please sign in to comment.