From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: ccross@android.com
Cc: linux-kernel@vger.kernel.org, penberg@kernel.org,
dave.hansen@intel.com, peterz@infradead.org, mingo@kernel.org,
oleg@redhat.com, ebiederm@xmission.com, jan.glauber@gmail.com,
rob@landley.net, akpm@linux-foundation.org, gorcunov@openvz.org,
rientjes@google.com, dave@gnu.org, keescook@chromium.org,
xemul@parallels.com, liwanp@linux.vnet.ibm.com,
walken@google.com, mgorman@suse.de, riel@redhat.com,
jiang.liu@huawei.com, khlebnikov@openvz.org,
paulmck@linux.vnet.ibm.com, dhowells@redhat.com, arnd@arndb.de,
davej@redhat.com, holt@sgi.com, rafael.j.wysocki@intel.com,
shli@fusionio.com, sasha.levin@oracle.com,
kosaki.motohiro@jp.fujitsu.com, hughd@google.com,
hannes@cmpxchg.org, a.p.zijlstra@chello.nl,
linux-doc@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCHv2 2/2] mm: add a field to store names for private anonymous memory
Date: Tue, 01 Oct 2013 20:37:04 -0400 [thread overview]
Message-ID: <524B6AB0.6030009@jp.fujitsu.com> (raw)
In-Reply-To: <1380658901-11666-2-git-send-email-ccross@android.com>
> +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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2013-10-02 0:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-01 20:21 [PATCHv2 1/2] mm: rearrange madvise code to allow for reuse Colin Cross
2013-10-01 20:21 ` [PATCHv2 2/2] mm: add a field to store names for private anonymous memory Colin Cross
2013-10-01 21:12 ` Dave Hansen
2013-10-01 21:59 ` Colin Cross
2013-10-01 22:05 ` Colin Cross
2013-10-02 0:37 ` KOSAKI Motohiro [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=524B6AB0.6030009@jp.fujitsu.com \
--to=kosaki.motohiro@jp.fujitsu.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=ccross@android.com \
--cc=dave.hansen@intel.com \
--cc=dave@gnu.org \
--cc=davej@redhat.com \
--cc=dhowells@redhat.com \
--cc=ebiederm@xmission.com \
--cc=gorcunov@openvz.org \
--cc=hannes@cmpxchg.org \
--cc=holt@sgi.com \
--cc=hughd@google.com \
--cc=jan.glauber@gmail.com \
--cc=jiang.liu@huawei.com \
--cc=keescook@chromium.org \
--cc=khlebnikov@openvz.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liwanp@linux.vnet.ibm.com \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=penberg@kernel.org \
--cc=peterz@infradead.org \
--cc=rafael.j.wysocki@intel.com \
--cc=riel@redhat.com \
--cc=rientjes@google.com \
--cc=rob@landley.net \
--cc=sasha.levin@oracle.com \
--cc=shli@fusionio.com \
--cc=walken@google.com \
--cc=xemul@parallels.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox