History

mm: Define MAP_SYNC and VM_SYNC flags

Define new MAP_SYNC flag and corresponding VMA VM_SYNC flag. As the MAP_SYNC flag is not part of LEGACY_MAP_MASK, currently it will be refused by all MAP_SHARED_VALIDATE map attempts and silently ignored for everything else.

Jan Kara committed 9 years ago

Commit b6fb2931 parent f5b7b744 files · +9 −2Browse files

Unified · Split

4 files
  1. fs/proc/task_mmu.c +1 −0
  2. include/linux/mm.h +1 −0
  3. include/linux/mman.h +6 −2
  4. include/uapi/asm-generic/mman.h +1 −0
fs/proc/task_mmu.c+1−0
@@ -664,6 +664,7 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma) · 663 unmodified lines
664 [ilog2(VM_ACCOUNT)] = "ac",664 [ilog2(VM_ACCOUNT)] = "ac",
665 [ilog2(VM_NORESERVE)] = "nr",665 [ilog2(VM_NORESERVE)] = "nr",
666 [ilog2(VM_HUGETLB)] = "ht",666 [ilog2(VM_HUGETLB)] = "ht",
667 [ilog2(VM_SYNC)] = "sf",
667 [ilog2(VM_ARCH_1)] = "ar",668 [ilog2(VM_ARCH_1)] = "ar",
668 [ilog2(VM_WIPEONFORK)] = "wf",669 [ilog2(VM_WIPEONFORK)] = "wf",
669 [ilog2(VM_DONTDUMP)] = "dd",670 [ilog2(VM_DONTDUMP)] = "dd",
include/linux/mm.h+1−0
@@ -189,6 +189,7 @@ extern unsigned int kobjsize(const void *objp); · 188 unmodified lines
189#define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */189#define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */
190#define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */190#define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */
191#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */191#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */
192#define VM_SYNC 0x00800000 /* Synchronous page faults */
192#define VM_ARCH_1 0x01000000 /* Architecture-specific flag */193#define VM_ARCH_1 0x01000000 /* Architecture-specific flag */
193#define VM_WIPEONFORK 0x02000000 /* Wipe VMA contents in child. */194#define VM_WIPEONFORK 0x02000000 /* Wipe VMA contents in child. */
194#define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */195#define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */
include/linux/mman.h+6−2
@@ -9,7 +9,7 @@ · 8 unmodified lines
9 9
10/*10/*
11 * Arrange for legacy / undefined architecture specific flags to be11 * Arrange for legacy / undefined architecture specific flags to be
12 * ignored by default in LEGACY_MAP_MASK.12 * ignored by mmap handling code.
13 */13 */
14#ifndef MAP_32BIT14#ifndef MAP_32BIT
15#define MAP_32BIT 015#define MAP_32BIT 0
@@ -23,6 +23,9 @@ · 7 unmodified lines
23#ifndef MAP_UNINITIALIZED23#ifndef MAP_UNINITIALIZED
24#define MAP_UNINITIALIZED 024#define MAP_UNINITIALIZED 0
25#endif25#endif
26#ifndef MAP_SYNC
27#define MAP_SYNC 0
28#endif
26 29
27/*30/*
28 * The historical set of flags that all mmap implementations implicitly31 * The historical set of flags that all mmap implementations implicitly
@@ -126,7 +129,8 @@ calc_vm_flag_bits(unsigned long flags) · 97 unmodified lines
126{129{
127 return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) |130 return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) |
128 _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) |131 _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) |
129 _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED );132 _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED ) |
133 _calc_vm_trans(flags, MAP_SYNC, VM_SYNC );
130}134}
131 135
132unsigned long vm_commit_limit(void);136unsigned long vm_commit_limit(void);
include/uapi/asm-generic/mman.h+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
12#define MAP_NONBLOCK 0x10000 /* do not block on IO */12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
13#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */13#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
14#define MAP_HUGETLB 0x40000 /* create a huge page mapping */14#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
15#define MAP_SYNC 0x80000 /* perform synchronous page faults for the mapping */
15 16
16/* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */17/* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */
17 18

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t