Skip to content

Commit

Permalink
proc/smaps: carefully handle migration entries
Browse files Browse the repository at this point in the history
Currently smaps reports migration entries as "swap", as result "swap" can
appears in shared mapping.

This patch converts migration entries into pages and handles them as usual.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
koct9i authored and torvalds committed Jun 1, 2012
1 parent 052fb0d commit b1d4d9e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions fs/proc/task_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,18 +402,20 @@ static void smaps_pte_entry(pte_t ptent, unsigned long addr,
{
struct mem_size_stats *mss = walk->private;
struct vm_area_struct *vma = mss->vma;
struct page *page;
struct page *page = NULL;
int mapcount;

if (is_swap_pte(ptent)) {
mss->swap += ptent_size;
return;
}
if (pte_present(ptent)) {
page = vm_normal_page(vma, addr, ptent);
} else if (is_swap_pte(ptent)) {
swp_entry_t swpent = pte_to_swp_entry(ptent);

if (!pte_present(ptent))
return;
if (!non_swap_entry(swpent))
mss->swap += ptent_size;
else if (is_migration_entry(swpent))
page = migration_entry_to_page(swpent);
}

page = vm_normal_page(vma, addr, ptent);
if (!page)
return;

Expand Down

0 comments on commit b1d4d9e

Please sign in to comment.