Re: [PATCH 1/1] mm: thp: fix SMP race condition between THP page fault

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

 



Hi Andrea,

[auto build test WARNING on v4.5-rc5]
[also build test WARNING on next-20160223]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Andrea-Arcangeli/mm-thp-fix-SMP-race-condition-between-THP-page-fault/20160224-020835
config: x86_64-randconfig-x012-201608 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/smp.h:10,
                    from include/linux/kernel_stat.h:4,
                    from mm/memory.c:41:
   mm/memory.c: In function '__handle_mm_fault':
   mm/memory.c:3419:34: error: incompatible type for argument 1 of 'pmd_trans_unstable'
     if (unlikely(pmd_trans_unstable(*pmd) || pmd_devmap(*pmd)))
                                     ^
   include/linux/compiler.h:137:45: note: in definition of macro 'unlikely'
    #  define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
                                                ^
   In file included from arch/x86/include/asm/pgtable.h:914:0,
                    from include/linux/mm.h:67,
                    from mm/memory.c:42:
   include/asm-generic/pgtable.h:731:19: note: expected 'pmd_t * {aka struct <anonymous> *}' but argument is of type 'pmd_t {aka struct <anonymous>}'
    static inline int pmd_trans_unstable(pmd_t *pmd)
                      ^
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/smp.h:10,
                    from include/linux/kernel_stat.h:4,
                    from mm/memory.c:41:
   mm/memory.c:3419:34: error: incompatible type for argument 1 of 'pmd_trans_unstable'
     if (unlikely(pmd_trans_unstable(*pmd) || pmd_devmap(*pmd)))
                                     ^
   include/linux/compiler.h:137:53: note: in definition of macro 'unlikely'
    #  define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
                                                        ^
   In file included from arch/x86/include/asm/pgtable.h:914:0,
                    from include/linux/mm.h:67,
                    from mm/memory.c:42:
   include/asm-generic/pgtable.h:731:19: note: expected 'pmd_t * {aka struct <anonymous> *}' but argument is of type 'pmd_t {aka struct <anonymous>}'
    static inline int pmd_trans_unstable(pmd_t *pmd)
                      ^
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/smp.h:10,
                    from include/linux/kernel_stat.h:4,
                    from mm/memory.c:41:
   mm/memory.c:3419:34: error: incompatible type for argument 1 of 'pmd_trans_unstable'
     if (unlikely(pmd_trans_unstable(*pmd) || pmd_devmap(*pmd)))
                                     ^
   include/linux/compiler.h:110:47: note: in definition of macro 'likely_notrace'
    #define likely_notrace(x) __builtin_expect(!!(x), 1)
                                                  ^
   include/linux/compiler.h:137:58: note: in expansion of macro '__branch_check__'
    #  define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
                                                             ^
>> mm/memory.c:3419:6: note: in expansion of macro 'unlikely'
     if (unlikely(pmd_trans_unstable(*pmd) || pmd_devmap(*pmd)))
         ^
   In file included from arch/x86/include/asm/pgtable.h:914:0,
                    from include/linux/mm.h:67,
                    from mm/memory.c:42:
   include/asm-generic/pgtable.h:731:19: note: expected 'pmd_t * {aka struct <anonymous> *}' but argument is of type 'pmd_t {aka struct <anonymous>}'
    static inline int pmd_trans_unstable(pmd_t *pmd)
                      ^

vim +/unlikely +3419 mm/memory.c

  3403		 */
  3404		if (unlikely(pmd_none(*pmd)) &&
  3405		    unlikely(__pte_alloc(mm, vma, pmd, address)))
  3406			return VM_FAULT_OOM;
  3407		/*
  3408		 * If an huge pmd materialized from under us just retry later.
  3409		 * Use pmd_trans_unstable() instead of pmd_trans_huge() to
  3410		 * ensure the pmd didn't become pmd_trans_huge from under us
  3411		 * and then immediately back to pmd_none as result of
  3412		 * MADV_DONTNEED running immediately after a huge_pmd fault of
  3413		 * a different thread of this mm, in turn leading to a false
  3414		 * negative pmd_trans_huge() retval. All we have to ensure is
  3415		 * that it is a regular pmd that we can walk with
  3416		 * pte_offset_map() and we can do that through an atomic read
  3417		 * in C, which is what pmd_trans_unstable() is provided for.
  3418		 */
> 3419		if (unlikely(pmd_trans_unstable(*pmd) || pmd_devmap(*pmd)))
  3420			return 0;
  3421		/*
  3422		 * A regular pmd is established and it can't morph into a huge pmd
  3423		 * from under us anymore at this point because we hold the mmap_sem
  3424		 * read mode and khugepaged takes it in write mode. So now it's
  3425		 * safe to run pte_offset_map().
  3426		 */
  3427		pte = pte_offset_map(pmd, address);

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

Attachment: .config.gz
Description: Binary data


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