Skip to contentSkip to conversation

mm: prepare for converting vm->vm_flags to 64-bit

PATCH In review Konstantin Khlebnikov 12 participants 50 messages Mar 21, 2012 – Mar 30, 2012

Subsystems (29)
lore
Share & tools
lore
#0 lore raw

cover mm: prepare for converting vm->vm_flags to 64-bit

There is good old tradition: every year somebody submit patches for extending vma->vm_flags upto 64-bits, because there no free bits left on 32-bit systems.

previous attempts:
https://lkml.org/lkml/2011/4/12/24 (KOSAKI Motohiro)
https://lkml.org/lkml/2010/4/27/23 (Benjamin Herrenschmidt)
https://lkml.org/lkml/2009/10/1/202 (Hugh Dickins)

Here already exist special type for this: vm_flags_t, but not all code uses it. So, before switching vm_flags_t from unsinged long to u64 we must spread vm_flags_t everywhere and fix all possible type-casting problems.

There is no functional changes in this patch set, it only prepares code for vma->vm_flags converting.

---

Konstantin Khlebnikov (16):
mm: introduce NR_VMA_FLAGS
mm: use vm_flags_t for vma flags
mm/shmem: use vm_flags_t for vma flags
mm/nommu: use vm_flags_t for vma flags
mm/drivers: use vm_flags_t for vma flags
mm/x86: use vm_flags_t for vma flags
mm/arm: use vm_flags_t for vma flags
mm/unicore32: use vm_flags_t for vma flags
mm/ia64: use vm_flags_t for vma flags
mm/powerpc: use vm_flags_t for vma flags
mm/s390: use vm_flags_t for vma flags
mm/mips: use vm_flags_t for vma flags
mm/parisc: use vm_flags_t for vma flags
mm/score: use vm_flags_t for vma flags
mm: cast vm_flags_t to u64 before printing
mm: vm_flags_t strict type checking

 arch/arm/include/asm/cacheflush.h                |    5 -
 arch/arm/kernel/asm-offsets.c                    |    6 +
 arch/arm/mm/fault.c                              |    2 
 arch/ia64/mm/fault.c                             |    9 +
 arch/mips/mm/c-r3k.c                             |    2 
 arch/mips/mm/c-r4k.c                             |    6 -
 arch/mips/mm/c-tx39.c                            |    2 
 arch/parisc/mm/fault.c                           |    4 -
 arch/powerpc/include/asm/mman.h                  |    2 
 arch/s390/mm/fault.c                             |    8 +
 arch/score/mm/cache.c                            |    6 -
 arch/sh/mm/tlbflush_64.c                         |    2 
 arch/unicore32/kernel/asm-offsets.c              |    6 +
 arch/unicore32/mm/fault.c                        |    2 
 arch/x86/mm/hugetlbpage.c                        |    4 -
 drivers/char/mem.c                               |    2 
 drivers/infiniband/hw/ipath/ipath_file_ops.c     |    6 +
 drivers/infiniband/hw/qib/qib_file_ops.c         |    6 +
 drivers/media/video/omap3isp/ispqueue.h          |    2 
 drivers/staging/android/ashmem.c                 |    2 
 drivers/staging/android/binder.c                 |   15 +-
 drivers/staging/tidspbridge/core/tiomap3430.c    |   13 +-
 drivers/staging/tidspbridge/rmgr/drv_interface.c |    4 -
 fs/binfmt_elf.c                                  |    2 
 fs/binfmt_elf_fdpic.c                            |   24 ++-
 fs/exec.c                                        |    2 
 fs/proc/nommu.c                                  |    3 
 fs/proc/task_nommu.c                             |   14 +-
 include/linux/backing-dev.h                      |    7 -
 include/linux/huge_mm.h                          |    4 -
 include/linux/ksm.h                              |    8 +
 include/linux/mm.h                               |  163 +++++++++++++++-------
 include/linux/mm_types.h                         |   11 +
 include/linux/mman.h                             |    4 -
 include/linux/rmap.h                             |    8 +
 include/linux/shmem_fs.h                         |    5 -
 kernel/bounds.c                                  |    2 
 kernel/events/core.c                             |    4 -
 kernel/fork.c                                    |    2 
 kernel/sys.c                                     |    4 -
 mm/backing-dev.c                                 |    4 +
 mm/huge_memory.c                                 |    2 
 mm/ksm.c                                         |    4 -
 mm/madvise.c                                     |    2 
 mm/memory.c                                      |    9 +
 mm/mlock.c                                       |    2 
 mm/mmap.c                                        |   36 ++---
 mm/mprotect.c                                    |    9 +
 mm/mremap.c                                      |    2 
 mm/nommu.c                                       |   19 +--
 mm/rmap.c                                        |   16 +-
 mm/shmem.c                                       |   54 ++++---
 mm/vmscan.c                                      |    4 -
 53 files changed, 322 insertions(+), 224 deletions(-)
Signature · 8 lines
Signature

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw

PATCH 1/16 mm: introduce NR_VMA_FLAGS

This patch adds NR_VMA_FLAGS constant into generated/bounds.h and switch type of vm_flags_t depending on it.

Cc Benjamin Herrenschmidt <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Cc Hugh Dickins <[email protected]>
---
 include/linux/mm.h       |    8 ++++++++
 include/linux/mm_types.h |    5 +++++
 kernel/bounds.c          |    2 ++
 3 files changed, 15 insertions(+), 0 deletions(-)
include/linux/mm.h +8 -0
index 5b29b4f..69915a2 100644
@@ -4,6 +4,7 @@
 #include <linux/errno.h>
 
 #ifdef __KERNEL__
+#ifndef __GENERATING_BOUNDS_H
 
 #include <linux/gfp.h>
 #include <linux/bug.h>
@@ -67,6 +68,8 @@ extern struct rw_semaphore nommu_region_sem;
 extern unsigned int kobjsize(const void *objp);
 #endif
 
+#endif /* __GENERATING_BOUNDS_H */
+
 /*
  * vm_flags in vm_area_struct, see mm_types.h.
  */
@@ -120,6 +123,10 @@ extern unsigned int kobjsize(const void *objp);
 #define VM_PFN_AT_MMAP	0x40000000	/* PFNMAP vma that is fully mapped at mmap time */
 #define VM_MERGEABLE	0x80000000	/* KSM may merge identical pages */
 
+#define __NR_VMA_FLAGS	32
+
+#ifndef __GENERATING_BOUNDS_H
+
 /* Bits set in the VMA until the stack is in its final location */
 #define VM_STACK_INCOMPLETE_SETUP	(VM_RAND_READ | VM_SEQ_READ)
 
@@ -1642,5 +1649,6 @@ static inline unsigned int debug_guardpage_minorder(void) { return 0; }
 static inline bool page_is_guard(struct page *page) { return false; }
 #endif /* CONFIG_DEBUG_PAGEALLOC */
 
+#endif /* __GENERATING_BOUNDS_H */
 #endif /* __KERNEL__ */
 #endif /* _LINUX_MM_H */
include/linux/mm_types.h +5 -0
index 76bbdaf..3aeb8f6 100644
@@ -12,6 +12,7 @@
 #include <linux/completion.h>
 #include <linux/cpumask.h>
 #include <linux/page-debug-flags.h>
+#include <generated/bounds.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
 
@@ -170,7 +171,11 @@ struct page_frag {
 #endif
 };
 
+#if (NR_VMA_FLAGS > 32)
+typedef unsigned long long __nocast vm_flags_t;
+#else
 typedef unsigned long __nocast vm_flags_t;
+#endif
 
 /*
  * A region containing a mapping of a non-memory backed file under NOMMU
kernel/bounds.c +2 -0
index 0c9b862..6d2732f 100644
@@ -7,6 +7,7 @@
 #define __GENERATING_BOUNDS_H
 /* Include headers that define the enum constants of interest */
 #include <linux/page-flags.h>
+#include <linux/mm.h>
 #include <linux/mmzone.h>
 #include <linux/kbuild.h>
 #include <linux/page_cgroup.h>
@@ -15,6 +16,7 @@ void foo(void)
 {
 	/* The enum constants to put into include/generated/bounds.h */
 	DEFINE(NR_PAGEFLAGS, __NR_PAGEFLAGS);
+	DEFINE(NR_VMA_FLAGS, __NR_VMA_FLAGS);
 	DEFINE(MAX_NR_ZONES, __MAX_NR_ZONES);
 	DEFINE(NR_PCG_FLAGS, __NR_PCG_FLAGS);
 	/* End of constants */

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw

PATCH 2/16 mm: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov

* switch type of vma->vm_flags and mm->def_flags to vm_flags_t
* introduce new constant "VM_NONE", as equivalent of zero vm_flags state
* spread vm_flags_t in the generic mm code
* fix dangerous type-casts (like int exec = vma->vm_flags & VM_EXEC)
* convert BDI_CAP_*_MAP consistency checks into BUILD_BUG_ON()

Cc Benjamin Herrenschmidt <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Cc Hugh Dickins <[email protected]>
---
 drivers/char/mem.c          |    2 +-
 fs/binfmt_elf.c             |    2 +-
 fs/exec.c                   |    2 +-
 include/linux/backing-dev.h |    7 -------
 include/linux/huge_mm.h     |    4 ++--
 include/linux/ksm.h         |    8 ++++----
 include/linux/mm.h          |   23 +++++++++++++----------
 include/linux/mm_types.h    |    4 ++--
 include/linux/mman.h        |    4 ++--
 include/linux/rmap.h        |    8 ++++----
 kernel/events/core.c        |    4 ++--
 kernel/fork.c               |    2 +-
 kernel/sys.c                |    4 ++--
 mm/backing-dev.c            |    4 ++++
 mm/huge_memory.c            |    2 +-
 mm/ksm.c                    |    4 ++--
 mm/madvise.c                |    2 +-
 mm/memory.c                 |    4 ++--
 mm/mlock.c                  |    2 +-
 mm/mmap.c                   |   36 ++++++++++++++++++------------------
 mm/mprotect.c               |    9 +++++----
 mm/mremap.c                 |    2 +-
 mm/rmap.c                   |   16 +++++++---------
 mm/vmscan.c                 |    4 ++--
 24 files changed, 79 insertions(+), 80 deletions(-)
drivers/char/mem.c +1 -1
index d6e9d08..60a6e34 100644
@@ -280,7 +280,7 @@ static unsigned long get_unmapped_area_mem(struct file *file,
 /* can't do an in-place private mapping if there's no MMU */
 static inline int private_mapping_ok(struct vm_area_struct *vma)
 {
-	return vma->vm_flags & VM_MAYSHARE;
+	return (vma->vm_flags & VM_MAYSHARE) != VM_NONE;
 }
 #else
 #define get_unmapped_area_mem	NULL
fs/binfmt_elf.c +1 -1
index 2be0d74..dce9c93 100644
@@ -572,7 +572,7 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
 	unsigned long start_code, end_code, start_data, end_data;
 	unsigned long reloc_func_desc __maybe_unused = 0;
 	int executable_stack = EXSTACK_DEFAULT;
-	unsigned long def_flags = 0;
+	vm_flags_t def_flags = VM_NONE;
 	struct {
 		struct elfhdr elf_ex;
 		struct elfhdr interp_elf_ex;
fs/exec.c +1 -1
index 4b142c5..c01aac5 100644
@@ -660,7 +660,7 @@ int setup_arg_pages(struct linux_binprm *bprm,
 	struct mm_struct *mm = current->mm;
 	struct vm_area_struct *vma = bprm->vma;
 	struct vm_area_struct *prev = NULL;
-	unsigned long vm_flags;
+	vm_flags_t vm_flags;
 	unsigned long stack_base;
 	unsigned long stack_size;
 	unsigned long stack_expand;
include/linux/backing-dev.h +0 -7
index b1038bd..1fc0249 100644
@@ -260,13 +260,6 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
 #define BDI_CAP_NO_ACCT_AND_WRITEBACK \
 	(BDI_CAP_NO_WRITEBACK | BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_ACCT_WB)
 
-#if defined(VM_MAYREAD) && \
-	(BDI_CAP_READ_MAP != VM_MAYREAD || \
-	 BDI_CAP_WRITE_MAP != VM_MAYWRITE || \
-	 BDI_CAP_EXEC_MAP != VM_MAYEXEC)
-#error please change backing_dev_info::capabilities flags
-#endif
-
 extern struct backing_dev_info default_backing_dev_info;
 extern struct backing_dev_info noop_backing_dev_info;
 
include/linux/huge_mm.h +2 -2
index f56cacb..7343ed1 100644
@@ -108,7 +108,7 @@ extern void __split_huge_page_pmd(struct mm_struct *mm, pmd_t *pmd);
 #error "hugepages can't be allocated by the buddy allocator"
 #endif
 extern int hugepage_madvise(struct vm_area_struct *vma,
-			    unsigned long *vm_flags, int advice);
+			    vm_flags_t *vm_flags, int advice);
 extern void __vma_adjust_trans_huge(struct vm_area_struct *vma,
 				    unsigned long start,
 				    unsigned long end,
@@ -177,7 +177,7 @@ static inline int split_huge_page(struct page *page)
 	do { } while (0)
 #define compound_trans_head(page) compound_head(page)
 static inline int hugepage_madvise(struct vm_area_struct *vma,
-				   unsigned long *vm_flags, int advice)
+				   vm_flags_t *vm_flags, int advice)
 {
 	BUG();
 	return 0;
include/linux/ksm.h +4 -4
index 3319a69..5de0c3d 100644
@@ -21,7 +21,7 @@ struct page *ksm_does_need_to_copy(struct page *page,
 
 #ifdef CONFIG_KSM
 int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
-		unsigned long end, int advice, unsigned long *vm_flags);
+		unsigned long end, int advice, vm_flags_t *vm_flags);
 int __ksm_enter(struct mm_struct *mm);
 void __ksm_exit(struct mm_struct *mm);
 
@@ -84,7 +84,7 @@ static inline int ksm_might_need_to_copy(struct page *page,
 }
 
 int page_referenced_ksm(struct page *page,
-			struct mem_cgroup *memcg, unsigned long *vm_flags);
+			struct mem_cgroup *memcg, vm_flags_t *vm_flags);
 int try_to_unmap_ksm(struct page *page, enum ttu_flags flags);
 int rmap_walk_ksm(struct page *page, int (*rmap_one)(struct page *,
 		  struct vm_area_struct *, unsigned long, void *), void *arg);
@@ -108,7 +108,7 @@ static inline int PageKsm(struct page *page)
 
 #ifdef CONFIG_MMU
 static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
-		unsigned long end, int advice, unsigned long *vm_flags)
+		unsigned long end, int advice, vm_flags_t *vm_flags)
 {
 	return 0;
 }
@@ -120,7 +120,7 @@ static inline int ksm_might_need_to_copy(struct page *page,
 }
 
 static inline int page_referenced_ksm(struct page *page,
-			struct mem_cgroup *memcg, unsigned long *vm_flags)
+			struct mem_cgroup *memcg, vm_flags_t *vm_flags)
 {
 	return 0;
 }
include/linux/mm.h +13 -10
index 69915a2..96f335c 100644
@@ -73,6 +73,9 @@ extern unsigned int kobjsize(const void *objp);
 /*
  * vm_flags in vm_area_struct, see mm_types.h.
  */
+
+#define VM_NONE		0x00000000
+
 #define VM_READ		0x00000001	/* currently active flags */
 #define VM_WRITE	0x00000002
 #define VM_EXEC		0x00000004
@@ -143,8 +146,8 @@ extern unsigned int kobjsize(const void *objp);
 #define VM_READHINTMASK			(VM_SEQ_READ | VM_RAND_READ)
 #define VM_ClearReadHint(v)		(v)->vm_flags &= ~VM_READHINTMASK
 #define VM_NormalReadHint(v)		(!((v)->vm_flags & VM_READHINTMASK))
-#define VM_SequentialReadHint(v)	((v)->vm_flags & VM_SEQ_READ)
-#define VM_RandomReadHint(v)		((v)->vm_flags & VM_RAND_READ)
+#define VM_SequentialReadHint(v)	(!!((v)->vm_flags & VM_SEQ_READ))
+#define VM_RandomReadHint(v)		(!!((v)->vm_flags & VM_RAND_READ))
 
 /*
  * Special vmas that are non-mergable, non-mlock()able.
@@ -1059,7 +1062,7 @@ extern unsigned long do_mremap(unsigned long addr,
 			       unsigned long flags, unsigned long new_addr);
 extern int mprotect_fixup(struct vm_area_struct *vma,
 			  struct vm_area_struct **pprev, unsigned long start,
-			  unsigned long end, unsigned long newflags);
+			  unsigned long end, vm_flags_t newflags);
 
 /*
  * doesn't attempt to fault and will return short.
@@ -1371,7 +1374,7 @@ extern int vma_adjust(struct vm_area_struct *vma, unsigned long start,
 	unsigned long end, pgoff_t pgoff, struct vm_area_struct *insert);
 extern struct vm_area_struct *vma_merge(struct mm_struct *,
 	struct vm_area_struct *prev, unsigned long addr, unsigned long end,
-	unsigned long vm_flags, struct anon_vma *, struct file *, pgoff_t,
+	vm_flags_t vm_flags, struct anon_vma *, struct file *, pgoff_t,
 	struct mempolicy *);
 extern struct anon_vma *find_mergeable_anon_vma(struct vm_area_struct *);
 extern int split_vma(struct mm_struct *,
@@ -1396,7 +1399,7 @@ extern struct file *get_mm_exe_file(struct mm_struct *mm);
 extern int may_expand_vm(struct mm_struct *mm, unsigned long npages);
 extern int install_special_mapping(struct mm_struct *mm,
 				   unsigned long addr, unsigned long len,
-				   unsigned long flags, struct page **pages);
+				   vm_flags_t vm_flags, struct page **pages);
 
 extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
 
@@ -1467,7 +1470,7 @@ extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
 /* CONFIG_STACK_GROWSUP still needs to to grow downwards at some places */
 extern int expand_downwards(struct vm_area_struct *vma,
 		unsigned long address);
-#if VM_GROWSUP
+#if defined(CONFIG_STACK_GROWSUP) || defined(CONFIG_IA64)
 extern int expand_upwards(struct vm_area_struct *vma, unsigned long address);
 #else
   #define expand_upwards(vma, address) do { } while (0)
@@ -1507,9 +1510,9 @@ static inline struct vm_area_struct *find_exact_vma(struct mm_struct *mm,
 }
 
 #ifdef CONFIG_MMU
-pgprot_t vm_get_page_prot(unsigned long vm_flags);
+pgprot_t vm_get_page_prot(vm_flags_t vm_flags);
 #else
-static inline pgprot_t vm_get_page_prot(unsigned long vm_flags)
+static inline pgprot_t vm_get_page_prot(vm_flags_t vm_flags)
 {
 	return __pgprot(0);
 }
@@ -1543,10 +1546,10 @@ extern int apply_to_page_range(struct mm_struct *mm, unsigned long address,
 			       unsigned long size, pte_fn_t fn, void *data);
 
 #ifdef CONFIG_PROC_FS
-void vm_stat_account(struct mm_struct *, unsigned long, struct file *, long);
+void vm_stat_account(struct mm_struct *, vm_flags_t, struct file *, long);
 #else
 static inline void vm_stat_account(struct mm_struct *mm,
-			unsigned long flags, struct file *file, long pages)
+			vm_flags_t vm_flags, struct file *file, long pages)
 {
 }
 #endif /* CONFIG_PROC_FS */
include/linux/mm_types.h +2 -2
index 3aeb8f6..d57e764 100644
@@ -212,7 +212,7 @@ struct vm_area_struct {
 	struct vm_area_struct *vm_next, *vm_prev;
 
 	pgprot_t vm_page_prot;		/* Access permissions of this VMA. */
-	unsigned long vm_flags;		/* Flags, see mm.h. */
+	vm_flags_t vm_flags;		/* Flags, see mm.h. */
 
 	struct rb_node vm_rb;
 
@@ -328,7 +328,7 @@ struct mm_struct {
 	unsigned long exec_vm;		/* VM_EXEC & ~VM_WRITE */
 	unsigned long stack_vm;		/* VM_GROWSUP/DOWN */
 	unsigned long reserved_vm;	/* VM_RESERVED|VM_IO pages */
-	unsigned long def_flags;
+	vm_flags_t def_flags;
 	unsigned long nr_ptes;		/* Page table pages */
 	unsigned long start_code, end_code, start_data, end_data;
 	unsigned long start_brk, brk, start_stack;
include/linux/mman.h +2 -2
index 8b74e9b..3b11ea2 100644
@@ -69,7 +69,7 @@ static inline int arch_validate_prot(unsigned long prot)
 /*
  * Combine the mmap "prot" argument into "vm_flags" used internally.
  */
-static inline unsigned long
+static inline vm_flags_t
 calc_vm_prot_bits(unsigned long prot)
 {
 	return _calc_vm_trans(prot, PROT_READ,  VM_READ ) |
@@ -81,7 +81,7 @@ calc_vm_prot_bits(unsigned long prot)
 /*
  * Combine the mmap "flags" argument into "vm_flags" used internally.
  */
-static inline unsigned long
+static inline vm_flags_t
 calc_vm_flag_bits(unsigned long flags)
 {
 	return _calc_vm_trans(flags, MAP_GROWSDOWN,  VM_GROWSDOWN ) |
include/linux/rmap.h +4 -4
index 1cdd62a..cb460be 100644
@@ -158,9 +158,9 @@ static inline void page_dup_rmap(struct page *page)
  * Called from mm/vmscan.c to handle paging out
  */
 int page_referenced(struct page *, int is_locked,
-			struct mem_cgroup *memcg, unsigned long *vm_flags);
+			struct mem_cgroup *memcg, vm_flags_t *vm_flags);
 int page_referenced_one(struct page *, struct vm_area_struct *,
-	unsigned long address, unsigned int *mapcount, unsigned long *vm_flags);
+	unsigned long address, unsigned int *mapcount, vm_flags_t *vm_flags);
 
 enum ttu_flags {
 	TTU_UNMAP = 0,			/* unmap mode */
@@ -237,9 +237,9 @@ int rmap_walk(struct page *page, int (*rmap_one)(struct page *,
 
 static inline int page_referenced(struct page *page, int is_locked,
 				  struct mem_cgroup *memcg,
-				  unsigned long *vm_flags)
+				  vm_flags_t *vm_flags)
 {
-	*vm_flags = 0;
+	*vm_flags = VM_NONE;
 	return 0;
 }
 
kernel/events/core.c +2 -2
index 4b50357..73b1063 100644
@@ -4559,7 +4559,7 @@ got_name:
 		if (cpuctx->active_pmu != pmu)
 			goto next;
 		perf_event_mmap_ctx(&cpuctx->ctx, mmap_event,
-					vma->vm_flags & VM_EXEC);
+					(vma->vm_flags & VM_EXEC) != VM_NONE);
 
 		ctxn = pmu->task_ctx_nr;
 		if (ctxn < 0)
@@ -4568,7 +4568,7 @@ got_name:
 		ctx = rcu_dereference(current->perf_event_ctxp[ctxn]);
 		if (ctx) {
 			perf_event_mmap_ctx(ctx, mmap_event,
-					vma->vm_flags & VM_EXEC);
+					(vma->vm_flags & VM_EXEC) != VM_NONE);
 		}
 next:
 		put_cpu_ptr(pmu->pmu_cpu_context);
kernel/fork.c +1 -1
index 48675fb..f14cde8 100644
@@ -504,7 +504,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p)
 	mm_init_owner(mm, p);
 
 	if (likely(!mm_alloc_pgd(mm))) {
-		mm->def_flags = 0;
+		mm->def_flags = VM_NONE;
 		mmu_notifier_mm_init(mm);
 		return mm;
 	}
kernel/sys.c +2 -2
index ef7e275..3080842 100644
@@ -1703,8 +1703,8 @@ SYSCALL_DEFINE1(umask, int, mask)
 
 #ifdef CONFIG_CHECKPOINT_RESTORE
 static bool vma_flags_mismatch(struct vm_area_struct *vma,
-			       unsigned long required,
-			       unsigned long banned)
+			       vm_flags_t required,
+			       vm_flags_t banned)
 {
 	return (vma->vm_flags & required) != required ||
 		(vma->vm_flags & banned);
mm/backing-dev.c +4 -0
index dd8e2aa..1380e07 100644
@@ -758,6 +758,10 @@ int bdi_setup_and_register(struct backing_dev_info *bdi, char *name,
 	char tmp[32];
 	int err;
 
+	BUILD_BUG_ON(BDI_CAP_READ_MAP != VM_MAYREAD);
+	BUILD_BUG_ON(BDI_CAP_WRITE_MAP != VM_MAYWRITE);
+	BUILD_BUG_ON(BDI_CAP_EXEC_MAP != VM_MAYEXEC);
+
 	bdi->name = name;
 	bdi->capabilities = cap;
 	err = bdi_init(bdi);
mm/huge_memory.c +1 -1
index f0e5306..813138d 100644
@@ -1486,7 +1486,7 @@ out:
 		   VM_HUGETLB|VM_SHARED|VM_MAYSHARE)
 
 int hugepage_madvise(struct vm_area_struct *vma,
-		     unsigned long *vm_flags, int advice)
+		     vm_flags_t *vm_flags, int advice)
 {
 	switch (advice) {
 	case MADV_HUGEPAGE:
mm/ksm.c +2 -2
index f23a24d..963ee37 100644
@@ -1446,7 +1446,7 @@ static int ksm_scan_thread(void *nothing)
 }
 
 int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
-		unsigned long end, int advice, unsigned long *vm_flags)
+		unsigned long end, int advice, vm_flags_t *vm_flags)
 {
 	struct mm_struct *mm = vma->vm_mm;
 	int err;
@@ -1581,7 +1581,7 @@ struct page *ksm_does_need_to_copy(struct page *page,
 }
 
 int page_referenced_ksm(struct page *page, struct mem_cgroup *memcg,
-			unsigned long *vm_flags)
+			vm_flags_t *vm_flags)
 {
 	struct stable_node *stable_node;
 	struct rmap_item *rmap_item;
mm/madvise.c +1 -1
index f5ab745..7a67ea5 100644
@@ -43,7 +43,7 @@ static long madvise_behavior(struct vm_area_struct * vma,
 	struct mm_struct * mm = vma->vm_mm;
 	int error = 0;
 	pgoff_t pgoff;
-	unsigned long new_flags = vma->vm_flags;
+	vm_flags_t new_flags = vma->vm_flags;
 
 	switch (behavior) {
 	case MADV_NORMAL:
mm/memory.c +2 -2
index 4c09ecb..b1c7c98 100644
@@ -845,7 +845,7 @@ copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
 		pte_t *dst_pte, pte_t *src_pte, struct vm_area_struct *vma,
 		unsigned long addr, int *rss)
 {
-	unsigned long vm_flags = vma->vm_flags;
+	vm_flags_t vm_flags = vma->vm_flags;
 	pte_t pte = *src_pte;
 	struct page *page;
 
@@ -1635,7 +1635,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
 		     int *nonblocking)
 {
 	int i;
-	unsigned long vm_flags;
+	vm_flags_t vm_flags;
 
 	if (nr_pages <= 0)
 		return 0;
mm/mlock.c +1 -1
index ef726e8..c555e7d 100644
@@ -524,7 +524,7 @@ SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len)
 static int do_mlockall(int flags)
 {
 	struct vm_area_struct * vma, * prev = NULL;
-	unsigned int def_flags = 0;
+	vm_flags_t def_flags = VM_NONE;
 
 	if (flags & MCL_FUTURE)
 		def_flags = VM_LOCKED;
mm/mmap.c +18 -18
index ae12bb8..0b6e869 100644
@@ -77,7 +77,7 @@ pgprot_t protection_map[16] = {
 	__S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
 };
 
-pgprot_t vm_get_page_prot(unsigned long vm_flags)
+pgprot_t vm_get_page_prot(vm_flags_t vm_flags)
 {
 	return __pgprot(pgprot_val(protection_map[vm_flags &
 				(VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
@@ -658,7 +658,7 @@ again:			remove_next = 1 + (end > next->vm_end);
  * per-vma resources, so we don't attempt to merge those.
  */
 static inline int is_mergeable_vma(struct vm_area_struct *vma,
-			struct file *file, unsigned long vm_flags)
+			struct file *file, vm_flags_t vm_flags)
 {
 	/* VM_CAN_NONLINEAR may get set later by f_op->mmap() */
 	if ((vma->vm_flags ^ vm_flags) & ~VM_CAN_NONLINEAR)
@@ -696,7 +696,7 @@ static inline int is_mergeable_anon_vma(struct anon_vma *anon_vma1,
  * wrap, nor mmaps which cover the final page at index -1UL.
  */
 static int
-can_vma_merge_before(struct vm_area_struct *vma, unsigned long vm_flags,
+can_vma_merge_before(struct vm_area_struct *vma, vm_flags_t vm_flags,
 	struct anon_vma *anon_vma, struct file *file, pgoff_t vm_pgoff)
 {
 	if (is_mergeable_vma(vma, file, vm_flags) &&
@@ -715,7 +715,7 @@ can_vma_merge_before(struct vm_area_struct *vma, unsigned long vm_flags,
  * anon_vmas, nor if same anon_vma is assigned but offsets incompatible.
  */
 static int
-can_vma_merge_after(struct vm_area_struct *vma, unsigned long vm_flags,
+can_vma_merge_after(struct vm_area_struct *vma, vm_flags_t vm_flags,
 	struct anon_vma *anon_vma, struct file *file, pgoff_t vm_pgoff)
 {
 	if (is_mergeable_vma(vma, file, vm_flags) &&
@@ -759,7 +759,7 @@ can_vma_merge_after(struct vm_area_struct *vma, unsigned long vm_flags,
  */
 struct vm_area_struct *vma_merge(struct mm_struct *mm,
 			struct vm_area_struct *prev, unsigned long addr,
-			unsigned long end, unsigned long vm_flags,
+			unsigned long end, vm_flags_t vm_flags,
 		     	struct anon_vma *anon_vma, struct file *file,
 			pgoff_t pgoff, struct mempolicy *policy)
 {
@@ -928,19 +928,19 @@ none:
 }
 
 #ifdef CONFIG_PROC_FS
-void vm_stat_account(struct mm_struct *mm, unsigned long flags,
-						struct file *file, long pages)
+void vm_stat_account(struct mm_struct *mm, vm_flags_t vm_flags,
+		     struct file *file, long pages)
 {
-	const unsigned long stack_flags
+	const vm_flags_t stack_flags
 		= VM_STACK_FLAGS & (VM_GROWSUP|VM_GROWSDOWN);
 
 	if (file) {
 		mm->shared_vm += pages;
-		if ((flags & (VM_EXEC|VM_WRITE)) == VM_EXEC)
+		if ((vm_flags & (VM_EXEC|VM_WRITE)) == VM_EXEC)
 			mm->exec_vm += pages;
-	} else if (flags & stack_flags)
+	} else if (vm_flags & stack_flags)
 		mm->stack_vm += pages;
-	if (flags & (VM_RESERVED|VM_IO))
+	if (vm_flags & (VM_RESERVED|VM_IO))
 		mm->reserved_vm += pages;
 }
 #endif /* CONFIG_PROC_FS */
@@ -2156,7 +2156,7 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
 {
 	struct mm_struct * mm = current->mm;
 	struct vm_area_struct * vma, * prev;
-	unsigned long flags;
+	vm_flags_t vm_flags;
 	struct rb_node ** rb_link, * rb_parent;
 	pgoff_t pgoff = addr >> PAGE_SHIFT;
 	int error;
@@ -2169,7 +2169,7 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
 	if (error)
 		return error;
 
-	flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
+	vm_flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
 
 	error = get_unmapped_area(NULL, addr, len, 0, MAP_FIXED);
 	if (error & ~PAGE_MASK)
@@ -2216,7 +2216,7 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
 		return -ENOMEM;
 
 	/* Can we just expand an old private anonymous mapping? */
-	vma = vma_merge(mm, prev, addr, addr + len, flags,
+	vma = vma_merge(mm, prev, addr, addr + len, vm_flags,
 					NULL, NULL, pgoff, NULL);
 	if (vma)
 		goto out;
@@ -2235,13 +2235,13 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
 	vma->vm_start = addr;
 	vma->vm_end = addr + len;
 	vma->vm_pgoff = pgoff;
-	vma->vm_flags = flags;
-	vma->vm_page_prot = vm_get_page_prot(flags);
+	vma->vm_flags = vm_flags;
+	vma->vm_page_prot = vm_get_page_prot(vm_flags);
 	vma_link(mm, vma, prev, rb_link, rb_parent);
 out:
 	perf_event_mmap(vma);
 	mm->total_vm += len >> PAGE_SHIFT;
-	if (flags & VM_LOCKED) {
+	if (vm_flags & VM_LOCKED) {
 		if (!mlock_vma_pages_range(vma, addr, addr + len))
 			mm->locked_vm += (len >> PAGE_SHIFT);
 	}
@@ -2489,7 +2489,7 @@ static const struct vm_operations_struct special_mapping_vmops = {
  */
 int install_special_mapping(struct mm_struct *mm,
 			    unsigned long addr, unsigned long len,
-			    unsigned long vm_flags, struct page **pages)
+			    vm_flags_t vm_flags, struct page **pages)
 {
 	int ret;
 	struct vm_area_struct *vma;
mm/mprotect.c +5 -4
index a409926..0faa389 100644
@@ -143,10 +143,10 @@ static void change_protection(struct vm_area_struct *vma,
 
 int
 mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev,
-	unsigned long start, unsigned long end, unsigned long newflags)
+	unsigned long start, unsigned long end, vm_flags_t newflags)
 {
 	struct mm_struct *mm = vma->vm_mm;
-	unsigned long oldflags = vma->vm_flags;
+	vm_flags_t oldflags = vma->vm_flags;
 	long nrpages = (end - start) >> PAGE_SHIFT;
 	unsigned long charged = 0;
 	pgoff_t pgoff;
@@ -232,7 +232,8 @@ fail:
 SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len,
 		unsigned long, prot)
 {
-	unsigned long vm_flags, nstart, end, tmp, reqprot;
+	unsigned long nstart, end, tmp, reqprot;
+	vm_flags_t vm_flags;
 	struct vm_area_struct *vma, *prev;
 	int error = -EINVAL;
 	const int grows = prot & (PROT_GROWSDOWN|PROT_GROWSUP);
@@ -289,7 +290,7 @@ SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len,
 		prev = vma;
 
 	for (nstart = start ; ; ) {
-		unsigned long newflags;
+		vm_flags_t newflags;
 
 		/* Here we know that  vma->vm_start <= nstart < vma->vm_end. */
 
mm/mremap.c +1 -1
index db8d983..c94d1db 100644
@@ -186,7 +186,7 @@ static unsigned long move_vma(struct vm_area_struct *vma,
 {
 	struct mm_struct *mm = vma->vm_mm;
 	struct vm_area_struct *new_vma;
-	unsigned long vm_flags = vma->vm_flags;
+	vm_flags_t vm_flags = vma->vm_flags;
 	unsigned long new_pgoff;
 	unsigned long moved_len;
 	unsigned long excess = 0;
mm/rmap.c +7 -9
index 36d01a2..88ccaec 100644
@@ -691,7 +691,7 @@ int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma)
  */
 int page_referenced_one(struct page *page, struct vm_area_struct *vma,
 			unsigned long address, unsigned int *mapcount,
-			unsigned long *vm_flags)
+			vm_flags_t *vm_flags)
 {
 	struct mm_struct *mm = vma->vm_mm;
 	int referenced = 0;
@@ -770,7 +770,7 @@ out:
 
 static int page_referenced_anon(struct page *page,
 				struct mem_cgroup *memcg,
-				unsigned long *vm_flags)
+				vm_flags_t *vm_flags)
 {
 	unsigned int mapcount;
 	struct anon_vma *anon_vma;
@@ -819,7 +819,7 @@ static int page_referenced_anon(struct page *page,
  */
 static int page_referenced_file(struct page *page,
 				struct mem_cgroup *memcg,
-				unsigned long *vm_flags)
+				vm_flags_t *vm_flags)
 {
 	unsigned int mapcount;
 	struct address_space *mapping = page->mapping;
@@ -885,12 +885,12 @@ static int page_referenced_file(struct page *page,
 int page_referenced(struct page *page,
 		    int is_locked,
 		    struct mem_cgroup *memcg,
-		    unsigned long *vm_flags)
+		    vm_flags_t *vm_flags)
 {
 	int referenced = 0;
 	int we_locked = 0;
 
-	*vm_flags = 0;
+	*vm_flags = VM_NONE;
 	if (page_mapped(page) && page_rmapping(page)) {
 		if (!is_locked && (!PageAnon(page) || PageKsm(page))) {
 			we_locked = trylock_page(page);
@@ -1415,7 +1415,7 @@ static int try_to_unmap_cluster(unsigned long cursor, unsigned int *mapcount,
 	 * keep the sem while scanning the cluster for mlocking pages.
 	 */
 	if (down_read_trylock(&vma->vm_mm->mmap_sem)) {
-		locked_vma = (vma->vm_flags & VM_LOCKED);
+		locked_vma = (vma->vm_flags & VM_LOCKED) != VM_NONE;
 		if (!locked_vma)
 			up_read(&vma->vm_mm->mmap_sem); /* don't need it */
 	}
@@ -1466,9 +1466,7 @@ static int try_to_unmap_cluster(unsigned long cursor, unsigned int *mapcount,
 
 bool is_vma_temporary_stack(struct vm_area_struct *vma)
 {
-	int maybe_stack = vma->vm_flags & (VM_GROWSDOWN | VM_GROWSUP);
-
-	if (!maybe_stack)
+	if ((vma->vm_flags & (VM_GROWSDOWN | VM_GROWSUP)) == VM_NONE)
 		return false;
 
 	if ((vma->vm_flags & VM_STACK_INCOMPLETE_SETUP) ==
mm/vmscan.c +2 -2
index 57d8ef6..9d3441d 100644
@@ -705,7 +705,7 @@ static enum page_references page_check_references(struct page *page,
 						  struct scan_control *sc)
 {
 	int referenced_ptes, referenced_page;
-	unsigned long vm_flags;
+	vm_flags_t vm_flags;
 
 	referenced_ptes = page_referenced(page, 1, mz->mem_cgroup, &vm_flags);
 	referenced_page = TestClearPageReferenced(page);
@@ -1678,7 +1678,7 @@ static void shrink_active_list(unsigned long nr_to_scan,
 {
 	unsigned long nr_taken;
 	unsigned long nr_scanned;
-	unsigned long vm_flags;
+	vm_flags_t vm_flags;
 	LIST_HEAD(l_hold);	/* The pages which were snipped off */
 	LIST_HEAD(l_active);
 	LIST_HEAD(l_inactive);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw

PATCH 3/16 mm/shmem: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov
---
 include/linux/mm.h       |    2 +-
 include/linux/shmem_fs.h |    5 ++--
 mm/shmem.c               |   54 +++++++++++++++++++++++++---------------------
 3 files changed, 32 insertions(+), 29 deletions(-)
include/linux/mm.h +1 -1
index 96f335c..be35c2f 100644
@@ -882,7 +882,7 @@ extern void show_free_areas(unsigned int flags);
 extern bool skip_free_areas_node(unsigned int flags, int nid);
 
 int shmem_lock(struct file *file, int lock, struct user_struct *user);
-struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
+struct file *shmem_file_setup(const char *name, loff_t size, vm_flags_t);
 int shmem_zero_setup(struct vm_area_struct *);
 
 extern int can_do_mlock(void);
include/linux/shmem_fs.h +2 -3
index 79ab255..db46104 100644
@@ -10,7 +10,7 @@
 
 struct shmem_inode_info {
 	spinlock_t		lock;
-	unsigned long		flags;
+	vm_flags_t		vm_flags;
 	unsigned long		alloced;	/* data pages alloced to file */
 	union {
 		unsigned long	swapped;	/* subtotal assigned to swap */
@@ -44,8 +44,7 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
  */
 extern int shmem_init(void);
 extern int shmem_fill_super(struct super_block *sb, void *data, int silent);
-extern struct file *shmem_file_setup(const char *name,
-					loff_t size, unsigned long flags);
+extern struct file *shmem_file_setup(const char *name, loff_t size, vm_flags_t);
 extern int shmem_zero_setup(struct vm_area_struct *);
 extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
 extern void shmem_unlock_mapping(struct address_space *mapping);
mm/shmem.c +29 -25

159 lines not on this page · raw message

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#4 lore raw

PATCH 4/16 mm/nommu: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov
---
 fs/proc/nommu.c      |    3 ++-
 fs/proc/task_nommu.c |   14 ++++++++------
 mm/nommu.c           |   19 ++++++++++---------
 3 files changed, 20 insertions(+), 16 deletions(-)
fs/proc/nommu.c +2 -1
index b1822dd..cadc798 100644
@@ -39,7 +39,8 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
 	unsigned long ino = 0;
 	struct file *file;
 	dev_t dev = 0;
-	int flags, len;
+	int len;
+	vm_flags_t vm_flags;
 
 	flags = region->vm_flags;
 	file = region->vm_file;
fs/proc/task_nommu.c +8 -6
index 8aaba8c..9abbc66 100644
@@ -142,10 +142,11 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
 	unsigned long ino = 0;
 	struct file *file;
 	dev_t dev = 0;
-	int flags, len;
+	int len;
+	vm_flags_t vm_flags;
 	unsigned long long pgoff = 0;
 
-	flags = vma->vm_flags;
+	vm_flags = vma->vm_flags;
 	file = vma->vm_file;
 
 	if (file) {
@@ -159,10 +160,11 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
 		   "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
 		   vma->vm_start,
 		   vma->vm_end,
-		   flags & VM_READ ? 'r' : '-',
-		   flags & VM_WRITE ? 'w' : '-',
-		   flags & VM_EXEC ? 'x' : '-',
-		   flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p',
+		   vm_flags & VM_READ ? 'r' : '-',
+		   vm_flags & VM_WRITE ? 'w' : '-',
+		   vm_flags & VM_EXEC ? 'x' : '-',
+		   vm_flags & VM_MAYSHARE ?
+			vm_flags & VM_SHARED ? 'S' : 's' : 'p',
 		   pgoff,
 		   MAJOR(dev), MINOR(dev), ino, &len);
 
mm/nommu.c +10 -9
index f59e170..33d0ab7 100644
@@ -130,7 +130,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
 		     int *retry)
 {
 	struct vm_area_struct *vma;
-	unsigned long vm_flags;
+	vm_flags_t vm_flags;
 	int i;
 
 	/* calculate required read or write permissions.
@@ -658,13 +658,13 @@ static void put_nommu_region(struct vm_region *region)
 /*
  * update protection on a vma
  */
-static void protect_vma(struct vm_area_struct *vma, unsigned long flags)
+static void protect_vma(struct vm_area_struct *vma, vm_flags_t vm_flags)
 {
 #ifdef CONFIG_MPU
 	struct mm_struct *mm = vma->vm_mm;
 	long start = vma->vm_start & PAGE_MASK;
 	while (start < vma->vm_end) {
-		protect_page(mm, start, flags);
+		protect_page(mm, start, vm_flags);
 		start += PAGE_SIZE;
 	}
 	update_protections(mm);
@@ -1060,12 +1060,12 @@ static int validate_mmap_request(struct file *file,
  * we've determined that we can make the mapping, now translate what we
  * now know into VMA flags
  */
-static unsigned long determine_vm_flags(struct file *file,
-					unsigned long prot,
-					unsigned long flags,
-					unsigned long capabilities)
+static vm_flags_t determine_vm_flags(struct file *file,
+				     unsigned long prot,
+				     unsigned long flags,
+				     unsigned long capabilities)
 {
-	unsigned long vm_flags;
+	vm_flags_t vm_flags;
 
 	vm_flags = calc_vm_prot_bits(prot) | calc_vm_flag_bits(flags);
 	/* vm_flags |= mm->def_flags; */
@@ -1243,7 +1243,8 @@ unsigned long do_mmap_pgoff(struct file *file,
 	struct vm_area_struct *vma;
 	struct vm_region *region;
 	struct rb_node *rb;
-	unsigned long capabilities, vm_flags, result;
+	unsigned long capabilities, result;
+	vm_flags_t vm_flags;
 	int ret;
 
 	kenter(",%lx,%lx,%lx,%lx,%lx", addr, len, prot, flags, pgoff);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#9 lore raw

PATCH 5/16 mm/drivers: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov
Cc Laurent Pinchart <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc John Stultz <[email protected]>
Cc "Arve Hjønnevåg" <[email protected]>
---
 drivers/media/video/omap3isp/ispqueue.h |    2 +-
 drivers/staging/android/ashmem.c        |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/video/omap3isp/ispqueue.h +1 -1
index 92c5a12..908dfd7 100644
@@ -90,7 +90,7 @@ struct isp_video_buffer {
 	void *vaddr;
 
 	/* For userspace buffers. */
-	unsigned long vm_flags;
+	vm_flags_t vm_flags;
 	unsigned long offset;
 	unsigned int npages;
 	struct page **pages;
drivers/staging/android/ashmem.c +1 -1
index 9f1f27e..4511420 100644
@@ -269,7 +269,7 @@ out:
 	return ret;
 }
 
-static inline unsigned long calc_vm_may_flags(unsigned long prot)
+static inline vm_flags_t calc_vm_may_flags(unsigned long prot)
 {
 	return _calc_vm_trans(prot, PROT_READ,  VM_MAYREAD) |
 	       _calc_vm_trans(prot, PROT_WRITE, VM_MAYWRITE) |
#12 lore raw

PATCH 6/16 mm/x86: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
---
 arch/x86/mm/hugetlbpage.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/mm/hugetlbpage.c +2 -2
index 6b52d81..b25e9bd 100644
@@ -26,8 +26,8 @@ static unsigned long page_table_shareable(struct vm_area_struct *svma,
 	unsigned long s_end = sbase + PUD_SIZE;
 
 	/* Allow segments to share if only one is marked locked */
-	unsigned long vm_flags = vma->vm_flags & ~VM_LOCKED;
-	unsigned long svm_flags = svma->vm_flags & ~VM_LOCKED;
+	vm_flags_t vm_flags = vma->vm_flags & ~VM_LOCKED;
+	vm_flags_t svm_flags = svma->vm_flags & ~VM_LOCKED;
 
 	/*
 	 * match the virtual addresses, permission and the alignment of the

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#14 lore raw

PATCH 7/16 mm/arm: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov

Cast vm_flags to unsigned int for __cpuc_flush_user_range(), because its vm_flags argument declared as unsigned int. Asssembler code wants to test VM_EXEC bit on vma->vm_flags, but for big-endian we should get upper word for this.

Cc Russell King <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 arch/arm/include/asm/cacheflush.h |    5 +++--
 arch/arm/kernel/asm-offsets.c     |    6 +++++-
 arch/arm/mm/fault.c               |    2 +-
 3 files changed, 9 insertions(+), 4 deletions(-)
arch/arm/include/asm/cacheflush.h +3 -2
index d5d8d5c..5aab2c4 100644
@@ -217,7 +217,7 @@ vivt_flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned
 {
 	if (cpumask_test_cpu(smp_processor_id(), mm_cpumask(vma->vm_mm)))
 		__cpuc_flush_user_range(start & PAGE_MASK, PAGE_ALIGN(end),
-					vma->vm_flags);
+					(__force unsigned int)vma->vm_flags);
 }
 
 static inline void
@@ -225,7 +225,8 @@ vivt_flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsig
 {
 	if (cpumask_test_cpu(smp_processor_id(), mm_cpumask(vma->vm_mm))) {
 		unsigned long addr = user_addr & PAGE_MASK;
-		__cpuc_flush_user_range(addr, addr + PAGE_SIZE, vma->vm_flags);
+		__cpuc_flush_user_range(addr, addr + PAGE_SIZE,
+					(__force unsigned int)vma->vm_flags);
 	}
 }
 
arch/arm/kernel/asm-offsets.c +5 -1
index 1429d89..8150c7e 100644
@@ -109,9 +109,13 @@ int main(void)
   BLANK();
 #endif
   DEFINE(VMA_VM_MM,		offsetof(struct vm_area_struct, vm_mm));
+#if defined(CONFIG_CPU_BIG_ENDIAN) && (NR_VMA_FLAGS > 32)
+  DEFINE(VMA_VM_FLAGS,		offsetof(struct vm_area_struct, vm_flags) + 4);
+#else
   DEFINE(VMA_VM_FLAGS,		offsetof(struct vm_area_struct, vm_flags));
+#endif
   BLANK();
-  DEFINE(VM_EXEC,	       	VM_EXEC);
+  DEFINE(VM_EXEC,		(__force unsigned int)VM_EXEC);
   BLANK();
   DEFINE(PAGE_SZ,	       	PAGE_SIZE);
   BLANK();
arch/arm/mm/fault.c +1 -1
index 40c43a9..371ad65 100644
@@ -209,7 +209,7 @@ void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
  */
 static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma)
 {
-	unsigned int mask = VM_READ | VM_WRITE | VM_EXEC;
+	vm_flags_t mask = VM_READ | VM_WRITE | VM_EXEC;
 
 	if (fsr & FSR_WRITE)
 		mask = VM_WRITE;
#16 lore raw

PATCH 8/16 mm/unicore32: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov

The same magic like in arm: assembler code wants to test VM_EXEC, but for big-endian we should get upper word for this.

---
 arch/unicore32/kernel/asm-offsets.c |    6 +++++-
 arch/unicore32/mm/fault.c           |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
arch/unicore32/kernel/asm-offsets.c +5 -1
index ffcbe75..e3199b5 100644
@@ -87,9 +87,13 @@ int main(void)
 	DEFINE(S_FRAME_SIZE,	sizeof(struct pt_regs));
 	BLANK();
 	DEFINE(VMA_VM_MM,	offsetof(struct vm_area_struct, vm_mm));
+#if defined(CONFIG_CPU_BIG_ENDIAN) && (NR_VMA_FLAGS > 32)
+	DEFINE(VMA_VM_FLAGS,	offsetof(struct vm_area_struct, vm_flags) + 4);
+#else
 	DEFINE(VMA_VM_FLAGS,	offsetof(struct vm_area_struct, vm_flags));
+#endif
 	BLANK();
-	DEFINE(VM_EXEC,		VM_EXEC);
+	DEFINE(VM_EXEC,		(__force unsigned int)VM_EXEC);
 	BLANK();
 	DEFINE(PAGE_SZ,		PAGE_SIZE);
 	BLANK();
arch/unicore32/mm/fault.c +1 -1
index 283aa4b..9137996 100644
@@ -158,7 +158,7 @@ void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
  */
 static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma)
 {
-	unsigned int mask = VM_READ | VM_WRITE | VM_EXEC;
+	vm_flags_t mask = VM_READ | VM_WRITE | VM_EXEC;
 
 	if (!(fsr ^ 0x12))	/* write? */
 		mask = VM_WRITE;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#20 lore raw

PATCH 9/16 mm/ia64: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov
---
 arch/ia64/mm/fault.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
arch/ia64/mm/fault.c +4 -5
index 20b3593..e50259d 100644
@@ -80,7 +80,7 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
 	struct vm_area_struct *vma, *prev_vma;
 	struct mm_struct *mm = current->mm;
 	struct siginfo si;
-	unsigned long mask;
+	vm_flags_t mask;
 	int fault;
 
 	/* mmap_sem is performance critical.... */
@@ -135,10 +135,9 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
 #	define VM_WRITE_BIT	1
 #	define VM_EXEC_BIT	2
 
-#	if (((1 << VM_READ_BIT) != VM_READ || (1 << VM_WRITE_BIT) != VM_WRITE) \
-	    || (1 << VM_EXEC_BIT) != VM_EXEC)
-#		error File is out of sync with <linux/mm.h>.  Please update.
-#	endif
+	BUILD_BUG_ON((1 << VM_READ_BIT) != VM_READ);
+	BUILD_BUG_ON((1 << VM_WRITE_BIT) != VM_WRITE);
+	BUILD_BUG_ON((1 << VM_EXEC_BIT) != VM_EXEC);
 
 	if (((isr >> IA64_ISR_R_BIT) & 1UL) && (!(vma->vm_flags & (VM_READ | VM_WRITE))))
 		goto bad_area;
#21 lore raw

PATCH 10/16 mm/powerpc: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
---
 arch/powerpc/include/asm/mman.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/include/asm/mman.h +1 -1
index d4a7f64..451de1c 100644
@@ -44,7 +44,7 @@ static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot)
 }
 #define arch_calc_vm_prot_bits(prot) arch_calc_vm_prot_bits(prot)
 
-static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
+static inline pgprot_t arch_vm_get_page_prot(vm_flags_t vm_flags)
 {
 	return (vm_flags & VM_SAO) ? __pgprot(_PAGE_SAO) : __pgprot(0);
 }

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#22 lore raw

PATCH 11/16 mm/s390: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov
---
 arch/s390/mm/fault.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
arch/s390/mm/fault.c +5 -3
index b17c42d..f8909e5 100644
@@ -260,7 +260,7 @@ static noinline void do_fault_error(struct pt_regs *regs, int fault)
  *   11       Page translation     ->  Not present       (nullification)
  *   3b       Region third trans.  ->  Not present       (nullification)
  */
-static inline int do_exception(struct pt_regs *regs, int access)
+static inline int do_exception(struct pt_regs *regs, vm_flags_t access)
 {
 	struct task_struct *tsk;
 	struct mm_struct *mm;
@@ -399,7 +399,8 @@ void __kprobes do_protection_exception(struct pt_regs *regs)
 
 void __kprobes do_dat_exception(struct pt_regs *regs)
 {
-	int access, fault;
+	int fault;
+	vm_flags_t access;
 
 	access = VM_READ | VM_EXEC | VM_WRITE;
 	fault = do_exception(regs, access);
@@ -441,7 +442,8 @@ no_context:
 int __handle_fault(unsigned long uaddr, unsigned long pgm_int_code, int write)
 {
 	struct pt_regs regs;
-	int access, fault;
+	int fault;
+	vm_flags_t access;
 
 	regs.psw.mask = psw_kernel_bits | PSW_MASK_DAT | PSW_MASK_MCHECK;
 	if (!irqs_disabled())

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#23 lore raw

PATCH 12/16 mm/mips: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov
---
 arch/mips/mm/c-r3k.c  |    2 +-
 arch/mips/mm/c-r4k.c  |    6 +++---
 arch/mips/mm/c-tx39.c |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
arch/mips/mm/c-r3k.c +1 -1
index 0765583..0ae0684 100644
@@ -239,7 +239,7 @@ static void r3k_flush_cache_page(struct vm_area_struct *vma,
 				 unsigned long addr, unsigned long pfn)
 {
 	unsigned long kaddr = KSEG0ADDR(pfn << PAGE_SHIFT);
-	int exec = vma->vm_flags & VM_EXEC;
+	int exec = (vma->vm_flags & VM_EXEC) != VM_NONE;
 	struct mm_struct *mm = vma->vm_mm;
 	pgd_t *pgdp;
 	pud_t *pudp;
arch/mips/mm/c-r4k.c +3 -3
index c97087d..94b2b89 100644
@@ -394,7 +394,7 @@ static void r4k__flush_cache_vunmap(void)
 static inline void local_r4k_flush_cache_range(void * args)
 {
 	struct vm_area_struct *vma = args;
-	int exec = vma->vm_flags & VM_EXEC;
+	int exec = (vma->vm_flags & VM_EXEC) != VM_NONE;
 
 	if (!(has_valid_asid(vma->vm_mm)))
 		return;
@@ -407,7 +407,7 @@ static inline void local_r4k_flush_cache_range(void * args)
 static void r4k_flush_cache_range(struct vm_area_struct *vma,
 	unsigned long start, unsigned long end)
 {
-	int exec = vma->vm_flags & VM_EXEC;
+	int exec = (vma->vm_flags & VM_EXEC) != VM_NONE;
 
 	if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc))
 		r4k_on_each_cpu(local_r4k_flush_cache_range, vma);
@@ -457,7 +457,7 @@ static inline void local_r4k_flush_cache_page(void *args)
 	struct vm_area_struct *vma = fcp_args->vma;
 	unsigned long addr = fcp_args->addr;
 	struct page *page = pfn_to_page(fcp_args->pfn);
-	int exec = vma->vm_flags & VM_EXEC;
+	int exec = (vma->vm_flags & VM_EXEC) != VM_NONE;
 	struct mm_struct *mm = vma->vm_mm;
 	int map_coherent = 0;
 	pgd_t *pgdp;
arch/mips/mm/c-tx39.c +1 -1
index a43c197c..1227670 100644
@@ -169,7 +169,7 @@ static void tx39_flush_cache_range(struct vm_area_struct *vma,
 
 static void tx39_flush_cache_page(struct vm_area_struct *vma, unsigned long page, unsigned long pfn)
 {
-	int exec = vma->vm_flags & VM_EXEC;
+	int exec = (vma->vm_flags & VM_EXEC) != VM_NONE;
 	struct mm_struct *mm = vma->vm_mm;
 	pgd_t *pgdp;
 	pud_t *pudp;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#24 lore raw

PATCH 13/16 mm/parisc: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov
---
 arch/parisc/mm/fault.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/parisc/mm/fault.c +2 -2
index 18162ce..0d3680a 100644
@@ -49,7 +49,7 @@ DEFINE_PER_CPU(struct exception_data, exception_data);
  *   VM_WRITE if write operation
  *   VM_EXEC  if execute operation
  */
-static unsigned long
+static vm_flags_t
 parisc_acctyp(unsigned long code, unsigned int inst)
 {
 	if (code == 6 || code == 16)
@@ -173,7 +173,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
 	struct vm_area_struct *vma, *prev_vma;
 	struct task_struct *tsk = current;
 	struct mm_struct *mm = tsk->mm;
-	unsigned long acc_type;
+	vm_flags_t acc_type;
 	int fault;
 
 	if (in_atomic() || !mm)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#25 lore raw

PATCH 14/16 mm/score: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov
---
 arch/score/mm/cache.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
arch/score/mm/cache.c +3 -3
index b25e957..2288ffc 100644
@@ -79,7 +79,7 @@ void __update_cache(struct vm_area_struct *vma, unsigned long address,
 {
 	struct page *page;
 	unsigned long pfn, addr;
-	int exec = (vma->vm_flags & VM_EXEC);
+	int exec = (vma->vm_flags & VM_EXEC) != VM_NONE;
 
 	pfn = pte_pfn(pte);
 	if (unlikely(!pfn_valid(pfn)))
@@ -172,7 +172,7 @@ void flush_cache_range(struct vm_area_struct *vma,
 		unsigned long start, unsigned long end)
 {
 	struct mm_struct *mm = vma->vm_mm;
-	int exec = vma->vm_flags & VM_EXEC;
+	int exec = (vma->vm_flags & VM_EXEC) != VM_NONE;
 	pgd_t *pgdp;
 	pud_t *pudp;
 	pmd_t *pmdp;
@@ -210,7 +210,7 @@ void flush_cache_range(struct vm_area_struct *vma,
 void flush_cache_page(struct vm_area_struct *vma,
 		unsigned long addr, unsigned long pfn)
 {
-	int exec = vma->vm_flags & VM_EXEC;
+	int exec = (vma->vm_flags & VM_EXEC) != VM_NONE;
 	unsigned long kaddr = 0xa0000000 | (pfn << PAGE_SHIFT);
 
 	flush_dcache_range(kaddr, kaddr + PAGE_SIZE);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#26 lore raw

PATCH 15/16 mm: cast vm_flags_t to u64 before printing

In reply to Konstantin Khlebnikov

Let's always print vm_flags_t as u64, thus now we can freely change vm_flags_t's size depending on target achitecture or config options.

---
 arch/sh/mm/tlbflush_64.c                         |    2 +-
 drivers/infiniband/hw/ipath/ipath_file_ops.c     |    6 ++++--
 drivers/infiniband/hw/qib/qib_file_ops.c         |    6 ++++--
 drivers/staging/android/binder.c                 |   15 ++++++++------
 drivers/staging/tidspbridge/core/tiomap3430.c    |   13 ++++++------
 drivers/staging/tidspbridge/rmgr/drv_interface.c |    4 ++--
 fs/binfmt_elf_fdpic.c                            |   24 ++++++++++++++--------
 mm/memory.c                                      |    5 +++--
 8 files changed, 45 insertions(+), 30 deletions(-)
arch/sh/mm/tlbflush_64.c +1 -1
index e3430e0..b798e7f 100644
@@ -48,7 +48,7 @@ static inline void print_vma(struct vm_area_struct *vma)
 	printk("vma end   0x%08lx\n", vma->vm_end);
 
 	print_prots(vma->vm_page_prot);
-	printk("vm_flags 0x%08lx\n", vma->vm_flags);
+	printk("vm_flags 0x%08llx\n", (__force u64)vma->vm_flags);
 }
 
 static inline void print_task(struct task_struct *tsk)
drivers/infiniband/hw/ipath/ipath_file_ops.c +4 -2
index 736d9ed..b3dfa21 100644
@@ -1115,7 +1115,8 @@ static int mmap_rcvegrbufs(struct vm_area_struct *vma,
 
 	if (vma->vm_flags & VM_WRITE) {
 		dev_info(&dd->pcidev->dev, "Can't map eager buffers as "
-			 "writable (flags=%lx)\n", vma->vm_flags);
+			 "writable (flags=%llx)\n",
+			 (__force u64)vma->vm_flags);
 		ret = -EPERM;
 		goto bail;
 	}
@@ -1204,7 +1205,8 @@ static int mmap_kvaddr(struct vm_area_struct *vma, u64 pgaddr,
                 if (vma->vm_flags & VM_WRITE) {
                         dev_info(&dd->pcidev->dev,
                                  "Can't map eager buffers as "
-                                 "writable (flags=%lx)\n", vma->vm_flags);
+				 "writable (flags=%llx)\n",
+				 (__force u64)vma->vm_flags);
                         ret = -EPERM;
                         goto bail;
                 }
drivers/infiniband/hw/qib/qib_file_ops.c +4 -2
index a740324..0fe928d 100644
@@ -857,7 +857,8 @@ static int mmap_rcvegrbufs(struct vm_area_struct *vma,
 
 	if (vma->vm_flags & VM_WRITE) {
 		qib_devinfo(dd->pcidev, "Can't map eager buffers as "
-			 "writable (flags=%lx)\n", vma->vm_flags);
+			 "writable (flags=%llx)\n",
+			 (__force u64)vma->vm_flags);
 		ret = -EPERM;
 		goto bail;
 	}
@@ -946,7 +947,8 @@ static int mmap_kvaddr(struct vm_area_struct *vma, u64 pgaddr,
 		if (vma->vm_flags & VM_WRITE) {
 			qib_devinfo(dd->pcidev,
 				 "Can't map eager buffers as "
-				 "writable (flags=%lx)\n", vma->vm_flags);
+				 "writable (flags=%llx)\n",
+				 (__force u64)vma->vm_flags);
 			ret = -EPERM;
 			goto bail;
 		}
drivers/staging/android/binder.c +9 -6
index c283212..b0d03e0 100644
@@ -2761,9 +2761,10 @@ static void binder_vma_open(struct vm_area_struct *vma)
 {
 	struct binder_proc *proc = vma->vm_private_data;
 	binder_debug(BINDER_DEBUG_OPEN_CLOSE,
-		     "binder: %d open vm area %lx-%lx (%ld K) vma %lx pagep %lx\n",
+		     "binder: %d open vm area %lx-%lx (%ld K) vma %llx pagep %lx\n",
 		     proc->pid, vma->vm_start, vma->vm_end,
-		     (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags,
+		     (vma->vm_end - vma->vm_start) / SZ_1K,
+		     (__force u64)vma->vm_flags,
 		     (unsigned long)pgprot_val(vma->vm_page_prot));
 }
 
@@ -2771,9 +2772,10 @@ static void binder_vma_close(struct vm_area_struct *vma)
 {
 	struct binder_proc *proc = vma->vm_private_data;
 	binder_debug(BINDER_DEBUG_OPEN_CLOSE,
-		     "binder: %d close vm area %lx-%lx (%ld K) vma %lx pagep %lx\n",
+		     "binder: %d close vm area %lx-%lx (%ld K) vma %llx pagep %lx\n",
 		     proc->pid, vma->vm_start, vma->vm_end,
-		     (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags,
+		     (vma->vm_end - vma->vm_start) / SZ_1K,
+		     (__force u64)vma->vm_flags,
 		     (unsigned long)pgprot_val(vma->vm_page_prot));
 	proc->vma = NULL;
 	proc->vma_vm_mm = NULL;
@@ -2797,9 +2799,10 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
 		vma->vm_end = vma->vm_start + SZ_4M;
 
 	binder_debug(BINDER_DEBUG_OPEN_CLOSE,
-		     "binder_mmap: %d %lx-%lx (%ld K) vma %lx pagep %lx\n",
+		     "binder_mmap: %d %lx-%lx (%ld K) vma %llx pagep %lx\n",
 		     proc->pid, vma->vm_start, vma->vm_end,
-		     (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags,
+		     (vma->vm_end - vma->vm_start) / SZ_1K,
+		     (__force u64)vma->vm_flags,
 		     (unsigned long)pgprot_val(vma->vm_page_prot));
 
 	if (vma->vm_flags & FORBIDDEN_MMAP_FLAGS) {
drivers/staging/tidspbridge/core/tiomap3430.c +7 -6
index 7862513..328a9ab 100644
@@ -1216,9 +1216,9 @@ static int bridge_brd_mem_map(struct bridge_dev_context *dev_ctxt,
 	if (vma)
 		dev_dbg(bridge,
 			"VMAfor UserBuf: ul_mpu_addr=%x, ul_num_bytes=%x, "
-			"vm_start=%lx, vm_end=%lx, vm_flags=%lx\n", ul_mpu_addr,
+			"vm_start=%lx, vm_end=%lx, vm_flags=%llx\n", ul_mpu_addr,
 			ul_num_bytes, vma->vm_start, vma->vm_end,
-			vma->vm_flags);
+			(__force u64)vma->vm_flags);
 
 	/*
 	 * It is observed that under some circumstances, the user buffer is
@@ -1230,9 +1230,9 @@ static int bridge_brd_mem_map(struct bridge_dev_context *dev_ctxt,
 		vma = find_vma(mm, vma->vm_end + 1);
 		dev_dbg(bridge,
 			"VMA for UserBuf ul_mpu_addr=%x ul_num_bytes=%x, "
-			"vm_start=%lx, vm_end=%lx, vm_flags=%lx\n", ul_mpu_addr,
+			"vm_start=%lx, vm_end=%lx, vm_flags=%llx\n", ul_mpu_addr,
 			ul_num_bytes, vma->vm_start, vma->vm_end,
-			vma->vm_flags);
+			(__force u64)vma->vm_flags);
 	}
 	if (!vma) {
 		pr_err("%s: Failed to get VMA region for 0x%x (%d)\n",
@@ -1302,11 +1302,12 @@ static int bridge_brd_mem_map(struct bridge_dev_context *dev_ctxt,
 			} else {
 				pr_err("DSPBRIDGE: get_user_pages FAILED,"
 				       "MPU addr = 0x%x,"
-				       "vma->vm_flags = 0x%lx,"
+				       "vma->vm_flags = 0x%llx,"
 				       "get_user_pages Err"
 				       "Value = %d, Buffer"
 				       "size=0x%x\n", ul_mpu_addr,
-				       vma->vm_flags, pg_num, ul_num_bytes);
+				       (__force u64)vma->vm_flags,
+				       pg_num, ul_num_bytes);
 				status = -EPERM;
 				break;
 			}
drivers/staging/tidspbridge/rmgr/drv_interface.c +2 -2
index 3cac014..f7ea4af 100644
@@ -265,9 +265,9 @@ static int bridge_mmap(struct file *filp, struct vm_area_struct *vma)
 	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
 	dev_dbg(bridge, "%s: vm filp %p start %lx end %lx page_prot %ulx "
-		"flags %lx\n", __func__, filp,
+		"flags %llx\n", __func__, filp,
 		vma->vm_start, vma->vm_end, vma->vm_page_prot,
-		vma->vm_flags);
+		(__force u64)vma->vm_flags);
 
 	status = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
 				 vma->vm_end - vma->vm_start,
fs/binfmt_elf_fdpic.c +15 -9
index c64bf5e..49a85b7 100644
@@ -1215,7 +1215,8 @@ static int maydump(struct vm_area_struct *vma, unsigned long mm_flags)
 
 	/* Do not dump I/O mapped devices or special mappings */
 	if (vma->vm_flags & (VM_IO | VM_RESERVED)) {
-		kdcore("%08lx: %08lx: no (IO)", vma->vm_start, vma->vm_flags);
+		kdcore("%08lx: %08llx: no (IO)", vma->vm_start,
+		       (__force u64)vma->vm_flags);
 		return 0;
 	}
 
@@ -1223,7 +1224,8 @@ static int maydump(struct vm_area_struct *vma, unsigned long mm_flags)
 	 * them either. "dump_write()" can't handle it anyway.
 	 */
 	if (!(vma->vm_flags & VM_READ)) {
-		kdcore("%08lx: %08lx: no (!read)", vma->vm_start, vma->vm_flags);
+		kdcore("%08lx: %08llx: no (!read)", vma->vm_start,
+		       (__force u64)vma->vm_flags);
 		return 0;
 	}
 
@@ -1231,14 +1233,16 @@ static int maydump(struct vm_area_struct *vma, unsigned long mm_flags)
 	if (vma->vm_flags & VM_SHARED) {
 		if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0) {
 			dump_ok = test_bit(MMF_DUMP_ANON_SHARED, &mm_flags);
-			kdcore("%08lx: %08lx: %s (share)", vma->vm_start,
-			       vma->vm_flags, dump_ok ? "yes" : "no");
+			kdcore("%08lx: %08llx: %s (share)", vma->vm_start,
+			       (__force u64)vma->vm_flags,
+			       dump_ok ? "yes" : "no");
 			return dump_ok;
 		}
 
 		dump_ok = test_bit(MMF_DUMP_MAPPED_SHARED, &mm_flags);
-		kdcore("%08lx: %08lx: %s (share)", vma->vm_start,
-		       vma->vm_flags, dump_ok ? "yes" : "no");
+		kdcore("%08lx: %08llx: %s (share)", vma->vm_start,
+		       (__force u64)vma->vm_flags,
+		       dump_ok ? "yes" : "no");
 		return dump_ok;
 	}
 
@@ -1246,14 +1250,16 @@ static int maydump(struct vm_area_struct *vma, unsigned long mm_flags)
 	/* By default, if it hasn't been written to, don't write it out */
 	if (!vma->anon_vma) {
 		dump_ok = test_bit(MMF_DUMP_MAPPED_PRIVATE, &mm_flags);
-		kdcore("%08lx: %08lx: %s (!anon)", vma->vm_start,
-		       vma->vm_flags, dump_ok ? "yes" : "no");
+		kdcore("%08lx: %08llx: %s (!anon)", vma->vm_start,
+		       (__force u64)vma->vm_flags,
+		       dump_ok ? "yes" : "no");
 		return dump_ok;
 	}
 #endif
 
 	dump_ok = test_bit(MMF_DUMP_ANON_PRIVATE, &mm_flags);
-	kdcore("%08lx: %08lx: %s", vma->vm_start, vma->vm_flags,
+	kdcore("%08lx: %08llx: %s", vma->vm_start,
+	       (__force u64)vma->vm_flags,
 	       dump_ok ? "yes" : "no");
 	return dump_ok;
 }
mm/memory.c +3 -2
index b1c7c98..ee85fc4 100644
@@ -705,8 +705,9 @@ static void print_bad_pte(struct vm_area_struct *vma, unsigned long addr,
 	if (page)
 		dump_page(page);
 	printk(KERN_ALERT
-		"addr:%p vm_flags:%08lx anon_vma:%p mapping:%p index:%lx\n",
-		(void *)addr, vma->vm_flags, vma->anon_vma, mapping, index);
+		"addr:%p vm_flags:%08llx anon_vma:%p mapping:%p index:%lx\n",
+		(void *)addr, (__force u64)vma->vm_flags,
+		vma->anon_vma, mapping, index);
 	/*
 	 * Choose text because data symbols depend on CONFIG_KALLSYMS_ALL=y
 	 */

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#27 lore raw

PATCH 16/16 mm: vm_flags_t strict type checking

In reply to Konstantin Khlebnikov

Now nobody uses VM_* constants in macro-expressions, so we can add type to them.

Cc Benjamin Herrenschmidt <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Cc Hugh Dickins <[email protected]>
---
 include/linux/mm.h       |  138 ++++++++++++++++++++++++++++++++--------------
 include/linux/mm_types.h |    4 +
 2 files changed, 97 insertions(+), 45 deletions(-)
include/linux/mm.h +95 -43
index be35c2f..b432c28 100644
@@ -74,59 +74,111 @@ extern unsigned int kobjsize(const void *objp);
  * vm_flags in vm_area_struct, see mm_types.h.
  */
 
-#define VM_NONE		0x00000000
+enum {
+	__VM_READ,
+	__VM_WRITE,
+	__VM_EXEC,
+	__VM_SHARED,
+
+	__VM_MAYREAD,
+	__VM_MAYWRITE,
+	__VM_MAYEXEC,
+	__VM_MAYSHARE,
+
+	__VM_GROWSDOWN,
+#if defined(CONFIG_STACK_GROWSUP) || defined(CONFIG_IA64)
+	__VM_GROWSUP,
+#else
+	__VM_NOHUGEPAGE,
+#endif
+	__VM_PFNMAP,
+	__VM_DENYWRITE,
+
+	__VM_EXECUTABLE,
+	__VM_LOCKED,
+	__VM_IO,
+	__VM_SEQ_READ,
+
+	__VM_RAND_READ,
+	__VM_DONTCOPY,
+	__VM_DONTEXPAND,
+	__VM_RESERVED,
 
-#define VM_READ		0x00000001	/* currently active flags */
-#define VM_WRITE	0x00000002
-#define VM_EXEC		0x00000004
-#define VM_SHARED	0x00000008
+	__VM_ACCOUNT,
+	__VM_NORESERVE,
+	__VM_HUGETLB,
+	__VM_NONLINEAR,
+
+#ifndef CONFIG_TRANSPARENT_HUGEPAGE
+	__VM_MAPPED_COPY,
+#else
+	__VM_HUGEPAGE,
+#endif
+	__VM_INSERTPAGE,
+	__VM_ALWAYSDUMP,
+	__VM_CAN_NONLINEAR,
+
+	__VM_MIXEDMAP,
+	__VM_SAO,
+	__VM_PFN_AT_MMAP,
+	__VM_MERGEABLE,
+
+	__NR_VMA_FLAGS
+};
+
+#define VM_NONE		((__force vm_flags_t)0)
+
+#define	__VMF(name)	((__force vm_flags_t)(1ull << (__VM_##name)))
+
+#define VM_READ		__VMF(READ) /* currently active flags */
+#define VM_WRITE	__VMF(WRITE)
+#define VM_EXEC		__VMF(EXEC)
+#define VM_SHARED	__VMF(SHARED)
 
 /* mprotect() hardcodes VM_MAYREAD >> 4 == VM_READ, and so for r/w/x bits. */
-#define VM_MAYREAD	0x00000010	/* limits for mprotect() etc */
-#define VM_MAYWRITE	0x00000020
-#define VM_MAYEXEC	0x00000040
-#define VM_MAYSHARE	0x00000080
+#define VM_MAYREAD	__VMF(MAYREAD) /* limits for mprotect() etc */
+#define VM_MAYWRITE	__VMF(MAYWRITE)
+#define VM_MAYEXEC	__VMF(MAYEXEC)
+#define VM_MAYSHARE	__VMF(MAYSHARE)
 
-#define VM_GROWSDOWN	0x00000100	/* general info on the segment */
+#define VM_GROWSDOWN	__VMF(GROWSDOWN) /* general info on the segment */
 #if defined(CONFIG_STACK_GROWSUP) || defined(CONFIG_IA64)
-#define VM_GROWSUP	0x00000200
+#define VM_GROWSUP	__VMF(GROWSUP)
 #else
-#define VM_GROWSUP	0x00000000
-#define VM_NOHUGEPAGE	0x00000200	/* MADV_NOHUGEPAGE marked this vma */
+#define VM_GROWSUP	VM_NONE
+#define VM_NOHUGEPAGE	__VMF(NOHUGEPAGE) /* MADV_NOHUGEPAGE marked this vma */
 #endif
-#define VM_PFNMAP	0x00000400	/* Page-ranges managed without "struct page", just pure PFN */
-#define VM_DENYWRITE	0x00000800	/* ETXTBSY on write attempts.. */
-
-#define VM_EXECUTABLE	0x00001000
-#define VM_LOCKED	0x00002000
-#define VM_IO           0x00004000	/* Memory mapped I/O or similar */
-
-					/* Used by sys_madvise() */
-#define VM_SEQ_READ	0x00008000	/* App will access data sequentially */
-#define VM_RAND_READ	0x00010000	/* App will not benefit from clustered reads */
-
-#define VM_DONTCOPY	0x00020000      /* Do not copy this vma on fork */
-#define VM_DONTEXPAND	0x00040000	/* Cannot expand with mremap() */
-#define VM_RESERVED	0x00080000	/* Count as reserved_vm like IO */
-#define VM_ACCOUNT	0x00100000	/* Is a VM accounted object */
-#define VM_NORESERVE	0x00200000	/* should the VM suppress accounting */
-#define VM_HUGETLB	0x00400000	/* Huge TLB Page VM */
-#define VM_NONLINEAR	0x00800000	/* Is non-linear (remap_file_pages) */
+#define VM_PFNMAP	__VMF(PFNMAP) /* Page-ranges managed without "struct page", just pure PFN */
+#define VM_DENYWRITE	__VMF(DENYWRITE) /* ETXTBSY on write attempts.. */
+
+#define VM_EXECUTABLE	__VMF(EXECUTABLE)
+#define VM_LOCKED	__VMF(LOCKED)
+#define VM_IO		__VMF(IO) /* Memory mapped I/O or similar */
+
+					  /* Used by sys_madvise() */
+#define VM_SEQ_READ	__VMF(SEQ_READ) /* App will access data sequentially */
+#define VM_RAND_READ	__VMF(RAND_READ) /* App will not benefit from clustered reads */
+
+#define VM_DONTCOPY	__VMF(DONTCOPY) /* Do not copy this vma on fork */
+#define VM_DONTEXPAND	__VMF(DONTEXPAND) /* Cannot expand with mremap() */
+#define VM_RESERVED	__VMF(RESERVED) /* Count as reserved_vm like IO */
+#define VM_ACCOUNT	__VMF(ACCOUNT) /* Is a VM accounted object */
+#define VM_NORESERVE	__VMF(NORESERVE) /* should the VM suppress accounting */
+#define VM_HUGETLB	__VMF(HUGETLB) /* Huge TLB Page VM */
+#define VM_NONLINEAR	__VMF(NONLINEAR) /* Is non-linear (remap_file_pages) */
 #ifndef CONFIG_TRANSPARENT_HUGEPAGE
-#define VM_MAPPED_COPY	0x01000000	/* T if mapped copy of data (nommu mmap) */
+#define VM_MAPPED_COPY	__VMF(MAPPED_COPY) /* T if mapped copy of data (nommu mmap) */
 #else
-#define VM_HUGEPAGE	0x01000000	/* MADV_HUGEPAGE marked this vma */
+#define VM_HUGEPAGE	__VMF(HUGEPAGE) /* MADV_HUGEPAGE marked this vma */
 #endif
-#define VM_INSERTPAGE	0x02000000	/* The vma has had "vm_insert_page()" done on it */
-#define VM_ALWAYSDUMP	0x04000000	/* Always include in core dumps */
-
-#define VM_CAN_NONLINEAR 0x08000000	/* Has ->fault & does nonlinear pages */
-#define VM_MIXEDMAP	0x10000000	/* Can contain "struct page" and pure PFN pages */
-#define VM_SAO		0x20000000	/* Strong Access Ordering (powerpc) */
-#define VM_PFN_AT_MMAP	0x40000000	/* PFNMAP vma that is fully mapped at mmap time */
-#define VM_MERGEABLE	0x80000000	/* KSM may merge identical pages */
-
-#define __NR_VMA_FLAGS	32
+#define VM_INSERTPAGE	__VMF(INSERTPAGE) /* The vma has had "vm_insert_page()" done on it */
+#define VM_ALWAYSDUMP	__VMF(ALWAYSDUMP) /* Always include in core dumps */
+
+#define VM_CAN_NONLINEAR __VMF(CAN_NONLINEAR) /* Has ->fault & does nonlinear pages */
+#define VM_MIXEDMAP	__VMF(MIXEDMAP) /* Can contain "struct page" and pure PFN pages */
+#define VM_SAO		__VMF(SAO) /* Strong Access Ordering (powerpc) */
+#define VM_PFN_AT_MMAP	__VMF(PFN_AT_MMAP) /* PFNMAP vma that is fully mapped at mmap time */
+#define VM_MERGEABLE	__VMF(MERGEABLE) /* KSM may merge identical pages */
 
 #ifndef __GENERATING_BOUNDS_H
 
include/linux/mm_types.h +2 -2
index d57e764..f14cc5e 100644
@@ -172,9 +172,9 @@ struct page_frag {
 };
 
 #if (NR_VMA_FLAGS > 32)
-typedef unsigned long long __nocast vm_flags_t;
+typedef unsigned long long __bitwise__ vm_flags_t;
 #else
-typedef unsigned long __nocast vm_flags_t;
+typedef unsigned long __bitwise__ vm_flags_t;
 #endif
 
 /*

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#13 lore raw

Re: [PATCH 06/16] mm/x86: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov
Quoted 5 lines · Konstantin Khlebnikov
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>

Please put in a patch description.

-hpa

Signature · 9 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#5 lore raw

Re: [PATCH 04/16] mm/nommu: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov

Hi Konstantin,

Quoted 14 lines · Konstantin Khlebnikov
---
  fs/proc/nommu.c      |    3 ++-
  fs/proc/task_nommu.c |   14 ++++++++------
  mm/nommu.c           |   19 ++++++++++---------
  3 files changed, 20 insertions(+), 16 deletions(-)
fs/proc/nommu.c +0 -0
index b1822dd..cadc798 100644

fs/proc/nommu.c static int nommu_region_show(struct seq_file *m, struct vm_region *region) · line 45

Quoted 8 lines
fs/proc/nommu.c +2 -1
@@ -39,7 +39,8 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
  	unsigned long ino = 0;
  	struct file *file;
  	dev_t dev = 0;
-	int flags, len;
+	int len;
+	vm_flags_t vm_flags;
 
  	flags = region->vm_flags;
        ^^^^^

I think you want vm_flags here right?
There is other uses of "flags" in this function as well.

Regards
Greg

Quoted 96 lines
fs/proc/nommu.c +0 -0
  	file = region->vm_file;
fs/proc/task_nommu.c +8 -6
index 8aaba8c..9abbc66 100644
@@ -142,10 +142,11 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
  	unsigned long ino = 0;
  	struct file *file;
  	dev_t dev = 0;
-	int flags, len;
+	int len;
+	vm_flags_t vm_flags;
  	unsigned long long pgoff = 0;
 
-	flags = vma->vm_flags;
+	vm_flags = vma->vm_flags;
  	file = vma->vm_file;
 
  	if (file) {
@@ -159,10 +160,11 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
  		   "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
  		   vma->vm_start,
  		   vma->vm_end,
-		   flags&  VM_READ ? 'r' : '-',
-		   flags&  VM_WRITE ? 'w' : '-',
-		   flags&  VM_EXEC ? 'x' : '-',
-		   flags&  VM_MAYSHARE ? flags&  VM_SHARED ? 'S' : 's' : 'p',
+		   vm_flags&  VM_READ ? 'r' : '-',
+		   vm_flags&  VM_WRITE ? 'w' : '-',
+		   vm_flags&  VM_EXEC ? 'x' : '-',
+		   vm_flags&  VM_MAYSHARE ?
+			vm_flags&  VM_SHARED ? 'S' : 's' : 'p',
  		   pgoff,
  		   MAJOR(dev), MINOR(dev), ino,&len);
 
mm/nommu.c +10 -9
index f59e170..33d0ab7 100644
@@ -130,7 +130,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
  		     int *retry)
  {
  	struct vm_area_struct *vma;
-	unsigned long vm_flags;
+	vm_flags_t vm_flags;
  	int i;
 
  	/* calculate required read or write permissions.
@@ -658,13 +658,13 @@ static void put_nommu_region(struct vm_region *region)
  /*
   * update protection on a vma
   */
-static void protect_vma(struct vm_area_struct *vma, unsigned long flags)
+static void protect_vma(struct vm_area_struct *vma, vm_flags_t vm_flags)
  {
  #ifdef CONFIG_MPU
  	struct mm_struct *mm = vma->vm_mm;
  	long start = vma->vm_start&  PAGE_MASK;
  	while (start<  vma->vm_end) {
-		protect_page(mm, start, flags);
+		protect_page(mm, start, vm_flags);
  		start += PAGE_SIZE;
  	}
  	update_protections(mm);
@@ -1060,12 +1060,12 @@ static int validate_mmap_request(struct file *file,
   * we've determined that we can make the mapping, now translate what we
   * now know into VMA flags
   */
-static unsigned long determine_vm_flags(struct file *file,
-					unsigned long prot,
-					unsigned long flags,
-					unsigned long capabilities)
+static vm_flags_t determine_vm_flags(struct file *file,
+				     unsigned long prot,
+				     unsigned long flags,
+				     unsigned long capabilities)
  {
-	unsigned long vm_flags;
+	vm_flags_t vm_flags;
 
  	vm_flags = calc_vm_prot_bits(prot) | calc_vm_flag_bits(flags);
  	/* vm_flags |= mm->def_flags; */
@@ -1243,7 +1243,8 @@ unsigned long do_mmap_pgoff(struct file *file,
  	struct vm_area_struct *vma;
  	struct vm_region *region;
  	struct rb_node *rb;
-	unsigned long capabilities, vm_flags, result;
+	unsigned long capabilities, result;
+	vm_flags_t vm_flags;
  	int ret;
 
  	kenter(",%lx,%lx,%lx,%lx,%lx", addr, len, prot, flags, pgoff);
Signature · 12 lines
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#6 lore raw

Re: [PATCH 04/16] mm/nommu: use vm_flags_t for vma flags

Quoted 25 lines · Greg Ungerer

Hi Konstantin,

Quoted 21 lines · Konstantin Khlebnikov
---
   fs/proc/nommu.c      |    3 ++-
   fs/proc/task_nommu.c |   14 ++++++++------
   mm/nommu.c           |   19 ++++++++++---------
   3 files changed, 20 insertions(+), 16 deletions(-)
fs/proc/nommu.c +2 -1
index b1822dd..cadc798 100644
@@ -39,7 +39,8 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
   	unsigned long ino = 0;
   	struct file *file;
   	dev_t dev = 0;
-	int flags, len;
+	int len;
+	vm_flags_t vm_flags;
 
Quoted 4 lines

fs/proc/nommu.c static int nommu_region_show(struct seq_file *m, struct vm_region *region) · line 45

Quoted 1 line
fs/proc/nommu.c +0 -0
   	flags = region->vm_flags;
          ^^^^^

I think you want vm_flags here right?
There is other uses of "flags" in this function as well.

Right, I missed this.

Sorry for my cheating, I didn't check compiling for all possible targets =)

Quoted 96 lines

Regards
Greg

Quoted 91 lines
fs/proc/nommu.c +0 -0
   	file = region->vm_file;
fs/proc/task_nommu.c +8 -6
index 8aaba8c..9abbc66 100644
@@ -142,10 +142,11 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
   	unsigned long ino = 0;
   	struct file *file;
   	dev_t dev = 0;
-	int flags, len;
+	int len;
+	vm_flags_t vm_flags;
   	unsigned long long pgoff = 0;
 
-	flags = vma->vm_flags;
+	vm_flags = vma->vm_flags;
   	file = vma->vm_file;
 
   	if (file) {
@@ -159,10 +160,11 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
   		   "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
   		   vma->vm_start,
   		   vma->vm_end,
-		   flags&   VM_READ ? 'r' : '-',
-		   flags&   VM_WRITE ? 'w' : '-',
-		   flags&   VM_EXEC ? 'x' : '-',
-		   flags&   VM_MAYSHARE ? flags&   VM_SHARED ? 'S' : 's' : 'p',
+		   vm_flags&   VM_READ ? 'r' : '-',
+		   vm_flags&   VM_WRITE ? 'w' : '-',
+		   vm_flags&   VM_EXEC ? 'x' : '-',
+		   vm_flags&   VM_MAYSHARE ?
+			vm_flags&   VM_SHARED ? 'S' : 's' : 'p',
   		   pgoff,
   		   MAJOR(dev), MINOR(dev), ino,&len);
 
mm/nommu.c +10 -9
index f59e170..33d0ab7 100644
@@ -130,7 +130,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
   		     int *retry)
   {
   	struct vm_area_struct *vma;
-	unsigned long vm_flags;
+	vm_flags_t vm_flags;
   	int i;
 
   	/* calculate required read or write permissions.
@@ -658,13 +658,13 @@ static void put_nommu_region(struct vm_region *region)
   /*
    * update protection on a vma
    */
-static void protect_vma(struct vm_area_struct *vma, unsigned long flags)
+static void protect_vma(struct vm_area_struct *vma, vm_flags_t vm_flags)
   {
   #ifdef CONFIG_MPU
   	struct mm_struct *mm = vma->vm_mm;
   	long start = vma->vm_start&   PAGE_MASK;
   	while (start<   vma->vm_end) {
-		protect_page(mm, start, flags);
+		protect_page(mm, start, vm_flags);
   		start += PAGE_SIZE;
   	}
   	update_protections(mm);
@@ -1060,12 +1060,12 @@ static int validate_mmap_request(struct file *file,
    * we've determined that we can make the mapping, now translate what we
    * now know into VMA flags
    */
-static unsigned long determine_vm_flags(struct file *file,
-					unsigned long prot,
-					unsigned long flags,
-					unsigned long capabilities)
+static vm_flags_t determine_vm_flags(struct file *file,
+				     unsigned long prot,
+				     unsigned long flags,
+				     unsigned long capabilities)
   {
-	unsigned long vm_flags;
+	vm_flags_t vm_flags;
 
   	vm_flags = calc_vm_prot_bits(prot) | calc_vm_flag_bits(flags);
   	/* vm_flags |= mm->def_flags; */
@@ -1243,7 +1243,8 @@ unsigned long do_mmap_pgoff(struct file *file,
   	struct vm_area_struct *vma;
   	struct vm_region *region;
   	struct rb_node *rb;
-	unsigned long capabilities, vm_flags, result;
+	unsigned long capabilities, result;
+	vm_flags_t vm_flags;
   	int ret;
 
Quoted 7 lines

mm/nommu.c unsigned long do_mmap_pgoff(struct file *file, · line 1250

Quoted 5 lines
mm/nommu.c +0 -0
   	kenter(",%lx,%lx,%lx,%lx,%lx", addr, len, prot, flags, pgoff);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#29 lore raw
In reply to Konstantin Khlebnikov

Hi Konstantin,

It seems to be nice clean up to me and you are a volunteer we have been wanted for a long time. Thanks!
I am one of people who really want to expand vm_flags to 64 bit but when KOSAKI tried it, Linus said his concerning, I guess you already saw that.

He want to tidy vm_flags's usage up rather than expanding it. Without the discussion about that, just expanding vm_flags would make us use it up easily so that we might need more space.

Readahead flags are good candidate to move into another space and arch-specific flags, I guess. Another candidate I think of is THP flag. It's just for only anonymous vma now (But I am not sure we have a plan to support it for file-backed pages in future) so we can move it to anon_vma or somewhere.
I think other guys might find more somethings

The point is that at least, we have to discuss about clean up current vm_flags's use cases before expanding it unconditionally.

Quoted 82 lines · Konstantin Khlebnikov

There is good old tradition: every year somebody submit patches for extending vma->vm_flags upto 64-bits, because there no free bits left on 32-bit systems.

previous attempts:
https://lkml.org/lkml/2011/4/12/24 (KOSAKI Motohiro)
https://lkml.org/lkml/2010/4/27/23 (Benjamin Herrenschmidt)
https://lkml.org/lkml/2009/10/1/202 (Hugh Dickins)

Here already exist special type for this: vm_flags_t, but not all code uses it. So, before switching vm_flags_t from unsinged long to u64 we must spread vm_flags_t everywhere and fix all possible type-casting problems.

There is no functional changes in this patch set, it only prepares code for vma->vm_flags converting.

---

Konstantin Khlebnikov (16):
mm: introduce NR_VMA_FLAGS
mm: use vm_flags_t for vma flags
mm/shmem: use vm_flags_t for vma flags
mm/nommu: use vm_flags_t for vma flags
mm/drivers: use vm_flags_t for vma flags
mm/x86: use vm_flags_t for vma flags
mm/arm: use vm_flags_t for vma flags
mm/unicore32: use vm_flags_t for vma flags
mm/ia64: use vm_flags_t for vma flags
mm/powerpc: use vm_flags_t for vma flags
mm/s390: use vm_flags_t for vma flags
mm/mips: use vm_flags_t for vma flags
mm/parisc: use vm_flags_t for vma flags
mm/score: use vm_flags_t for vma flags
mm: cast vm_flags_t to u64 before printing
mm: vm_flags_t strict type checking

 arch/arm/include/asm/cacheflush.h                |    5 -
 arch/arm/kernel/asm-offsets.c                    |    6 +
 arch/arm/mm/fault.c                              |    2 
 arch/ia64/mm/fault.c                             |    9 +
 arch/mips/mm/c-r3k.c                             |    2 
 arch/mips/mm/c-r4k.c                             |    6 -
 arch/mips/mm/c-tx39.c                            |    2 
 arch/parisc/mm/fault.c                           |    4 -
 arch/powerpc/include/asm/mman.h                  |    2 
 arch/s390/mm/fault.c                             |    8 +
 arch/score/mm/cache.c                            |    6 -
 arch/sh/mm/tlbflush_64.c                         |    2 
 arch/unicore32/kernel/asm-offsets.c              |    6 +
 arch/unicore32/mm/fault.c                        |    2 
 arch/x86/mm/hugetlbpage.c                        |    4 -
 drivers/char/mem.c                               |    2 
 drivers/infiniband/hw/ipath/ipath_file_ops.c     |    6 +
 drivers/infiniband/hw/qib/qib_file_ops.c         |    6 +
 drivers/media/video/omap3isp/ispqueue.h          |    2 
 drivers/staging/android/ashmem.c                 |    2 
 drivers/staging/android/binder.c                 |   15 +-
 drivers/staging/tidspbridge/core/tiomap3430.c    |   13 +-
 drivers/staging/tidspbridge/rmgr/drv_interface.c |    4 -
 fs/binfmt_elf.c                                  |    2 
 fs/binfmt_elf_fdpic.c                            |   24 ++-
 fs/exec.c                                        |    2 
 fs/proc/nommu.c                                  |    3 
 fs/proc/task_nommu.c                             |   14 +-
 include/linux/backing-dev.h                      |    7 -
 include/linux/huge_mm.h                          |    4 -
 include/linux/ksm.h                              |    8 +
 include/linux/mm.h                               |  163 +++++++++++++++-------
 include/linux/mm_types.h                         |   11 +
 include/linux/mman.h                             |    4 -
 include/linux/rmap.h                             |    8 +
 include/linux/shmem_fs.h                         |    5 -
 kernel/bounds.c                                  |    2 
 kernel/events/core.c                             |    4 -
 kernel/fork.c                                    |    2 
 kernel/sys.c                                     |    4 -
 mm/backing-dev.c                                 |    4 +
 mm/huge_memory.c                                 |    2 
 mm/ksm.c                                         |    4 -
 mm/madvise.c                                     |    2 
 mm/memory.c                                      |    9 +
 mm/mlock.c                                       |    2 
Quoted 18 lines
 mm/mmap.c                                        |   36 ++---
 mm/mprotect.c                                    |    9 +
 mm/mremap.c                                      |    2 
 mm/nommu.c                                       |   19 +--
 mm/rmap.c                                        |   16 +-
 mm/shmem.c                                       |   54 ++++---
 mm/vmscan.c                                      |    4 -
 53 files changed, 322 insertions(+), 224 deletions(-)
Signature · 8 lines
Signature

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v1 5/16
#10 lore raw

Re: [PATCH 05/16] mm/drivers: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov

Hi Konstantin,

Thanks for the patch.

Quoted 10 lines · On Wednesday 21 March 2012 10:56:33 Konstantin Khlebnikov wrote:
Cc Laurent Pinchart <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc John Stultz <[email protected]>
Cc "Arve Hjønnevåg" <[email protected]>
---
 drivers/media/video/omap3isp/ispqueue.h |    2 +-

For the OMAP3 ISP driver,

Quoted 30 lines
 drivers/staging/android/ashmem.c        |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/media/video/omap3isp/ispqueue.h index 92c5a12..908dfd7 100644

drivers/media/video/omap3isp/ispqueue.h +1 -1
@@ -90,7 +90,7 @@ struct isp_video_buffer {
 	void *vaddr;
 
 	/* For userspace buffers. */
-	unsigned long vm_flags;
+	vm_flags_t vm_flags;
 	unsigned long offset;
 	unsigned int npages;
 	struct page **pages;
(quoted diff) +0 -0

b/drivers/staging/android/ashmem.c index 9f1f27e..4511420 100644

drivers/staging/android/ashmem.c +1 -1
@@ -269,7 +269,7 @@ out:
 	return ret;
 }
 
-static inline unsigned long calc_vm_may_flags(unsigned long prot)
+static inline vm_flags_t calc_vm_may_flags(unsigned long prot)
 {
 	return _calc_vm_trans(prot, PROT_READ,  VM_MAYREAD) |
 	       _calc_vm_trans(prot, PROT_WRITE, VM_MAYWRITE) |
Signature · 3 lines
Regards,

Laurent Pinchart
#7 lore raw

PATCH v2 4/16 mm/nommu: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov

v2: fix compilation

---

This time, I honestly checked the compiling for arm/at91x40_defconfig last linux-next is broken, but my parts are ok.

---
 fs/proc/nommu.c      |   14 ++++++++------
 fs/proc/task_nommu.c |   14 ++++++++------
 mm/nommu.c           |   19 ++++++++++---------
 3 files changed, 26 insertions(+), 21 deletions(-)
fs/proc/nommu.c +8 -6
index b1822dd..6046ddb 100644
@@ -39,9 +39,10 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
 	unsigned long ino = 0;
 	struct file *file;
 	dev_t dev = 0;
-	int flags, len;
+	int len;
+	vm_flags_t vm_flags;
 
-	flags = region->vm_flags;
+	vm_flags = region->vm_flags;
 	file = region->vm_file;
 
 	if (file) {
@@ -54,10 +55,11 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
 		   "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
 		   region->vm_start,
 		   region->vm_end,
-		   flags & VM_READ ? 'r' : '-',
-		   flags & VM_WRITE ? 'w' : '-',
-		   flags & VM_EXEC ? 'x' : '-',
-		   flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p',
+		   vm_flags & VM_READ ? 'r' : '-',
+		   vm_flags & VM_WRITE ? 'w' : '-',
+		   vm_flags & VM_EXEC ? 'x' : '-',
+		   vm_flags & VM_MAYSHARE ?
+			vm_flags & VM_SHARED ? 'S' : 's' : 'p',
 		   ((loff_t)region->vm_pgoff) << PAGE_SHIFT,
 		   MAJOR(dev), MINOR(dev), ino, &len);
 
fs/proc/task_nommu.c +8 -6
index 74fe164..9447caa 100644
@@ -142,10 +142,11 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
 	unsigned long ino = 0;
 	struct file *file;
 	dev_t dev = 0;
-	int flags, len;
+	int len;
+	vm_flags_t vm_flags;
 	unsigned long long pgoff = 0;
 
-	flags = vma->vm_flags;
+	vm_flags = vma->vm_flags;
 	file = vma->vm_file;
 
 	if (file) {
@@ -159,10 +160,11 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
 		   "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
 		   vma->vm_start,
 		   vma->vm_end,
-		   flags & VM_READ ? 'r' : '-',
-		   flags & VM_WRITE ? 'w' : '-',
-		   flags & VM_EXEC ? 'x' : '-',
-		   flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p',
+		   vm_flags & VM_READ ? 'r' : '-',
+		   vm_flags & VM_WRITE ? 'w' : '-',
+		   vm_flags & VM_EXEC ? 'x' : '-',
+		   vm_flags & VM_MAYSHARE ?
+			vm_flags & VM_SHARED ? 'S' : 's' : 'p',
 		   pgoff,
 		   MAJOR(dev), MINOR(dev), ino, &len);
 
mm/nommu.c +10 -9
index f59e170..33d0ab7 100644
@@ -130,7 +130,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
 		     int *retry)
 {
 	struct vm_area_struct *vma;
-	unsigned long vm_flags;
+	vm_flags_t vm_flags;
 	int i;
 
 	/* calculate required read or write permissions.
@@ -658,13 +658,13 @@ static void put_nommu_region(struct vm_region *region)
 /*
  * update protection on a vma
  */
-static void protect_vma(struct vm_area_struct *vma, unsigned long flags)
+static void protect_vma(struct vm_area_struct *vma, vm_flags_t vm_flags)
 {
 #ifdef CONFIG_MPU
 	struct mm_struct *mm = vma->vm_mm;
 	long start = vma->vm_start & PAGE_MASK;
 	while (start < vma->vm_end) {
-		protect_page(mm, start, flags);
+		protect_page(mm, start, vm_flags);
 		start += PAGE_SIZE;
 	}
 	update_protections(mm);
@@ -1060,12 +1060,12 @@ static int validate_mmap_request(struct file *file,
  * we've determined that we can make the mapping, now translate what we
  * now know into VMA flags
  */
-static unsigned long determine_vm_flags(struct file *file,
-					unsigned long prot,
-					unsigned long flags,
-					unsigned long capabilities)
+static vm_flags_t determine_vm_flags(struct file *file,
+				     unsigned long prot,
+				     unsigned long flags,
+				     unsigned long capabilities)
 {
-	unsigned long vm_flags;
+	vm_flags_t vm_flags;
 
 	vm_flags = calc_vm_prot_bits(prot) | calc_vm_flag_bits(flags);
 	/* vm_flags |= mm->def_flags; */
@@ -1243,7 +1243,8 @@ unsigned long do_mmap_pgoff(struct file *file,
 	struct vm_area_struct *vma;
 	struct vm_region *region;
 	struct rb_node *rb;
-	unsigned long capabilities, vm_flags, result;
+	unsigned long capabilities, result;
+	vm_flags_t vm_flags;
 	int ret;
 
 	kenter(",%lx,%lx,%lx,%lx,%lx", addr, len, prot, flags, pgoff);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#28 lore raw

PATCH v2 16/16 mm: vm_flags_t strict type checking

In reply to Konstantin Khlebnikov

Now nobody uses VM_* constants in macro-expressions, so we can add type to them.

v2: resolve conflict with patch "coredump: add VM_NODUMP, MADV_NODUMP, MADV_CLEAR_NODUMP"

Cc Benjamin Herrenschmidt <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Cc Hugh Dickins <[email protected]>
---
 include/linux/mm.h       |  135 ++++++++++++++++++++++++++++++++--------------
 include/linux/mm_types.h |    4 +
 2 files changed, 96 insertions(+), 43 deletions(-)
include/linux/mm.h +94 -41
index 4ff7bad..4aeb3f5 100644
@@ -74,59 +74,112 @@ extern unsigned int kobjsize(const void *objp);
  * vm_flags in vm_area_struct, see mm_types.h.
  */
 
-#define VM_NONE		0x00000000
+enum {
+	__VM_READ,
+	__VM_WRITE,
+	__VM_EXEC,
+	__VM_SHARED,
+
+	__VM_MAYREAD,
+	__VM_MAYWRITE,
+	__VM_MAYEXEC,
+	__VM_MAYSHARE,
+
+	__VM_GROWSDOWN,
+#if defined(CONFIG_STACK_GROWSUP) || defined(CONFIG_IA64)
+	__VM_GROWSUP,
+#else
+	__VM_NOHUGEPAGE,
+#endif
+	__VM_PFNMAP,
+	__VM_DENYWRITE,
+
+	__VM_EXECUTABLE,
+	__VM_LOCKED,
+	__VM_IO,
+	__VM_SEQ_READ,
+
+	__VM_RAND_READ,
+	__VM_DONTCOPY,
+	__VM_DONTEXPAND,
+	__VM_RESERVED,
+
+	__VM_ACCOUNT,
+	__VM_NORESERVE,
+	__VM_HUGETLB,
+	__VM_NONLINEAR,
+
+#ifndef CONFIG_TRANSPARENT_HUGEPAGE
+	__VM_MAPPED_COPY,
+#else
+	__VM_HUGEPAGE,
+#endif
+	__VM_INSERTPAGE,
+	__VM_NODUMP,
+	__VM_CAN_NONLINEAR,
+
+	__VM_MIXEDMAP,
+	__VM_SAO,
+	__VM_PFN_AT_MMAP,
+	__VM_MERGEABLE,
+
+	__NR_VMA_FLAGS
+};
+
+#define VM_NONE		((__force vm_flags_t)0)
+
+#define __VMF(name)	((__force vm_flags_t)(1ull << (__VM_##name)))
 
-#define VM_READ		0x00000001	/* currently active flags */
-#define VM_WRITE	0x00000002
-#define VM_EXEC		0x00000004
-#define VM_SHARED	0x00000008
+#define VM_READ		__VMF(READ)	/* currently active flags */
+#define VM_WRITE	__VMF(WRITE)
+#define VM_EXEC		__VMF(EXEC)
+#define VM_SHARED	__VMF(SHARED)
 
 /* mprotect() hardcodes VM_MAYREAD >> 4 == VM_READ, and so for r/w/x bits. */
-#define VM_MAYREAD	0x00000010	/* limits for mprotect() etc */
-#define VM_MAYWRITE	0x00000020
-#define VM_MAYEXEC	0x00000040
-#define VM_MAYSHARE	0x00000080
+#define VM_MAYREAD	__VMF(MAYREAD)	/* limits for mprotect() etc */
+#define VM_MAYWRITE	__VMF(MAYWRITE)
+#define VM_MAYEXEC	__VMF(MAYEXEC)
+#define VM_MAYSHARE	__VMF(MAYSHARE)
 
-#define VM_GROWSDOWN	0x00000100	/* general info on the segment */
+#define VM_GROWSDOWN	__VMF(GROWSDOWN) /* general info on the segment */
 #if defined(CONFIG_STACK_GROWSUP) || defined(CONFIG_IA64)
-#define VM_GROWSUP	0x00000200
+#define VM_GROWSUP	__VMF(GROWSUP)
 #else
-#define VM_GROWSUP	0x00000000
-#define VM_NOHUGEPAGE	0x00000200	/* MADV_NOHUGEPAGE marked this vma */
+#define VM_GROWSUP	VM_NONE
+#define VM_NOHUGEPAGE	__VMF(NOHUGEPAGE) /* MADV_NOHUGEPAGE marked this vma */
 #endif
-#define VM_PFNMAP	0x00000400	/* Page-ranges managed without "struct page", just pure PFN */
-#define VM_DENYWRITE	0x00000800	/* ETXTBSY on write attempts.. */
-
-#define VM_EXECUTABLE	0x00001000
-#define VM_LOCKED	0x00002000
-#define VM_IO           0x00004000	/* Memory mapped I/O or similar */
-
-					/* Used by sys_madvise() */
-#define VM_SEQ_READ	0x00008000	/* App will access data sequentially */
-#define VM_RAND_READ	0x00010000	/* App will not benefit from clustered reads */
-
-#define VM_DONTCOPY	0x00020000      /* Do not copy this vma on fork */
-#define VM_DONTEXPAND	0x00040000	/* Cannot expand with mremap() */
-#define VM_RESERVED	0x00080000	/* Count as reserved_vm like IO */
-#define VM_ACCOUNT	0x00100000	/* Is a VM accounted object */
-#define VM_NORESERVE	0x00200000	/* should the VM suppress accounting */
-#define VM_HUGETLB	0x00400000	/* Huge TLB Page VM */
-#define VM_NONLINEAR	0x00800000	/* Is non-linear (remap_file_pages) */
+#define VM_PFNMAP	__VMF(PFNMAP)	/* Page-ranges managed without "struct page", just pure PFN */
+#define VM_DENYWRITE	__VMF(DENYWRITE)/* ETXTBSY on write attempts.. */
+
+#define VM_EXECUTABLE	__VMF(EXECUTABLE)
+#define VM_LOCKED	__VMF(LOCKED)
+#define VM_IO		__VMF(IO)	/* Memory mapped I/O or similar */
+
+					  /* Used by sys_madvise() */
+#define VM_SEQ_READ	__VMF(SEQ_READ)	/* App will access data sequentially */
+#define VM_RAND_READ	__VMF(RAND_READ) /* App will not benefit from clustered reads */
+
+#define VM_DONTCOPY	__VMF(DONTCOPY)	/* Do not copy this vma on fork */
+#define VM_DONTEXPAND	__VMF(DONTEXPAND) /* Cannot expand with mremap() */
+#define VM_RESERVED	__VMF(RESERVED)	/* Count as reserved_vm like IO */
+#define VM_ACCOUNT	__VMF(ACCOUNT)	/* Is a VM accounted object */
+#define VM_NORESERVE	__VMF(NORESERVE) /* should the VM suppress accounting */
+#define VM_HUGETLB	__VMF(HUGETLB)	/* Huge TLB Page VM */
+#define VM_NONLINEAR	__VMF(NONLINEAR) /* Is non-linear (remap_file_pages) */
 #ifndef CONFIG_TRANSPARENT_HUGEPAGE
-#define VM_MAPPED_COPY	0x01000000	/* T if mapped copy of data (nommu mmap) */
+#define VM_MAPPED_COPY	__VMF(MAPPED_COPY) /* T if mapped copy of data (nommu mmap) */
 #else
-#define VM_HUGEPAGE	0x01000000	/* MADV_HUGEPAGE marked this vma */
+#define VM_HUGEPAGE	__VMF(HUGEPAGE)	/* MADV_HUGEPAGE marked this vma */
 #endif
-#define VM_INSERTPAGE	0x02000000	/* The vma has had "vm_insert_page()" done on it */
-#define VM_NODUMP	0x04000000	/* Do not include in the core dump */
 
-#define VM_CAN_NONLINEAR 0x08000000	/* Has ->fault & does nonlinear pages */
-#define VM_MIXEDMAP	0x10000000	/* Can contain "struct page" and pure PFN pages */
-#define VM_SAO		0x20000000	/* Strong Access Ordering (powerpc) */
-#define VM_PFN_AT_MMAP	0x40000000	/* PFNMAP vma that is fully mapped at mmap time */
-#define VM_MERGEABLE	0x80000000	/* KSM may merge identical pages */
+#define VM_INSERTPAGE	__VMF(INSERTPAGE) /* The vma has had "vm_insert_page()" done on it */
+#define VM_NODUMP	__VMF(NODUMP)	/* Do not include in the core dump */
 
-#define __NR_VMA_FLAGS	32
+#define VM_CAN_NONLINEAR __VMF(CAN_NONLINEAR) /* Has ->fault & does nonlinear pages */
+#define VM_MIXEDMAP	__VMF(MIXEDMAP)	/* Can contain "struct page" and pure PFN pages */
+#define VM_SAO		__VMF(SAO)	/* Strong Access Ordering (powerpc) */
+#define VM_PFN_AT_MMAP	__VMF(PFN_AT_MMAP) /* PFNMAP vma that is fully mapped at mmap time */
+#define VM_MERGEABLE	__VMF(MERGEABLE) /* KSM may merge identical pages */
 
 #ifndef __GENERATING_BOUNDS_H
 
include/linux/mm_types.h +2 -2
index d57e764..f14cc5e 100644
@@ -172,9 +172,9 @@ struct page_frag {
 };
 
 #if (NR_VMA_FLAGS > 32)
-typedef unsigned long long __nocast vm_flags_t;
+typedef unsigned long long __bitwise__ vm_flags_t;
 #else
-typedef unsigned long __nocast vm_flags_t;
+typedef unsigned long __bitwise__ vm_flags_t;
 #endif
 
 /*

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#30 lore raw
In reply to Minchan Kim
Quoted 10 lines · Minchan Kim

Hi Konstantin,

It seems to be nice clean up to me and you are a volunteer we have been wanted for a long time. Thanks!
I am one of people who really want to expand vm_flags to 64 bit but when KOSAKI tried it, Linus said his concerning, I guess you already saw that.

He want to tidy vm_flags's usage up rather than expanding it. Without the discussion about that, just expanding vm_flags would make us use it up easily so that we might need more space.

Strictly speaking, my pachset does not expands vm_flags, it just prepares to this. Anyway vm_flags_t looks better than hard-coded "unsigned long" and messy type-casts around it.

Quoted 9 lines

Readahead flags are good candidate to move into another space and arch-specific flags, I guess. Another candidate I think of is THP flag. It's just for only anonymous vma now (But I am not sure we have a plan to support it for file-backed pages in future) so we can move it to anon_vma or somewhere.
I think other guys might find more somethings

The point is that at least, we have to discuss about clean up current vm_flags's use cases before expanding it unconditionally.

Seems like we can easily remove VM_EXECUTABLE
(count in mm->num_exe_file_vmas amount of vmas with vma->vm_file == mm->exe_file instead of vmas with VM_EXECUTABLE bit)

And probably VM_CAN_NONLINEAR...

Quoted 10 lines · Konstantin Khlebnikov
Quoted 8 lines

There is good old tradition: every year somebody submit patches for extending vma->vm_flags upto 64-bits, because there no free bits left on 32-bit systems.

previous attempts:
https://lkml.org/lkml/2011/4/12/24 (KOSAKI Motohiro)
https://lkml.org/lkml/2010/4/27/23 (Benjamin Herrenschmidt)
https://lkml.org/lkml/2009/10/1/202 (Hugh Dickins)

Quoted 7 lines
Quoted 7 lines

Here already exist special type for this: vm_flags_t, but not all code uses it. So, before switching vm_flags_t from unsinged long to u64 we must spread vm_flags_t everywhere and fix all possible type-casting problems.

There is no functional changes in this patch set, it only prepares code for vma->vm_flags converting.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer Acked-by on v1 5/16
#11 lore raw

Re: [PATCH 05/16] mm/drivers: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov
Quoted 8 lines · Konstantin Khlebnikov
Cc Laurent Pinchart <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc John Stultz <[email protected]>
Cc "Arve Hjønnevåg" <[email protected]>
#31 lore raw
In reply to Konstantin Khlebnikov
Quoted 8 lines · Konstantin Khlebnikov
Quoted 7 lines · Minchan Kim

Hi Konstantin,

It seems to be nice clean up to me and you are a volunteer we have been wanted for a long time. Thanks!
I am one of people who really want to expand vm_flags to 64 bit but when KOSAKI tried it, Linus said his concerning, I guess you already saw that.

Quoted 6 lines
Quoted 3 lines

He want to tidy vm_flags's usage up rather than expanding it. Without the discussion about that, just expanding vm_flags would make us use it up easily so that we might need more space.

Strictly speaking, my pachset does not expands vm_flags, it just prepares to this. Anyway vm_flags_t looks better than hard-coded "unsigned long" and messy type-casts around it.

Indeed.

Quoted 8 lines
Quoted 8 lines

Readahead flags are good candidate to move into another space and arch-specific flags, I guess. Another candidate I think of is THP flag. It's just for only anonymous vma now (But I am not sure we have a plan to support it for file-backed pages in future) so we can move it to anon_vma or somewhere.
I think other guys might find more somethings

Quoted 8 lines
Quoted 2 lines

The point is that at least, we have to discuss about clean up current vm_flags's use cases before expanding it unconditionally.

Seems like we can easily remove VM_EXECUTABLE
(count in mm->num_exe_file_vmas amount of vmas with vma->vm_file == mm->exe_file instead of vmas with VM_EXECUTABLE bit)

And probably VM_CAN_NONLINEAR...

I think we can also unify VM_MAPPED_COPY(nommu) and VM_SAO(powerpc) with one VM_ARCH_1 Okay. After this series is merged, let's try to remove flags we can do. Then, other guys might suggest another ideas.

Thanks.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#32 lore raw
Quoted 5 lines · Minchan Kim

I think we can also unify VM_MAPPED_COPY(nommu) and VM_SAO(powerpc) with one VM_ARCH_1
Okay. After this series is merged, let's try to remove flags we can do. Then, other guys
might suggest another ideas.

Agreed. I would like more VM_ARCH while at it :-)

Cheers,
Ben.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer
#15 lore raw

Re: [PATCH 07/16] mm/arm: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov
Quoted 10 lines · On Wed, 21 Mar 2012 10:56:42 +0400 Konstantin Khlebnikov…

Cast vm_flags to unsigned int for __cpuc_flush_user_range(), because its vm_flags argument declared as unsigned int. Asssembler code wants to test VM_EXEC bit on vma->vm_flags, but for big-endian we should get upper word for this.

...

arch/arm/include/asm/cacheflush.h vivt_flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned · line 221

Quoted 6 lines
arch/arm/include/asm/cacheflush.h +1 -1
@@ -217,7 +217,7 @@ vivt_flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned
 {
 	if (cpumask_test_cpu(smp_processor_id(), mm_cpumask(vma->vm_mm)))
 		__cpuc_flush_user_range(start & PAGE_MASK, PAGE_ALIGN(end),
-					vma->vm_flags);
+					(__force unsigned int)vma->vm_flags);
 }

This won't work if a later version of __cpuc_flush_user_range() needs access to newly-added flags in the upper 32 bits.

I guess we don't have to do anything about it at this stage, and that if we do ever hit this problem, we'll need to put those newly-added flags into the lower 32 bits of the vm_flags_t.

maintainer
#37 lore raw
In reply to Konstantin Khlebnikov
Quoted 8 lines · On Wed, 21 Mar 2012 17:16:06 +0400 Konstantin Khlebnikov…
Quoted 7 lines · Minchan Kim

Hi Konstantin,

It seems to be nice clean up to me and you are a volunteer we have been wanted for a long time. Thanks!
I am one of people who really want to expand vm_flags to 64 bit but when KOSAKI tried it, Linus said his concerning, I guess you already saw that.

Quoted 6 lines
Quoted 3 lines

He want to tidy vm_flags's usage up rather than expanding it. Without the discussion about that, just expanding vm_flags would make us use it up easily so that we might need more space.

Strictly speaking, my pachset does not expands vm_flags, it just prepares to this. Anyway vm_flags_t looks better than hard-coded "unsigned long" and messy type-casts around it.

It would be nice to find some way of triggering compiler warnings or sparse warnings if someone mixes a 32-bit type with a vm_flags_t. Any thoughts on this?

(Maybe that's what __nocast does, but Documentation/sparse.txt doesn't describe it)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer
#38 lore raw
Quoted 6 lines · Andrew Morton

It would be nice to find some way of triggering compiler warnings or sparse warnings if someone mixes a 32-bit type with a vm_flags_t. Any thoughts on this?

(Maybe that's what __nocast does, but Documentation/sparse.txt doesn't describe it)

Use __bitwise for that - check how gfp_t is handled.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer
#39 lore raw
Quoted 9 lines · On Thu, 22 Mar 2012 21:28:11 +0000 Al Viro <[email protected]> wrote:
Quoted 6 lines · Andrew Morton

It would be nice to find some way of triggering compiler warnings or sparse warnings if someone mixes a 32-bit type with a vm_flags_t. Any thoughts on this?

(Maybe that's what __nocast does, but Documentation/sparse.txt doesn't describe it)

Use __bitwise for that - check how gfp_t is handled.

So what does __nocast do?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer
#40 lore raw
Quoted 8 lines · Andrew Morton
Quoted 5 lines · On Thu, 22 Mar 2012 21:28:11 +0000 Al Viro <[email protected]> wrote:
Quoted 4 lines · Andrew Morton

It would be nice to find some way of triggering compiler warnings or sparse warnings if someone mixes a 32-bit type with a vm_flags_t. Any thoughts on this?

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

(Maybe that's what __nocast does, but Documentation/sparse.txt doesn't describe it)

Use __bitwise for that - check how gfp_t is handled.

So what does __nocast do?

Not much... Basically, extending conversions. __nocast int can be freely mixed with int - no complaints will be given.

As far as I'm concerned, it's deprecated - it's weaker than __bitwise and doesn't have particulary useful semantics. For this kind of stuff (flags) __bitwise is definitely better - that's what it had been implemented for.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#41 lore raw
In reply to Andrew Morton
Quoted 8 lines · Andrew Morton
Quoted 5 lines · On Thu, 22 Mar 2012 21:28:11 +0000 Al Viro<[email protected]> wrote:
Quoted 4 lines · Andrew Morton

It would be nice to find some way of triggering compiler warnings or sparse warnings if someone mixes a 32-bit type with a vm_flags_t. Any thoughts on this?

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

(Maybe that's what __nocast does, but Documentation/sparse.txt doesn't describe it)

Use __bitwise for that - check how gfp_t is handled.

So what does __nocast do?

Actually it forbid any non-forced casts, but its implementation in sparse seems buggy:
__nocast generates some strange false positives. For example it sometimes forgot about type attributes in function arguments, I saw this for vm_flags argument in ksm_madvise(). I can reproduce this bug, if somebody interested.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#47 lore raw
In reply to Andrew Morton
Quoted 4 lines · Andrew Morton
Quoted 2 lines

Use __bitwise for that - check how gfp_t is handled.

So what does __nocast do?

__nocast warns about explicit or implicit casting to different types.

HOWEVER, it doesn't consider two 32-bit integers to be different types, so a __nocast 'int' type may be returned as a regular 'int' type and then the __nocast is lost.

So "__nocast" on integer types is usually not that powerful. It just gets lost too easily. It's more useful for things like pointers. It also doesn't warn about the mixing: you can add integers to __nocast integer types, and it's not really considered anything wrong.

__bitwise ends up being a "stronger integer separation". That one doesn't allow you to mix with non-bitwise integers, so now it's much harder to lose the type by mistake.

So basic rules is:

- "__nocast" on its own tends to be more useful for *big* integers
that still need to act like integers, but you want to make it much less likely that they get truncated by mistake. So a 64-bit integer that you don't want to mistakenly/silently be returned as "int", for example. But they mix well with random integer types, so you can add to them etc without using anything special. However, that mixing also means that the __nocast really gets lost fairly easily.

- "__bitwise" is for *unique types* that cannot be mixed with other
types, and that you'd never want to just use as a random integer (the integer 0 is special, though, and gets silently accepted iirc - it's kind of like "NULL" for pointers). So "gfp_t" or the "safe endianness" types would be __bitwise: you can only operate on them by doing specific operations that know about *that* particular type.

Generally, you want __bitwise if you are looking for type safety. "__nocast" really is pretty weak.

Linus

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#42 lore raw
In reply to Konstantin Khlebnikov
Quoted 12 lines · Konstantin Khlebnikov
Quoted 11 lines · Andrew Morton
Quoted 8 lines · On Thu, 22 Mar 2012 21:28:11 +0000 Al Viro<[email protected]> wrote:
Quoted 6 lines · Andrew Morton

It would be nice to find some way of triggering compiler warnings or sparse warnings if someone mixes a 32-bit type with a vm_flags_t. Any thoughts on this?

(Maybe that's what __nocast does, but Documentation/sparse.txt doesn't describe it)

Quoted 9 lines
Quoted 3 lines
Quoted 1 line

Use __bitwise for that - check how gfp_t is handled.

So what does __nocast do?

Actually it forbid any non-forced casts, but its implementation in sparse seems buggy:
__nocast generates some strange false positives. For example it sometimes forgot about type attributes in function arguments, I saw this for vm_flags argument in ksm_madvise(). I can reproduce this bug, if somebody interested.

1.c:

# define __nocast	__attribute__((nocast))

typedef long __nocast long_t;

static void f(long_t *x)
{
}

static void g(void)

{
	long_t x;

	f(&x);
}
$ sparse 1.c
1.c:13:12: warning: incorrect type in argument 1 (different modifiers)
1.c:13:12:    expected int [nocast] [usertype] *x
1.c:13:12:    got int *<noident>
1.c:13:12: warning: implicit cast to nocast type

Is this ok?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#43 lore raw
Quoted 4 lines · Konstantin Khlebnikov
# define __nocast       __attribute__((nocast))

typedef long __nocast long_t;

So the intention is that this really creates a *new* type.

So "long_t" really is a different type from "long", but because __nocast is so weak, it happily casts to another integer type of the same size.

But a pointer to it is different, the same way "int *" is different from "long *" even if "int" and "long" happen to have the same size. So I do think that the warning you quote is correct and expected:

Quoted 6 lines

1.c:13:12: warning: incorrect type in argument 1 (different modifiers) 1.c:13:12:    expected int [nocast] [usertype] *x 1.c:13:12:    got int *<noident>
1.c:13:12: warning: implicit cast to nocast type

Is this ok?

Yes.

The thing about __nocast is that it's so *very* very easy to lose it. For example, do this:

typedef long __nocast long_t;

  int main(long_t a)
  {
        return a;
  }

and you get the (expected) warning.

HOWEVER. Now do "return a+1" instead, and the warning goes away. Why? Because the expression ends up having just the type "long", because the "a" mixed happily with the "1" (that was cast from 'int' to 'long' by the normal C type rules).

That is arguably a bug, but this kind of thing really wasn't what __nocast was designed for. The __nocast design ended up being too weak, though, and we hardly use it in the kernel.

Linus

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#44 lore raw
Quoted 38 lines · Linus Torvalds
Quoted 4 lines · Konstantin Khlebnikov
# define __nocast       __attribute__((nocast))

typedef long __nocast long_t;

So the intention is that this really creates a *new* type.

So "long_t" really is a different type from "long", but because __nocast is so weak, it happily casts to another integer type of the same size.

But a pointer to it is different, the same way "int *" is different from "long *" even if "int" and "long" happen to have the same size. So I do think that the warning you quote is correct and expected:

Quoted 6 lines

1.c:13:12: warning: incorrect type in argument 1 (different modifiers)
1.c:13:12: expected int [nocast] [usertype] *x
1.c:13:12: got int *<noident>
1.c:13:12: warning: implicit cast to nocast type

Is this ok?

Yes.

The thing about __nocast is that it's so *very* very easy to lose it. For example, do this:

   typedef long __nocast long_t;

   int main(long_t a)
   {
         return a;
   }

and you get the (expected) warning.

Quoted 9 lines

HOWEVER. Now do "return a+1" instead, and the warning goes away. Why? Because the expression ends up having just the type "long", because the "a" mixed happily with the "1" (that was cast from 'int' to 'long' by the normal C type rules).

That is arguably a bug, but this kind of thing really wasn't what __nocast was designed for. The __nocast design ended up being too weak, though, and we hardly use it in the kernel.

Thanks. Looks like "__nocast" totally undocumented.
It would be nice to add something about this into Documentation/sparse.txt

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer
#45 lore raw
Quoted 21 lines · On Fri, 23 Mar 2012 02:52:05 +0400 Konstantin Khlebnikov…
Quoted 21 lines
Quoted 1 line

Is this ok?

Yes.

The thing about __nocast is that it's so *very* very easy to lose it. For example, do this:

   typedef long __nocast long_t;

   int main(long_t a)
   {
         return a;
   }

and you get the (expected) warning.

HOWEVER. Now do "return a+1" instead, and the warning goes away. Why? Because the expression ends up having just the type "long", because the "a" mixed happily with the "1" (that was cast from 'int' to 'long' by the normal C type rules).

Quoted 7 lines
Quoted 4 lines

That is arguably a bug, but this kind of thing really wasn't what __nocast was designed for. The __nocast design ended up being too weak, though, and we hardly use it in the kernel.

Thanks. Looks like "__nocast" totally undocumented.
It would be nice to add something about this into Documentation/sparse.txt

Yup, Chris has added this to his todo list (thanks!).

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer
#46 lore raw
Quoted 4 lines · Andrew Morton
Quoted 2 lines

Thanks. Looks like "__nocast" totally undocumented.
It would be nice to add something about this into Documentation/sparse.txt

Yup, Chris has added this to his todo list (thanks!).

Alternatively, we could just remove the remaining instances in the kernel - cputime_t is the only borderline reasonable one there; xfs ones should be __bitwise and so should zd_addr_t thing (with cpu_to_le16() moved from uses of those suckers to macro definitions). Hell knows - I suspect that cputime_t also might've been turned into __bitwise u64, but I hadn't checked if we ever do plain arithmetics on those...

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v2 4/16
#8 lore raw

Re: [PATCH v2 04/16] mm/nommu: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov

Hi Konstantin,

Quoted 10 lines · Konstantin Khlebnikov

v2: fix compilation

---

This time, I honestly checked the compiling for arm/at91x40_defconfig last linux-next is broken, but my parts are ok.

This looks ok to me.

Regards
Greg

Quoted 134 lines
---
  fs/proc/nommu.c      |   14 ++++++++------
  fs/proc/task_nommu.c |   14 ++++++++------
  mm/nommu.c           |   19 ++++++++++---------
  3 files changed, 26 insertions(+), 21 deletions(-)
fs/proc/nommu.c +8 -6
index b1822dd..6046ddb 100644
@@ -39,9 +39,10 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
  	unsigned long ino = 0;
  	struct file *file;
  	dev_t dev = 0;
-	int flags, len;
+	int len;
+	vm_flags_t vm_flags;
 
-	flags = region->vm_flags;
+	vm_flags = region->vm_flags;
  	file = region->vm_file;
 
  	if (file) {
@@ -54,10 +55,11 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
  		   "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
  		   region->vm_start,
  		   region->vm_end,
-		   flags&  VM_READ ? 'r' : '-',
-		   flags&  VM_WRITE ? 'w' : '-',
-		   flags&  VM_EXEC ? 'x' : '-',
-		   flags&  VM_MAYSHARE ? flags&  VM_SHARED ? 'S' : 's' : 'p',
+		   vm_flags&  VM_READ ? 'r' : '-',
+		   vm_flags&  VM_WRITE ? 'w' : '-',
+		   vm_flags&  VM_EXEC ? 'x' : '-',
+		   vm_flags&  VM_MAYSHARE ?
+			vm_flags&  VM_SHARED ? 'S' : 's' : 'p',
  		   ((loff_t)region->vm_pgoff)<<  PAGE_SHIFT,
  		   MAJOR(dev), MINOR(dev), ino,&len);
 
fs/proc/task_nommu.c +8 -6
index 74fe164..9447caa 100644
@@ -142,10 +142,11 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
  	unsigned long ino = 0;
  	struct file *file;
  	dev_t dev = 0;
-	int flags, len;
+	int len;
+	vm_flags_t vm_flags;
  	unsigned long long pgoff = 0;
 
-	flags = vma->vm_flags;
+	vm_flags = vma->vm_flags;
  	file = vma->vm_file;
 
  	if (file) {
@@ -159,10 +160,11 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
  		   "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
  		   vma->vm_start,
  		   vma->vm_end,
-		   flags&  VM_READ ? 'r' : '-',
-		   flags&  VM_WRITE ? 'w' : '-',
-		   flags&  VM_EXEC ? 'x' : '-',
-		   flags&  VM_MAYSHARE ? flags&  VM_SHARED ? 'S' : 's' : 'p',
+		   vm_flags&  VM_READ ? 'r' : '-',
+		   vm_flags&  VM_WRITE ? 'w' : '-',
+		   vm_flags&  VM_EXEC ? 'x' : '-',
+		   vm_flags&  VM_MAYSHARE ?
+			vm_flags&  VM_SHARED ? 'S' : 's' : 'p',
  		   pgoff,
  		   MAJOR(dev), MINOR(dev), ino,&len);
 
mm/nommu.c +10 -9
index f59e170..33d0ab7 100644
@@ -130,7 +130,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
  		     int *retry)
  {
  	struct vm_area_struct *vma;
-	unsigned long vm_flags;
+	vm_flags_t vm_flags;
  	int i;
 
  	/* calculate required read or write permissions.
@@ -658,13 +658,13 @@ static void put_nommu_region(struct vm_region *region)
  /*
   * update protection on a vma
   */
-static void protect_vma(struct vm_area_struct *vma, unsigned long flags)
+static void protect_vma(struct vm_area_struct *vma, vm_flags_t vm_flags)
  {
  #ifdef CONFIG_MPU
  	struct mm_struct *mm = vma->vm_mm;
  	long start = vma->vm_start&  PAGE_MASK;
  	while (start<  vma->vm_end) {
-		protect_page(mm, start, flags);
+		protect_page(mm, start, vm_flags);
  		start += PAGE_SIZE;
  	}
  	update_protections(mm);
@@ -1060,12 +1060,12 @@ static int validate_mmap_request(struct file *file,
   * we've determined that we can make the mapping, now translate what we
   * now know into VMA flags
   */
-static unsigned long determine_vm_flags(struct file *file,
-					unsigned long prot,
-					unsigned long flags,
-					unsigned long capabilities)
+static vm_flags_t determine_vm_flags(struct file *file,
+				     unsigned long prot,
+				     unsigned long flags,
+				     unsigned long capabilities)
  {
-	unsigned long vm_flags;
+	vm_flags_t vm_flags;
 
  	vm_flags = calc_vm_prot_bits(prot) | calc_vm_flag_bits(flags);
  	/* vm_flags |= mm->def_flags; */
@@ -1243,7 +1243,8 @@ unsigned long do_mmap_pgoff(struct file *file,
  	struct vm_area_struct *vma;
  	struct vm_region *region;
  	struct rb_node *rb;
-	unsigned long capabilities, vm_flags, result;
+	unsigned long capabilities, result;
+	vm_flags_t vm_flags;
  	int ret;
 
  	kenter(",%lx,%lx,%lx,%lx,%lx", addr, len, prot, flags, pgoff);
Signature · 12 lines
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#33 lore raw
In reply to Benjamin Herrenschmidt
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 5 lines · Minchan Kim

I think we can also unify VM_MAPPED_COPY(nommu) and VM_SAO(powerpc) with one VM_ARCH_1
Okay. After this series is merged, let's try to remove flags we can do. Then, other guys
might suggest another ideas.

Agreed. I would like more VM_ARCH while at it :-)

Currently I see here four architecture-specific flags =)

            VM_ARCH_1       VM_ARCH_2       VM_ARCH_3       VM_ARCH_4
    x86     VM_NOHUGEPAGE   VM_HUGEPAGE     -               VM_PFN_AT_MMAP
    powerpc -               -               VM_SAO          -
    parisc  VM_GROWSUP      -               -               -
    ia64    VM_GROWSUP      -               -               -
    nommu   -               VM_MAPPED_COPY  -               -

Obviously we can combine VM_PFN_AT_MMAP, VM_SAO, VM_GROWSUP and VM_MAPPED_COPY into one.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#34 lore raw
Quoted 12 lines · Konstantin Khlebnikov
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 5 lines · Minchan Kim

I think we can also unify VM_MAPPED_COPY(nommu) and VM_SAO(powerpc) with one VM_ARCH_1
Okay. After this series is merged, let's try to remove flags we can do. Then, other guys
might suggest another ideas.

Agreed. I would like more VM_ARCH while at it :-)

Currently I see here four architecture-specific flags =)

Quoted 8 lines

VM_ARCH_1 VM_ARCH_2 VM_ARCH_3 VM_ARCH_4
x86 VM_NOHUGEPAGE VM_HUGEPAGE - VM_PFN_AT_MMAP
powerpc - - VM_SAO -
parisc VM_GROWSUP - - -
ia64 VM_GROWSUP - - -
nommu - VM_MAPPED_COPY - -

Obviously we can combine VM_PFN_AT_MMAP, VM_SAO, VM_GROWSUP and VM_MAPPED_COPY into one.

Also logic and usage of VM_IO, VM_RESERVED, VM_PFNMAP, VM_MIXEDMAP, VM_INSERTPAGE, VM_DONTEXPAND and VM_DONTCOPY are very messy. I think some of them can be replaced with two flags:
VM_SPECIAL_PFN and VM_SPECIAL_PAGE, or something like this.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#35 lore raw
In reply to Konstantin Khlebnikov
Quoted 2 lines · Konstantin Khlebnikov

Obviously we can combine VM_PFN_AT_MMAP, VM_SAO, VM_GROWSUP and VM_MAPPED_COPY into one.

VM_PFN_AT_MMAP isn't arch specific afaik...

Cheers,
Ben.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#36 lore raw
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 2 lines · Konstantin Khlebnikov

Obviously we can combine VM_PFN_AT_MMAP, VM_SAO, VM_GROWSUP and VM_MAPPED_COPY into one.

VM_PFN_AT_MMAP isn't arch specific afaik...

Technically yes, but all this pfnmap-tracking engine has only one user: x86 PAT. We can easily make it x86-only, or try to implement it without using special flag on vma.

Quoted 5 lines

Cheers,
Ben.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#17 lore raw

Re: [PATCH 08/16] mm/unicore32: use vm_flags_t for vma flags

In reply to Konstantin Khlebnikov
Quoted 15 lines · Konstantin Khlebnikov

The same magic like in arm: assembler code wants to test VM_EXEC, but for big-endian we should get upper word for this.

---
  arch/unicore32/kernel/asm-offsets.c |    6 +++++-
  arch/unicore32/mm/fault.c           |    2 +-
  2 files changed, 6 insertions(+), 2 deletions(-)
arch/unicore32/kernel/asm-offsets.c +0 -0
index ffcbe75..e3199b5 100644

arch/unicore32/kernel/asm-offsets.c int main(void) · line 92

Quoted 6 lines
arch/unicore32/kernel/asm-offsets.c +3 -0
@@ -87,9 +87,13 @@ int main(void)
  	DEFINE(S_FRAME_SIZE,	sizeof(struct pt_regs));
  	BLANK();
  	DEFINE(VMA_VM_MM,	offsetof(struct vm_area_struct, vm_mm));
+#if defined(CONFIG_CPU_BIG_ENDIAN)&&  (NR_VMA_FLAGS>  32)
+	DEFINE(VMA_VM_FLAGS,	offsetof(struct vm_area_struct, vm_flags) + 4);
+#else

CONFIG_CPU_BIG/LITTLE_ENDIAN is defined only in some archs, and not supported by unicore32.

arch/unicore32/kernel/asm-offsets.c int main(void) · line 96

Quoted 5 lines
arch/unicore32/kernel/asm-offsets.c +2 -1
  	DEFINE(VMA_VM_FLAGS,	offsetof(struct vm_area_struct, vm_flags));
+#endif
  	BLANK();
-	DEFINE(VM_EXEC,		VM_EXEC);
+	DEFINE(VM_EXEC,		(__force unsigned int)VM_EXEC);

Is this check useful for asm-offsets.h?

arch/unicore32/mm/fault.c void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs) · line 161

Quoted 13 lines
arch/unicore32/kernel/asm-offsets.c +0 -0
  	BLANK();
  	DEFINE(PAGE_SZ,		PAGE_SIZE);
  	BLANK();
arch/unicore32/mm/fault.c +1 -1
index 283aa4b..9137996 100644
@@ -158,7 +158,7 @@ void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
   */
  static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma)
  {
-	unsigned int mask = VM_READ | VM_WRITE | VM_EXEC;
+	vm_flags_t mask = VM_READ | VM_WRITE | VM_EXEC;

I am confused for the type of vm_flags in vm_area_struct being 'unsigned long', not vm_flags_t.

Regards,

Guan Xuetao

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#18 lore raw

Re: [PATCH 08/16] mm/unicore32: use vm_flags_t for vma flags

Quoted 11 lines · Guan Xuetao
Quoted 10 lines · Konstantin Khlebnikov

The same magic like in arm: assembler code wants to test VM_EXEC, but for big-endian we should get upper word for this.

---
   arch/unicore32/kernel/asm-offsets.c |    6 +++++-
   arch/unicore32/mm/fault.c           |    2 +-
   2 files changed, 6 insertions(+), 2 deletions(-)
Quoted 13 lines

arch/unicore32/kernel/asm-offsets.c int main(void) · line 92

Quoted 11 lines
arch/unicore32/kernel/asm-offsets.c +3 -0
index ffcbe75..e3199b5 100644
@@ -87,9 +87,13 @@ int main(void)
   	DEFINE(S_FRAME_SIZE,	sizeof(struct pt_regs));
   	BLANK();
   	DEFINE(VMA_VM_MM,	offsetof(struct vm_area_struct, vm_mm));
+#if defined(CONFIG_CPU_BIG_ENDIAN)&&   (NR_VMA_FLAGS>   32)
+	DEFINE(VMA_VM_FLAGS,	offsetof(struct vm_area_struct, vm_flags) + 4);
+#else

CONFIG_CPU_BIG/LITTLE_ENDIAN is defined only in some archs, and not supported by unicore32.

Ok, I'll drop this in v2

Quoted 8 lines

arch/unicore32/kernel/asm-offsets.c int main(void) · line 96

Quoted 6 lines
arch/unicore32/kernel/asm-offsets.c +2 -1
   	DEFINE(VMA_VM_FLAGS,	offsetof(struct vm_area_struct, vm_flags));
+#endif
   	BLANK();
-	DEFINE(VM_EXEC,		VM_EXEC);
+	DEFINE(VM_EXEC,		(__force unsigned int)VM_EXEC);

Is this check useful for asm-offsets.h?

this forced-typecast to make sparse happy, because we use here only (int) part of vma->vm_flags.

Quoted 17 lines
Quoted 9 lines
arch/unicore32/kernel/asm-offsets.c +0 -0
   	BLANK();
   	DEFINE(PAGE_SZ,		PAGE_SIZE);
   	BLANK();
arch/unicore32/mm/fault.c +0 -0
index 283aa4b..9137996 100644

arch/unicore32/mm/fault.c void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs) · line 161

Quoted 5 lines
arch/unicore32/mm/fault.c +1 -1
@@ -158,7 +158,7 @@ void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
    */
   static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma)
   {
-	unsigned int mask = VM_READ | VM_WRITE | VM_EXEC;
+	vm_flags_t mask = VM_READ | VM_WRITE | VM_EXEC;

I am confused for the type of vm_flags in vm_area_struct being 'unsigned long', not vm_flags_t.

Second patch in this patchset changes it.
vm_flags_t will be unsigned long or or unsigned long long depending on vma flags count. But more likely it will be unsigned int, because I have another patchset in work, which currently drop four bits in vm_flags, so we can postpone its expansion.

Quoted 11 lines

Regards,

Guan Xuetao

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email:<a href=mailto:"[email protected]"> [email protected]</a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#19 lore raw

Re: [PATCH 08/16] mm/unicore32: use vm_flags_t for vma flags

Quoted 37 lines · Konstantin Khlebnikov
Quoted 11 lines · Guan Xuetao
Quoted 10 lines · Konstantin Khlebnikov

The same magic like in arm: assembler code wants to test VM_EXEC, but for big-endian we should get upper word for this.

---
   arch/unicore32/kernel/asm-offsets.c |    6 +++++-
   arch/unicore32/mm/fault.c           |    2 +-
   2 files changed, 6 insertions(+), 2 deletions(-)
Quoted 14 lines

arch/unicore32/kernel/asm-offsets.c int main(void) · line 93

Quoted 12 lines
arch/unicore32/kernel/asm-offsets.c +3 -0
index ffcbe75..e3199b5 100644
@@ -87,9 +87,13 @@ int main(void)
       DEFINE(S_FRAME_SIZE,    sizeof(struct pt_regs));
       BLANK();
       DEFINE(VMA_VM_MM,    offsetof(struct vm_area_struct, vm_mm));
+#if defined(CONFIG_CPU_BIG_ENDIAN)&&   (NR_VMA_FLAGS>   32)
+    DEFINE(VMA_VM_FLAGS,    offsetof(struct vm_area_struct, 
 vm_flags) + 4);
+#else

CONFIG_CPU_BIG/LITTLE_ENDIAN is defined only in some archs, and not supported by unicore32.

Ok, I'll drop this in v2

Quoted 7 lines
Quoted 7 lines
arch/unicore32/kernel/asm-offsets.c +2 -1
       DEFINE(VMA_VM_FLAGS,    offsetof(struct vm_area_struct, 
 vm_flags));
+#endif
       BLANK();
-    DEFINE(VM_EXEC,        VM_EXEC);
+    DEFINE(VM_EXEC,        (__force unsigned int)VM_EXEC);
Quoted 3 lines
Quoted 1 line

Is this check useful for asm-offsets.h?

this forced-typecast to make sparse happy, because we use here only (int) part of vma->vm_flags.

Perhaps, vm_flags_t, not unsigned int is more proper.

Quoted 21 lines
Quoted 12 lines
Quoted 12 lines
arch/unicore32/kernel/asm-offsets.c +0 -0
       BLANK();
       DEFINE(PAGE_SZ,        PAGE_SIZE);
       BLANK();
arch/unicore32/mm/fault.c +0 -0
index 283aa4b..9137996 100644
@@ -158,7 +158,7 @@ void do_bad_area(unsigned long addr, unsigned 
 int fsr, struct pt_regs *regs)
    */
Quoted 8 lines

arch/unicore32/mm/fault.c void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs) · line 161

Quoted 5 lines
arch/unicore32/mm/fault.c +1 -1
   static inline bool access_error(unsigned int fsr, struct 
 vm_area_struct *vma)
   {
-    unsigned int mask = VM_READ | VM_WRITE | VM_EXEC;
+    vm_flags_t mask = VM_READ | VM_WRITE | VM_EXEC;

I am confused for the type of vm_flags in vm_area_struct being 'unsigned long', not vm_flags_t.

Quoted 4 lines

Second patch in this patchset changes it.
vm_flags_t will be unsigned long or or unsigned long long depending on vma flags count. But more likely it will be unsigned int, because I have another patchset in work, which currently drop four bits in vm_flags, so we can postpone its expansion.

I see. Thanks for your explanation.

Regards,
Guan Xuetao

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#48 lore raw
In reply to Al Viro
Quoted 9 lines · Al Viro
Quoted 6 lines · Andrew Morton

It would be nice to find some way of triggering compiler warnings or sparse warnings if someone mixes a 32-bit type with a vm_flags_t. Any thoughts on this?

(Maybe that's what __nocast does, but Documentation/sparse.txt doesn't describe it)

Use __bitwise for that - check how gfp_t is handled.

Hmm..

If now we activate __bitwise, really plenty driver start create lots warnings. Does it make sense?

In fact, x86-32 keep 32bit vma_t forever. thus all x86 specific driver don't need any change. Moreover many ancient drivers has no maintainer and I can't expect such driver will be fixed even though a warning occur.

So, I think __nocast weakness is better than strict __bitwise annotation for this situation.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer
#49 lore raw
Quoted 9 lines · KOSAKI Motohiro
Quoted 8 lines · Al Viro
Quoted 6 lines · Andrew Morton

It would be nice to find some way of triggering compiler warnings or sparse warnings if someone mixes a 32-bit type with a vm_flags_t. Any thoughts on this?

(Maybe that's what __nocast does, but Documentation/sparse.txt doesn't describe it)

Quoted 6 lines
Quoted 1 line

Use __bitwise for that - check how gfp_t is handled.

Hmm..

If now we activate __bitwise, really plenty driver start create lots warnings. Does it make sense?

Huh? Why would they? Just adjust definitions of VM_... to include force-cast to vm_flags_t and we should be OK...

Quoted 3 lines

In fact, x86-32 keep 32bit vma_t forever. thus all x86 specific driver don't need any change. Moreover many ancient drivers has no maintainer and I can't expect such driver will be fixed even though a warning occur.

What warning? If something does manual vma->vm_flags = 0xwhatever, then yes, we do want it dealt with. If it's vma->vm_flags |= VM_something, there should be no warnings at all...

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>