From: Cyrill Gorcunov <gorcunov@openvz.org>
To: linux-kernel@vger.kernel.org
Cc: Pavel Emelyanov <xemul@parallels.com>,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Cyrill Gorcunov <gorcunov@openvz.org>
Subject: [rfc 1/2] [RFC] procfs: Add VmFlags field in smaps output
Date: Mon, 22 Oct 2012 23:14:53 +0400 [thread overview]
Message-ID: <20121022192020.193773807@openvz.org> (raw)
In-Reply-To: 20121022191452.785366817@openvz.org
[-- Attachment #1: mm-vma-flags-4 --]
[-- Type: text/plain, Size: 2490 bytes --]
When we do restore VMA area after checkpoint we would like
to know if the area was locked or say it had mergeable attribute,
but at moment the kernel does not provide such information, thus
we can't figure out if we should call mlock/madvise on VMA restore.
This patch adds new VmFlags field to smaps output with vma->vm_flags
encoded.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Pavel Emelyanov <xemul@parallels.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
fs/proc/task_mmu.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
Index: linux-2.6.git/fs/proc/task_mmu.c
===================================================================
--- linux-2.6.git.orig/fs/proc/task_mmu.c
+++ linux-2.6.git/fs/proc/task_mmu.c
@@ -480,6 +480,36 @@ static int smaps_pte_range(pmd_t *pmd, u
return 0;
}
+static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
+{
+ /*
+ * Don't forget to update Documentation/ on changes.
+ */
+#define __VM_FLAG(_f) (!!(vma->vm_flags & (_f)))
+ seq_printf(m, "VmFlags: "
+ "RD:%d WR:%d EX:%d SH:%d MR:%d "
+ "MW:%d ME:%d MS:%d GD:%d PF:%d "
+ "DW:%d LO:%d IO:%d SR:%d RR:%d "
+ "DC:%d DE:%d AC:%d NR:%d HT:%d "
+ "NL:%d AR:%d DD:%d MM:%d HG:%d "
+ "NH:%d MG:%d\n",
+ __VM_FLAG(VM_READ), __VM_FLAG(VM_WRITE),
+ __VM_FLAG(VM_EXEC), __VM_FLAG(VM_SHARED),
+ __VM_FLAG(VM_MAYREAD), __VM_FLAG(VM_MAYWRITE),
+ __VM_FLAG(VM_MAYEXEC), __VM_FLAG(VM_MAYSHARE),
+ __VM_FLAG(VM_GROWSDOWN), __VM_FLAG(VM_PFNMAP),
+ __VM_FLAG(VM_DENYWRITE), __VM_FLAG(VM_LOCKED),
+ __VM_FLAG(VM_IO), __VM_FLAG(VM_SEQ_READ),
+ __VM_FLAG(VM_RAND_READ), __VM_FLAG(VM_DONTCOPY),
+ __VM_FLAG(VM_DONTEXPAND), __VM_FLAG(VM_ACCOUNT),
+ __VM_FLAG(VM_NORESERVE), __VM_FLAG(VM_HUGETLB),
+ __VM_FLAG(VM_NONLINEAR), __VM_FLAG(VM_ARCH_1),
+ __VM_FLAG(VM_DONTDUMP), __VM_FLAG(VM_MIXEDMAP),
+ __VM_FLAG(VM_HUGEPAGE), __VM_FLAG(VM_NOHUGEPAGE),
+ __VM_FLAG(VM_MERGEABLE));
+#undef __VM_FLAG
+}
+
static int show_smap(struct seq_file *m, void *v, int is_pid)
{
struct proc_maps_private *priv = m->private;
@@ -535,6 +565,8 @@ static int show_smap(struct seq_file *m,
seq_printf(m, "Nonlinear: %8lu kB\n",
mss.nonlinear >> 10);
+ show_smap_vma_flags(m, vma);
+
if (m->count < m->size) /* vma is copied successfully */
m->version = (vma != get_gate_vma(task->mm))
? vma->vm_start : 0;
next prev parent reply other threads:[~2012-10-22 19:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-22 19:14 [rfc 0/2] Introducing VmFlags field into smaps output Cyrill Gorcunov
2012-10-22 19:14 ` Cyrill Gorcunov [this message]
2012-10-22 19:14 ` [rfc 2/2] [RFC] procfs: Documantation -- Add VmFlags field description Cyrill Gorcunov
2012-10-22 19:29 ` [rfc 0/2] Introducing VmFlags field into smaps output Andrew Morton
2012-10-22 19:39 ` Cyrill Gorcunov
2012-10-22 20:50 ` Pavel Emelyanov
2012-10-22 20:56 ` Cyrill Gorcunov
2012-10-22 21:34 ` Cyrill Gorcunov
2012-10-22 21:51 ` Andrew Morton
2012-10-23 6:13 ` Cyrill Gorcunov
2012-10-23 6:30 ` Andrew Morton
2012-10-23 6:34 ` Cyrill Gorcunov
2012-10-23 7:15 ` Cyrill Gorcunov
2012-10-23 21:30 ` Andrew Morton
2012-10-23 21:46 ` Cyrill Gorcunov
2012-10-23 21:59 ` Cyrill Gorcunov
2012-10-23 22:32 ` Peter Zijlstra
2012-10-23 23:56 ` Stephen Rothwell
2012-10-24 6:30 ` Cyrill Gorcunov
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=20121022192020.193773807@openvz.org \
--to=gorcunov@openvz.org \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.