[mmotm:master 113/211] include/linux/migrate.h:128:32: warning: left shift count >= width of type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   git://git.cmpxchg.org/linux-mmotm.git master
head:   8276ddb3c638602509386f1a05f75326dbf5ce09
commit: 50973108c6444ebacff41fbdb553c156dd144c33 [113/211] mm/migrate: new memory migration helper for use with device memory
config: i386-randconfig-s0-201711 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        git checkout 50973108c6444ebacff41fbdb553c156dd144c33
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from fs/btrfs/disk-io.c:29:0:
   include/linux/migrate.h: In function 'migrate_pfn_to_page':
>> include/linux/migrate.h:128:32: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_VALID (1UL << (BITS_PER_LONG_LONG - 1))
                                   ^
>> include/linux/migrate.h:137:15: note: in expansion of macro 'MIGRATE_PFN_VALID'
     if (!(mpfn & MIGRATE_PFN_VALID))
                  ^~~~~~~~~~~~~~~~~
   In file included from arch/x86/include/asm/page.h:75:0,
                    from arch/x86/include/asm/thread_info.h:11,
                    from include/linux/thread_info.h:25,
                    from arch/x86/include/asm/preempt.h:6,
                    from include/linux/preempt.h:80,
                    from include/linux/spinlock.h:50,
                    from include/linux/wait.h:8,
                    from include/linux/fs.h:5,
                    from fs/btrfs/disk-io.c:19:
   include/linux/migrate.h:133:32: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_MASK ((1UL << (BITS_PER_LONG_LONG - PAGE_SHIFT)) - 1)
                                   ^
   include/asm-generic/memory_model.h:32:41: note: in definition of macro '__pfn_to_page'
    #define __pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET))
                                            ^~~
>> include/linux/migrate.h:139:28: note: in expansion of macro 'MIGRATE_PFN_MASK'
     return pfn_to_page(mpfn & MIGRATE_PFN_MASK);
                               ^~~~~~~~~~~~~~~~
   In file included from fs/btrfs/disk-io.c:29:0:
   include/linux/migrate.h: In function 'migrate_pfn_size':
   include/linux/migrate.h:130:31: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_HUGE (1UL << (BITS_PER_LONG_LONG - 3))
                                  ^
>> include/linux/migrate.h:144:16: note: in expansion of macro 'MIGRATE_PFN_HUGE'
     return mpfn & MIGRATE_PFN_HUGE ? PMD_SIZE : PAGE_SIZE;
                   ^~~~~~~~~~~~~~~~
--
   In file included from mm/migrate.c:15:0:
   include/linux/migrate.h: In function 'migrate_pfn_to_page':
>> include/linux/migrate.h:128:32: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_VALID (1UL << (BITS_PER_LONG_LONG - 1))
                                   ^
>> include/linux/migrate.h:137:15: note: in expansion of macro 'MIGRATE_PFN_VALID'
     if (!(mpfn & MIGRATE_PFN_VALID))
                  ^~~~~~~~~~~~~~~~~
   In file included from arch/x86/include/asm/page.h:75:0,
                    from arch/x86/include/asm/thread_info.h:11,
                    from include/linux/thread_info.h:25,
                    from arch/x86/include/asm/preempt.h:6,
                    from include/linux/preempt.h:80,
                    from include/linux/spinlock.h:50,
                    from include/linux/mmzone.h:7,
                    from include/linux/gfp.h:5,
                    from include/linux/mm.h:9,
                    from include/linux/migrate.h:4,
                    from mm/migrate.c:15:
   include/linux/migrate.h:133:32: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_MASK ((1UL << (BITS_PER_LONG_LONG - PAGE_SHIFT)) - 1)
                                   ^
   include/asm-generic/memory_model.h:32:41: note: in definition of macro '__pfn_to_page'
    #define __pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET))
                                            ^~~
>> include/linux/migrate.h:139:28: note: in expansion of macro 'MIGRATE_PFN_MASK'
     return pfn_to_page(mpfn & MIGRATE_PFN_MASK);
                               ^~~~~~~~~~~~~~~~
   In file included from mm/migrate.c:15:0:
   include/linux/migrate.h: In function 'migrate_pfn_size':
   include/linux/migrate.h:130:31: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_HUGE (1UL << (BITS_PER_LONG_LONG - 3))
                                  ^
>> include/linux/migrate.h:144:16: note: in expansion of macro 'MIGRATE_PFN_HUGE'
     return mpfn & MIGRATE_PFN_HUGE ? PMD_SIZE : PAGE_SIZE;
                   ^~~~~~~~~~~~~~~~
   In file included from mm/migrate.c:15:0:
   mm/migrate.c: In function 'migrate_vma_collect_hole':
   include/linux/migrate.h:130:31: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_HUGE (1UL << (BITS_PER_LONG_LONG - 3))
                                  ^
>> mm/migrate.c:2102:38: note: in expansion of macro 'MIGRATE_PFN_HUGE'
       migrate->src[migrate->npages++] = MIGRATE_PFN_HUGE;
                                         ^~~~~~~~~~~~~~~~
   mm/migrate.c: In function 'migrate_vma_collect_pmd':
>> include/linux/migrate.h:128:32: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_VALID (1UL << (BITS_PER_LONG_LONG - 1))
                                   ^
>> mm/migrate.c:2168:11: note: in expansion of macro 'MIGRATE_PFN_VALID'
      flags = MIGRATE_PFN_VALID | MIGRATE_PFN_MIGRATE;
              ^~~~~~~~~~~~~~~~~
   include/linux/migrate.h:129:34: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_MIGRATE (1UL << (BITS_PER_LONG_LONG - 2))
                                     ^
>> mm/migrate.c:2168:31: note: in expansion of macro 'MIGRATE_PFN_MIGRATE'
      flags = MIGRATE_PFN_VALID | MIGRATE_PFN_MIGRATE;
                                  ^~~~~~~~~~~~~~~~~~~
   include/linux/migrate.h:132:32: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_WRITE (1UL << (BITS_PER_LONG_LONG - 5))
                                   ^
>> mm/migrate.c:2169:29: note: in expansion of macro 'MIGRATE_PFN_WRITE'
      flags |= pte_write(pte) ? MIGRATE_PFN_WRITE : 0;
                                ^~~~~~~~~~~~~~~~~
   mm/migrate.c: In function 'migrate_vma_prepare':
   include/linux/migrate.h:131:33: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_LOCKED (1UL << (BITS_PER_LONG_LONG - 4))
                                    ^
>> mm/migrate.c:2266:22: note: in expansion of macro 'MIGRATE_PFN_LOCKED'
      migrate->src[i] |= MIGRATE_PFN_LOCKED;
                         ^~~~~~~~~~~~~~~~~~
   mm/migrate.c: In function 'migrate_vma_unmap':
   include/linux/migrate.h:129:34: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_MIGRATE (1UL << (BITS_PER_LONG_LONG - 2))
                                     ^
   mm/migrate.c:2317:36: note: in expansion of macro 'MIGRATE_PFN_MIGRATE'
      if (!page || !(migrate->src[i] & MIGRATE_PFN_MIGRATE))
                                       ^~~~~~~~~~~~~~~~~~~
   include/linux/migrate.h:129:34: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_MIGRATE (1UL << (BITS_PER_LONG_LONG - 2))
                                     ^
   mm/migrate.c:2322:24: note: in expansion of macro 'MIGRATE_PFN_MIGRATE'
       migrate->src[i] &= ~MIGRATE_PFN_MIGRATE;
                           ^~~~~~~~~~~~~~~~~~~
   include/linux/migrate.h:129:34: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_MIGRATE (1UL << (BITS_PER_LONG_LONG - 2))
                                     ^
   mm/migrate.c:2332:35: note: in expansion of macro 'MIGRATE_PFN_MIGRATE'
      if (!page || (migrate->src[i] & MIGRATE_PFN_MIGRATE))
                                      ^~~~~~~~~~~~~~~~~~~
   mm/migrate.c: In function 'migrate_vma_pages':
   include/linux/migrate.h:129:34: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_MIGRATE (1UL << (BITS_PER_LONG_LONG - 2))
                                     ^
   mm/migrate.c:2368:27: note: in expansion of macro 'MIGRATE_PFN_MIGRATE'
      if (!(migrate->src[i] & MIGRATE_PFN_MIGRATE))
                              ^~~~~~~~~~~~~~~~~~~
   include/linux/migrate.h:129:34: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_MIGRATE (1UL << (BITS_PER_LONG_LONG - 2))
                                     ^
   mm/migrate.c:2375:24: note: in expansion of macro 'MIGRATE_PFN_MIGRATE'
       migrate->src[i] &= ~MIGRATE_PFN_MIGRATE;
                           ^~~~~~~~~~~~~~~~~~~
   mm/migrate.c: In function 'migrate_vma_finalize':
   include/linux/migrate.h:129:34: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_MIGRATE (1UL << (BITS_PER_LONG_LONG - 2))
                                     ^
   mm/migrate.c:2402:27: note: in expansion of macro 'MIGRATE_PFN_MIGRATE'
      if (!(migrate->src[i] & MIGRATE_PFN_MIGRATE) || !newpage) {
                              ^~~~~~~~~~~~~~~~~~~

vim +128 include/linux/migrate.h

     1	#ifndef _LINUX_MIGRATE_H
     2	#define _LINUX_MIGRATE_H
     3	
   > 4	#include <linux/mm.h>
     5	#include <linux/mempolicy.h>
     6	#include <linux/migrate_mode.h>
     7	
     8	typedef struct page *new_page_t(struct page *page, unsigned long private,
     9					int **reason);
    10	typedef void free_page_t(struct page *page, unsigned long private);
    11	
    12	/*
    13	 * Return values from addresss_space_operations.migratepage():
    14	 * - negative errno on page migration failure;
    15	 * - zero on page migration success;
    16	 */
    17	#define MIGRATEPAGE_SUCCESS		0
    18	
    19	enum migrate_reason {
    20		MR_COMPACTION,
    21		MR_MEMORY_FAILURE,
    22		MR_MEMORY_HOTPLUG,
    23		MR_SYSCALL,		/* also applies to cpusets */
    24		MR_MEMPOLICY_MBIND,
    25		MR_NUMA_MISPLACED,
    26		MR_CMA,
    27		MR_TYPES
    28	};
    29	
    30	/* In mm/debug.c; also keep sync with include/trace/events/migrate.h */
    31	extern char *migrate_reason_names[MR_TYPES];
    32	
    33	#ifdef CONFIG_MIGRATION
    34	
    35	extern void putback_movable_pages(struct list_head *l);
    36	extern int migrate_page(struct address_space *mapping,
    37				struct page *newpage,
    38				struct page *page,
    39				enum migrate_mode,
    40				bool copy);
    41	extern int migrate_pages(struct list_head *l, new_page_t new, free_page_t free,
    42			unsigned long private, enum migrate_mode mode, int reason);
    43	extern int isolate_movable_page(struct page *page, isolate_mode_t mode);
    44	extern void putback_movable_page(struct page *page);
    45	
    46	extern int migrate_prep(void);
    47	extern int migrate_prep_local(void);
    48	extern void migrate_page_copy(struct page *newpage, struct page *page);
    49	extern int migrate_huge_page_move_mapping(struct address_space *mapping,
    50					  struct page *newpage, struct page *page);
    51	extern int migrate_page_move_mapping(struct address_space *mapping,
    52			struct page *newpage, struct page *page,
    53			struct buffer_head *head, enum migrate_mode mode,
    54			int extra_count);
    55	#else
    56	
    57	static inline void putback_movable_pages(struct list_head *l) {}
    58	static inline int migrate_pages(struct list_head *l, new_page_t new,
    59			free_page_t free, unsigned long private, enum migrate_mode mode,
    60			int reason)
    61		{ return -ENOSYS; }
    62	static inline int isolate_movable_page(struct page *page, isolate_mode_t mode)
    63		{ return -EBUSY; }
    64	
    65	static inline int migrate_prep(void) { return -ENOSYS; }
    66	static inline int migrate_prep_local(void) { return -ENOSYS; }
    67	
    68	static inline void migrate_page_copy(struct page *newpage,
    69					     struct page *page) {}
    70	
    71	static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
    72					  struct page *newpage, struct page *page)
    73	{
    74		return -ENOSYS;
    75	}
    76	
    77	#endif /* CONFIG_MIGRATION */
    78	
    79	#ifdef CONFIG_COMPACTION
    80	extern int PageMovable(struct page *page);
    81	extern void __SetPageMovable(struct page *page, struct address_space *mapping);
    82	extern void __ClearPageMovable(struct page *page);
    83	#else
    84	static inline int PageMovable(struct page *page) { return 0; };
    85	static inline void __SetPageMovable(struct page *page,
    86					struct address_space *mapping)
    87	{
    88	}
    89	static inline void __ClearPageMovable(struct page *page)
    90	{
    91	}
    92	#endif
    93	
    94	#ifdef CONFIG_NUMA_BALANCING
    95	extern bool pmd_trans_migrating(pmd_t pmd);
    96	extern int migrate_misplaced_page(struct page *page,
    97					  struct vm_area_struct *vma, int node);
    98	#else
    99	static inline bool pmd_trans_migrating(pmd_t pmd)
   100	{
   101		return false;
   102	}
   103	static inline int migrate_misplaced_page(struct page *page,
   104						 struct vm_area_struct *vma, int node)
   105	{
   106		return -EAGAIN; /* can't migrate now */
   107	}
   108	#endif /* CONFIG_NUMA_BALANCING */
   109	
   110	#if defined(CONFIG_NUMA_BALANCING) && defined(CONFIG_TRANSPARENT_HUGEPAGE)
   111	extern int migrate_misplaced_transhuge_page(struct mm_struct *mm,
   112				struct vm_area_struct *vma,
   113				pmd_t *pmd, pmd_t entry,
   114				unsigned long address,
   115				struct page *page, int node);
   116	#else
   117	static inline int migrate_misplaced_transhuge_page(struct mm_struct *mm,
   118				struct vm_area_struct *vma,
   119				pmd_t *pmd, pmd_t entry,
   120				unsigned long address,
   121				struct page *page, int node)
   122	{
   123		return -EAGAIN;
   124	}
   125	#endif /* CONFIG_NUMA_BALANCING && CONFIG_TRANSPARENT_HUGEPAGE*/
   126	
   127	
 > 128	#define MIGRATE_PFN_VALID	(1UL << (BITS_PER_LONG_LONG - 1))
   129	#define MIGRATE_PFN_MIGRATE	(1UL << (BITS_PER_LONG_LONG - 2))
   130	#define MIGRATE_PFN_HUGE	(1UL << (BITS_PER_LONG_LONG - 3))
   131	#define MIGRATE_PFN_LOCKED	(1UL << (BITS_PER_LONG_LONG - 4))
   132	#define MIGRATE_PFN_WRITE	(1UL << (BITS_PER_LONG_LONG - 5))
   133	#define MIGRATE_PFN_MASK	((1UL << (BITS_PER_LONG_LONG - PAGE_SHIFT)) - 1)
   134	
   135	static inline struct page *migrate_pfn_to_page(unsigned long mpfn)
   136	{
 > 137		if (!(mpfn & MIGRATE_PFN_VALID))
   138			return NULL;
 > 139		return pfn_to_page(mpfn & MIGRATE_PFN_MASK);
   140	}
   141	
   142	static inline unsigned long migrate_pfn_size(unsigned long mpfn)
   143	{
 > 144		return mpfn & MIGRATE_PFN_HUGE ? PMD_SIZE : PAGE_SIZE;
   145	}
   146	
   147	/*

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux