Skip to content

Commit b6fb293

Browse files
jankaradjbw
authored andcommitted
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. Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent f5b7b74 commit b6fb293

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

fs/proc/task_mmu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
664664
[ilog2(VM_ACCOUNT)] = "ac",
665665
[ilog2(VM_NORESERVE)] = "nr",
666666
[ilog2(VM_HUGETLB)] = "ht",
667+
[ilog2(VM_SYNC)] = "sf",
667668
[ilog2(VM_ARCH_1)] = "ar",
668669
[ilog2(VM_WIPEONFORK)] = "wf",
669670
[ilog2(VM_DONTDUMP)] = "dd",

include/linux/mm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ extern unsigned int kobjsize(const void *objp);
189189
#define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */
190190
#define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */
191191
#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */
192+
#define VM_SYNC 0x00800000 /* Synchronous page faults */
192193
#define VM_ARCH_1 0x01000000 /* Architecture-specific flag */
193194
#define VM_WIPEONFORK 0x02000000 /* Wipe VMA contents in child. */
194195
#define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */

include/linux/mman.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
/*
1111
* Arrange for legacy / undefined architecture specific flags to be
12-
* ignored by default in LEGACY_MAP_MASK.
12+
* ignored by mmap handling code.
1313
*/
1414
#ifndef MAP_32BIT
1515
#define MAP_32BIT 0
@@ -23,6 +23,9 @@
2323
#ifndef MAP_UNINITIALIZED
2424
#define MAP_UNINITIALIZED 0
2525
#endif
26+
#ifndef MAP_SYNC
27+
#define MAP_SYNC 0
28+
#endif
2629

2730
/*
2831
* The historical set of flags that all mmap implementations implicitly
@@ -126,7 +129,8 @@ calc_vm_flag_bits(unsigned long flags)
126129
{
127130
return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) |
128131
_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 );
130134
}
131135

132136
unsigned long vm_commit_limit(void);

include/uapi/asm-generic/mman.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#define MAP_NONBLOCK 0x10000 /* do not block on IO */
1313
#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
1414
#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
15+
#define MAP_SYNC 0x80000 /* perform synchronous page faults for the mapping */
1516

1617
/* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */
1718

0 commit comments

Comments
 (0)