[<prev] [next>] [day] [month] [year] [list]
Message-ID: <524B6AB0.6030009@jp.fujitsu.com>
Date: Tue, 01 Oct 2013 20:37:04 -0400
From: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To: ccross@...roid.com
CC: linux-kernel@...r.kernel.org, penberg@...nel.org,
dave.hansen@...el.com, peterz@...radead.org, mingo@...nel.org,
oleg@...hat.com, ebiederm@...ssion.com, jan.glauber@...il.com,
rob@...dley.net, akpm@...ux-foundation.org, gorcunov@...nvz.org,
rientjes@...gle.com, dave@....org, keescook@...omium.org,
xemul@...allels.com, liwanp@...ux.vnet.ibm.com, walken@...gle.com,
mgorman@...e.de, riel@...hat.com, jiang.liu@...wei.com,
khlebnikov@...nvz.org, paulmck@...ux.vnet.ibm.com,
dhowells@...hat.com, arnd@...db.de, davej@...hat.com, holt@....com,
rafael.j.wysocki@...el.com, shli@...ionio.com,
sasha.levin@...cle.com, kosaki.motohiro@...fujitsu.com,
hughd@...gle.com, hannes@...xchg.org, a.p.zijlstra@...llo.nl,
linux-doc@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCHv2 2/2] mm: add a field to store names for private anonymous
memory
> +static void seq_print_vma_name(struct seq_file *m, struct vm_area_struct *vma)
> +{
> + const char __user *name = vma_get_anon_name(vma);
> + struct mm_struct *mm = vma->vm_mm;
> +
> + unsigned long page_start_vaddr;
> + unsigned long page_offset;
> + unsigned long num_pages;
> + unsigned long max_len = NAME_MAX;
> + int i;
> +
> + page_start_vaddr = (unsigned long)name & PAGE_MASK;
> + page_offset = (unsigned long)name - page_start_vaddr;
> + num_pages = DIV_ROUND_UP(page_offset + max_len, PAGE_SIZE);
> +
> + seq_puts(m, "[anon:");
> +
> + for (i = 0; i < num_pages; i++) {
> + int len;
> + int write_len;
> + const char *kaddr;
> + long pages_pinned;
> + struct page *page;
> +
> + pages_pinned = get_user_pages(current, mm, page_start_vaddr,
> + 1, 0, 0, &page, NULL);
> + if (pages_pinned < 1) {
> + seq_puts(m, "<fault>]");
> + return;
> + }
> +
> + kaddr = (const char *)kmap(page);
> + len = min(max_len, PAGE_SIZE - page_offset);
You can't show the name if the name is placed in end of page.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists