diff options
author | Ingo Molnar <mingo@elte.hu> | 2010-10-07 07:43:38 (GMT) |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-10-07 07:43:45 (GMT) |
commit | 556ef63255f1a6f82910a637c4164dbf7d3d1af2 (patch) | |
tree | ae209fe4959e0837bf4eb72abc6e02c8a82179a1 /mm/rmap.c | |
parent | d4f8f217b8a5d5bd02af979650418dca4caec472 (diff) | |
parent | cb655d0f3d57c23db51b981648e452988c0223f9 (diff) | |
download | linux-fsl-qoriq-556ef63255f1a6f82910a637c4164dbf7d3d1af2.tar.xz |
Merge commit 'v2.6.36-rc7' into core/rcu
Merge reason: Update from -rc3 to -rc7.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'mm/rmap.c')
-rw-r--r-- | mm/rmap.c | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -381,7 +381,13 @@ vma_address(struct page *page, struct vm_area_struct *vma) unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma) { if (PageAnon(page)) { - if (vma->anon_vma->root != page_anon_vma(page)->root) + struct anon_vma *page__anon_vma = page_anon_vma(page); + /* + * Note: swapoff's unuse_vma() is more efficient with this + * check, and needs it to match anon_vma when KSM is active. + */ + if (!vma->anon_vma || !page__anon_vma || + vma->anon_vma->root != page__anon_vma->root) return -EFAULT; } else if (page->mapping && !(vma->vm_flags & VM_NONLINEAR)) { if (!vma->vm_file || @@ -1564,13 +1570,14 @@ static void __hugepage_set_anon_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address, int exclusive) { struct anon_vma *anon_vma = vma->anon_vma; + BUG_ON(!anon_vma); - if (!exclusive) { - struct anon_vma_chain *avc; - avc = list_entry(vma->anon_vma_chain.prev, - struct anon_vma_chain, same_vma); - anon_vma = avc->anon_vma; - } + + if (PageAnon(page)) + return; + if (!exclusive) + anon_vma = anon_vma->root; + anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON; page->mapping = (struct address_space *) anon_vma; page->index = linear_page_index(vma, address); @@ -1581,6 +1588,8 @@ void hugepage_add_anon_rmap(struct page *page, { struct anon_vma *anon_vma = vma->anon_vma; int first; + + BUG_ON(!PageLocked(page)); BUG_ON(!anon_vma); BUG_ON(address < vma->vm_start || address >= vma->vm_end); first = atomic_inc_and_test(&page->_mapcount); |