From: Dave Hansen <dave@sr71.net>
To: hpa@zytor.com
Cc: tglx@linutronix.de, mingo@redhat.com, x86@kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-ia64@vger.kernel.org, linux-mips@linux-mips.org,
qiaowei.ren@intel.com, Dave Hansen <dave@sr71.net>,
dave.hansen@linux.intel.com
Subject: [PATCH 06/11] x86, mpx: introduce VM_MPX to indicate that a VMA is MPX specific
Date: Wed, 12 Nov 2014 09:05:03 -0800 [thread overview]
Message-ID: <20141112170503.AB389ADC@viggo.jf.intel.com> (raw)
In-Reply-To: <20141112170443.B4BD0899@viggo.jf.intel.com>
From: Dave Hansen <dave.hansen@linux.intel.com>
MPX-enabled applications using large swaths of memory can
potentially have large numbers of bounds tables in process
address space to save bounds information. These tables can take
up huge swaths of memory (as much as 80% of the memory on the
system) even if we clean them up aggressively. In the worst-case
scenario, the tables can be 4x the size of the data structure
being tracked. IOW, a 1-page structure can require 4 bounds-table
pages.
Being this huge, our expectation is that folks using MPX are
going to be keen on figuring out how much memory is being
dedicated to it. So we need a way to track memory use for MPX.
If we want to specifically track MPX VMAs we need to be able to
distinguish them from normal VMAs, and keep them from getting
merged with normal VMAs. A new VM_ flag set only on MPX VMAs does
both of those things. With this flag, MPX bounds-table VMAs can
be distinguished from other VMAs, and userspace can also walk
/proc/$pid/smaps to get memory usage for MPX.
In addition to this flag, we also introduce a special ->vm_ops
specific to MPX VMAs (see the patch "add MPX specific mmap
interface"), but currently different ->vm_ops do not by
themselves prevent VMA merging, so we still need this flag.
We understand that VM_ flags are scarce and are open to other
options.
Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
---
b/fs/proc/task_mmu.c | 3 +++
b/include/linux/mm.h | 6 ++++++
2 files changed, 9 insertions(+)
diff -puN fs/proc/task_mmu.c~2014-10-14-01_12-x86-mpx-introduce-VM-MPX-to-indicate-that-a-VMA-is-MPX-specific fs/proc/task_mmu.c
--- a/fs/proc/task_mmu.c~2014-10-14-01_12-x86-mpx-introduce-VM-MPX-to-indicate-that-a-VMA-is-MPX-specific 2014-11-12 08:49:25.303862758 -0800
+++ b/fs/proc/task_mmu.c 2014-11-12 08:49:25.308862983 -0800
@@ -552,6 +552,9 @@ static void show_smap_vma_flags(struct s
[ilog2(VM_GROWSDOWN)] = "gd",
[ilog2(VM_PFNMAP)] = "pf",
[ilog2(VM_DENYWRITE)] = "dw",
+#ifdef CONFIG_X86_INTEL_MPX
+ [ilog2(VM_MPX)] = "mp",
+#endif
[ilog2(VM_LOCKED)] = "lo",
[ilog2(VM_IO)] = "io",
[ilog2(VM_SEQ_READ)] = "sr",
diff -puN include/linux/mm.h~2014-10-14-01_12-x86-mpx-introduce-VM-MPX-to-indicate-that-a-VMA-is-MPX-specific include/linux/mm.h
--- a/include/linux/mm.h~2014-10-14-01_12-x86-mpx-introduce-VM-MPX-to-indicate-that-a-VMA-is-MPX-specific 2014-11-12 08:49:25.305862848 -0800
+++ b/include/linux/mm.h 2014-11-12 08:49:25.309863029 -0800
@@ -128,6 +128,7 @@ extern unsigned int kobjsize(const void
#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */
#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */
#define VM_ARCH_1 0x01000000 /* Architecture-specific flag */
+#define VM_ARCH_2 0x02000000
#define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */
#ifdef CONFIG_MEM_SOFT_DIRTY
@@ -155,6 +156,11 @@ extern unsigned int kobjsize(const void
# define VM_MAPPED_COPY VM_ARCH_1 /* T if mapped copy of data (nommu mmap) */
#endif
+#if defined(CONFIG_X86)
+/* MPX specific bounds table or bounds directory */
+# define VM_MPX VM_ARCH_2
+#endif
+
#ifndef VM_GROWSUP
# define VM_GROWSUP VM_NONE
#endif
_
--
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>
next prev parent reply other threads:[~2014-11-12 17:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-12 17:04 [PATCH 00/11] [v10] Intel MPX support Dave Hansen
2014-11-12 17:04 ` [PATCH 01/11] x86, mpx: rename cfg_reg_u and status_reg Dave Hansen
2014-11-12 17:04 ` [PATCH 02/11] mpx: extend siginfo structure to include bound violation information Dave Hansen
2014-11-12 17:04 ` [PATCH 03/11] mips: sync struct siginfo with general version Dave Hansen
2014-11-12 17:04 ` [PATCH 04/11] ia64: " Dave Hansen
2014-11-12 17:04 ` [PATCH 05/11] x86, mpx: add MPX to disaabled features Dave Hansen
2014-11-12 17:05 ` Dave Hansen [this message]
2014-11-12 17:05 ` [PATCH 07/11] x86, mpx: add MPX-specific mmap interface Dave Hansen
2014-11-12 17:05 ` [PATCH 08/11] x86, mpx: [new code] decode MPX instruction to get bound violation information Dave Hansen
2014-11-13 13:51 ` Thomas Gleixner
2014-11-12 17:05 ` [PATCH 09/11] x86, mpx: on-demand kernel allocation of bounds tables Dave Hansen
2014-11-13 14:29 ` Thomas Gleixner
2014-11-12 17:05 ` [PATCH 10/11] x86, mpx: cleanup unused bound tables Dave Hansen
2014-11-13 14:55 ` Thomas Gleixner
2014-11-13 15:29 ` Dave Hansen
2014-11-12 17:05 ` [PATCH 11/11] x86, mpx: add documentation on Intel MPX Dave Hansen
2014-11-14 15:18 [PATCH 00/11] [v11] Intel MPX support Dave Hansen
2014-11-14 15:18 ` [PATCH 06/11] x86, mpx: introduce VM_MPX to indicate that a VMA is MPX specific Dave Hansen
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=20141112170503.AB389ADC@viggo.jf.intel.com \
--to=dave@sr71.net \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=qiaowei.ren@intel.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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