提交 2d90508f 编写于 作者: N Nikanth Karthikesan 提交者: Linus Torvalds

mm: smaps: export mlock information

Currently there is no way to find whether a process has locked its pages
in memory or not.  And which of the memory regions are locked in memory.

Add a new field "Locked" to export this information via the smaps file.
Signed-off-by: NNikanth Karthikesan <knikanth@suse.de>
Acked-by: NBalbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: NWu Fengguang <fengguang.wu@intel.com>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 62c70bce
...@@ -375,6 +375,7 @@ Anonymous: 0 kB ...@@ -375,6 +375,7 @@ Anonymous: 0 kB
Swap: 0 kB Swap: 0 kB
KernelPageSize: 4 kB KernelPageSize: 4 kB
MMUPageSize: 4 kB MMUPageSize: 4 kB
Locked: 374 kB
The first of these lines shows the same information as is displayed for the The first of these lines shows the same information as is displayed for the
mapping in /proc/PID/maps. The remaining lines show the size of the mapping mapping in /proc/PID/maps. The remaining lines show the size of the mapping
...@@ -670,6 +671,8 @@ varies by architecture and compile options. The following is from a ...@@ -670,6 +671,8 @@ varies by architecture and compile options. The following is from a
> cat /proc/meminfo > cat /proc/meminfo
The "Locked" indicates whether the mapping is locked in memory or not.
MemTotal: 16344972 kB MemTotal: 16344972 kB
MemFree: 13634064 kB MemFree: 13634064 kB
......
...@@ -418,7 +418,8 @@ static int show_smap(struct seq_file *m, void *v) ...@@ -418,7 +418,8 @@ static int show_smap(struct seq_file *m, void *v)
"Anonymous: %8lu kB\n" "Anonymous: %8lu kB\n"
"Swap: %8lu kB\n" "Swap: %8lu kB\n"
"KernelPageSize: %8lu kB\n" "KernelPageSize: %8lu kB\n"
"MMUPageSize: %8lu kB\n", "MMUPageSize: %8lu kB\n"
"Locked: %8lu kB\n",
(vma->vm_end - vma->vm_start) >> 10, (vma->vm_end - vma->vm_start) >> 10,
mss.resident >> 10, mss.resident >> 10,
(unsigned long)(mss.pss >> (10 + PSS_SHIFT)), (unsigned long)(mss.pss >> (10 + PSS_SHIFT)),
...@@ -430,7 +431,9 @@ static int show_smap(struct seq_file *m, void *v) ...@@ -430,7 +431,9 @@ static int show_smap(struct seq_file *m, void *v)
mss.anonymous >> 10, mss.anonymous >> 10,
mss.swap >> 10, mss.swap >> 10,
vma_kernel_pagesize(vma) >> 10, vma_kernel_pagesize(vma) >> 10,
vma_mmu_pagesize(vma) >> 10); vma_mmu_pagesize(vma) >> 10,
(vma->vm_flags & VM_LOCKED) ?
(unsigned long)(mss.pss >> (10 + PSS_SHIFT)) : 0);
if (m->count < m->size) /* vma is copied successfully */ if (m->count < m->size) /* vma is copied successfully */
m->version = (vma != get_gate_vma(task)) ? vma->vm_start : 0; m->version = (vma != get_gate_vma(task)) ? vma->vm_start : 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册