proc/smaps: carefully handle migration entries

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>
This commit is contained in:
Konstantin Khlebnikov 2012-05-31 16:26:20 -07:00 коммит произвёл Linus Torvalds
Родитель 052fb0d635
Коммит b1d4d9e0cb
1 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -402,18 +402,20 @@ static void smaps_pte_entry(pte_t ptent, unsigned long addr,
{ {
struct mem_size_stats *mss = walk->private; struct mem_size_stats *mss = walk->private;
struct vm_area_struct *vma = mss->vma; struct vm_area_struct *vma = mss->vma;
struct page *page; struct page *page = NULL;
int mapcount; int mapcount;
if (is_swap_pte(ptent)) { if (pte_present(ptent)) {
mss->swap += ptent_size; page = vm_normal_page(vma, addr, ptent);
return; } else if (is_swap_pte(ptent)) {
swp_entry_t swpent = pte_to_swp_entry(ptent);
if (!non_swap_entry(swpent))
mss->swap += ptent_size;
else if (is_migration_entry(swpent))
page = migration_entry_to_page(swpent);
} }
if (!pte_present(ptent))
return;
page = vm_normal_page(vma, addr, ptent);
if (!page) if (!page)
return; return;