[rgushchin:kmem_reparent.4 170/380] mm/mprotect.c:152:16: error: 'mm' undeclared

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

 



tree:   https://github.com/rgushchin/linux.git kmem_reparent.4
head:   595d92aaebb6a603b2820ce7188b6db971693d85
commit: c7b45943bdf12b5ccfcd016538c62aa7edd604d5 [170/380] mm/mprotect.c: fix compilation warning because of unused 'mm' varaible
config: i386-randconfig-l0-05140835 (attached as .config)
compiler: gcc-5 (Debian 5.5.0-3) 5.4.1 20171010
reproduce:
        git checkout c7b45943bdf12b5ccfcd016538c62aa7edd604d5
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

Note: the rgushchin/kmem_reparent.4 HEAD 595d92aaebb6a603b2820ce7188b6db971693d85 builds fine.
      It only hurts bisectibility.

All errors (new ones prefixed by >>):

   In file included from include/linux/mm.h:99:0,
                    from mm/mprotect.c:12:
   mm/mprotect.c: In function 'change_pte_range':
   mm/mprotect.c:138:19: error: 'struct vm_area_struct' has no member named 'mm'
        set_pte_at(vma->mm, addr, pte, newpte);
                      ^
   arch/x86/include/asm/pgtable.h:64:59: note: in definition of macro 'set_pte_at'
    #define set_pte_at(mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte)
                                                              ^
>> mm/mprotect.c:152:16: error: 'mm' undeclared (first use in this function)
        set_pte_at(mm, addr, pte, newpte);
                   ^
   arch/x86/include/asm/pgtable.h:64:59: note: in definition of macro 'set_pte_at'
    #define set_pte_at(mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte)
                                                              ^
   mm/mprotect.c:152:16: note: each undeclared identifier is reported only once for each function it appears in
        set_pte_at(mm, addr, pte, newpte);
                   ^
   arch/x86/include/asm/pgtable.h:64:59: note: in definition of macro 'set_pte_at'
    #define set_pte_at(mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte)
                                                              ^

vim +/mm +152 mm/mprotect.c

^1da177e4 Linus Torvalds     2005-04-16  @12  #include <linux/mm.h>
^1da177e4 Linus Torvalds     2005-04-16   13  #include <linux/hugetlb.h>
^1da177e4 Linus Torvalds     2005-04-16   14  #include <linux/shm.h>
^1da177e4 Linus Torvalds     2005-04-16   15  #include <linux/mman.h>
^1da177e4 Linus Torvalds     2005-04-16   16  #include <linux/fs.h>
^1da177e4 Linus Torvalds     2005-04-16   17  #include <linux/highmem.h>
^1da177e4 Linus Torvalds     2005-04-16   18  #include <linux/security.h>
^1da177e4 Linus Torvalds     2005-04-16   19  #include <linux/mempolicy.h>
^1da177e4 Linus Torvalds     2005-04-16   20  #include <linux/personality.h>
^1da177e4 Linus Torvalds     2005-04-16   21  #include <linux/syscalls.h>
0697212a4 Christoph Lameter  2006-06-23   22  #include <linux/swap.h>
0697212a4 Christoph Lameter  2006-06-23   23  #include <linux/swapops.h>
cddb8a5c1 Andrea Arcangeli   2008-07-28   24  #include <linux/mmu_notifier.h>
64cdd548f KOSAKI Motohiro    2009-01-06   25  #include <linux/migrate.h>
cdd6c482c Ingo Molnar        2009-09-21   26  #include <linux/perf_event.h>
e8c24d3a2 Dave Hansen        2016-07-29   27  #include <linux/pkeys.h>
64a9a34e2 Mel Gorman         2014-01-21   28  #include <linux/ksm.h>
7c0f6ba68 Linus Torvalds     2016-12-24   29  #include <linux/uaccess.h>
09a913a7a Mel Gorman         2018-04-10   30  #include <linux/mm_inline.h>
^1da177e4 Linus Torvalds     2005-04-16   31  #include <asm/pgtable.h>
^1da177e4 Linus Torvalds     2005-04-16   32  #include <asm/cacheflush.h>
e8c24d3a2 Dave Hansen        2016-07-29   33  #include <asm/mmu_context.h>
^1da177e4 Linus Torvalds     2005-04-16   34  #include <asm/tlbflush.h>
^1da177e4 Linus Torvalds     2005-04-16   35  
36f881883 Kirill A. Shutemov 2015-06-24   36  #include "internal.h"
36f881883 Kirill A. Shutemov 2015-06-24   37  
4b10e7d56 Mel Gorman         2012-10-25   38  static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
c1e6098b2 Peter Zijlstra     2006-09-25   39  		unsigned long addr, unsigned long end, pgprot_t newprot,
0f19c1792 Mel Gorman         2013-10-07   40  		int dirty_accountable, int prot_numa)
^1da177e4 Linus Torvalds     2005-04-16   41  {
0697212a4 Christoph Lameter  2006-06-23   42  	pte_t *pte, oldpte;
705e87c0c Hugh Dickins       2005-10-29   43  	spinlock_t *ptl;
7da4d641c Peter Zijlstra     2012-11-19   44  	unsigned long pages = 0;
3e3215876 Andi Kleen         2016-12-12   45  	int target_node = NUMA_NO_NODE;
^1da177e4 Linus Torvalds     2005-04-16   46  
175ad4f1e Andrea Arcangeli   2017-02-22   47  	/*
175ad4f1e Andrea Arcangeli   2017-02-22   48  	 * Can be called with only the mmap_sem for reading by
175ad4f1e Andrea Arcangeli   2017-02-22   49  	 * prot_numa so we must check the pmd isn't constantly
175ad4f1e Andrea Arcangeli   2017-02-22   50  	 * changing from under us from pmd_none to pmd_trans_huge
175ad4f1e Andrea Arcangeli   2017-02-22   51  	 * and/or the other way around.
175ad4f1e Andrea Arcangeli   2017-02-22   52  	 */
175ad4f1e Andrea Arcangeli   2017-02-22   53  	if (pmd_trans_unstable(pmd))
175ad4f1e Andrea Arcangeli   2017-02-22   54  		return 0;
175ad4f1e Andrea Arcangeli   2017-02-22   55  
175ad4f1e Andrea Arcangeli   2017-02-22   56  	/*
175ad4f1e Andrea Arcangeli   2017-02-22   57  	 * The pmd points to a regular pte so the pmd can't change
175ad4f1e Andrea Arcangeli   2017-02-22   58  	 * from under us even if the mmap_sem is only hold for
175ad4f1e Andrea Arcangeli   2017-02-22   59  	 * reading.
175ad4f1e Andrea Arcangeli   2017-02-22   60  	 */
175ad4f1e Andrea Arcangeli   2017-02-22   61  	pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
1ad9f620c Mel Gorman         2014-04-07   62  
3e3215876 Andi Kleen         2016-12-12   63  	/* Get target node for single threaded private VMAs */
3e3215876 Andi Kleen         2016-12-12   64  	if (prot_numa && !(vma->vm_flags & VM_SHARED) &&
3e3215876 Andi Kleen         2016-12-12   65  	    atomic_read(&vma->vm_mm->mm_users) == 1)
3e3215876 Andi Kleen         2016-12-12   66  		target_node = numa_node_id();
3e3215876 Andi Kleen         2016-12-12   67  
3ea277194 Mel Gorman         2017-08-02   68  	flush_tlb_batched_pending(vma->vm_mm);
6606c3e0d Zachary Amsden     2006-09-30   69  	arch_enter_lazy_mmu_mode();
^1da177e4 Linus Torvalds     2005-04-16   70  	do {
0697212a4 Christoph Lameter  2006-06-23   71  		oldpte = *pte;
0697212a4 Christoph Lameter  2006-06-23   72  		if (pte_present(oldpte)) {
^1da177e4 Linus Torvalds     2005-04-16   73  			pte_t ptent;
b191f9b10 Mel Gorman         2015-03-25   74  			bool preserve_write = prot_numa && pte_write(oldpte);
^1da177e4 Linus Torvalds     2005-04-16   75  
e944fd67b Mel Gorman         2015-02-12   76  			/*
e944fd67b Mel Gorman         2015-02-12   77  			 * Avoid trapping faults against the zero or KSM
e944fd67b Mel Gorman         2015-02-12   78  			 * pages. See similar comment in change_huge_pmd.
e944fd67b Mel Gorman         2015-02-12   79  			 */
e944fd67b Mel Gorman         2015-02-12   80  			if (prot_numa) {
e944fd67b Mel Gorman         2015-02-12   81  				struct page *page;
e944fd67b Mel Gorman         2015-02-12   82  
e944fd67b Mel Gorman         2015-02-12   83  				page = vm_normal_page(vma, addr, oldpte);
e944fd67b Mel Gorman         2015-02-12   84  				if (!page || PageKsm(page))
e944fd67b Mel Gorman         2015-02-12   85  					continue;
10c1045f2 Mel Gorman         2015-02-12   86  
859d4adc3 Henry Willard      2018-01-31   87  				/* Also skip shared copy-on-write pages */
859d4adc3 Henry Willard      2018-01-31   88  				if (is_cow_mapping(vma->vm_flags) &&
859d4adc3 Henry Willard      2018-01-31   89  				    page_mapcount(page) != 1)
859d4adc3 Henry Willard      2018-01-31   90  					continue;
859d4adc3 Henry Willard      2018-01-31   91  
09a913a7a Mel Gorman         2018-04-10   92  				/*
09a913a7a Mel Gorman         2018-04-10   93  				 * While migration can move some dirty pages,
09a913a7a Mel Gorman         2018-04-10   94  				 * it cannot move them all from MIGRATE_ASYNC
09a913a7a Mel Gorman         2018-04-10   95  				 * context.
09a913a7a Mel Gorman         2018-04-10   96  				 */
09a913a7a Mel Gorman         2018-04-10   97  				if (page_is_file_cache(page) && PageDirty(page))
09a913a7a Mel Gorman         2018-04-10   98  					continue;
09a913a7a Mel Gorman         2018-04-10   99  
10c1045f2 Mel Gorman         2015-02-12  100  				/* Avoid TLB flush if possible */
10c1045f2 Mel Gorman         2015-02-12  101  				if (pte_protnone(oldpte))
10c1045f2 Mel Gorman         2015-02-12  102  					continue;
3e3215876 Andi Kleen         2016-12-12  103  
3e3215876 Andi Kleen         2016-12-12  104  				/*
3e3215876 Andi Kleen         2016-12-12  105  				 * Don't mess with PTEs if page is already on the node
3e3215876 Andi Kleen         2016-12-12  106  				 * a single-threaded process is running on.
3e3215876 Andi Kleen         2016-12-12  107  				 */
3e3215876 Andi Kleen         2016-12-12  108  				if (target_node == page_to_nid(page))
3e3215876 Andi Kleen         2016-12-12  109  					continue;
e944fd67b Mel Gorman         2015-02-12  110  			}
e944fd67b Mel Gorman         2015-02-12  111  
04a864530 Aneesh Kumar K.V   2019-03-05  112  			oldpte = ptep_modify_prot_start(vma, addr, pte);
04a864530 Aneesh Kumar K.V   2019-03-05  113  			ptent = pte_modify(oldpte, newprot);
b191f9b10 Mel Gorman         2015-03-25  114  			if (preserve_write)
288bc5494 Aneesh Kumar K.V   2017-02-24  115  				ptent = pte_mk_savedwrite(ptent);
8a0516ed8 Mel Gorman         2015-02-12  116  
8a0516ed8 Mel Gorman         2015-02-12  117  			/* Avoid taking write faults for known dirty pages */
64e455079 Peter Feiner       2014-10-13  118  			if (dirty_accountable && pte_dirty(ptent) &&
64e455079 Peter Feiner       2014-10-13  119  					(pte_soft_dirty(ptent) ||
8a0516ed8 Mel Gorman         2015-02-12  120  					 !(vma->vm_flags & VM_SOFTDIRTY))) {
9d85d5863 Aneesh Kumar K.V   2014-02-12  121  				ptent = pte_mkwrite(ptent);
4b10e7d56 Mel Gorman         2012-10-25  122  			}
04a864530 Aneesh Kumar K.V   2019-03-05  123  			ptep_modify_prot_commit(vma, addr, pte, oldpte, ptent);
7da4d641c Peter Zijlstra     2012-11-19  124  			pages++;
0661a3361 Kirill A. Shutemov 2015-02-10  125  		} else if (IS_ENABLED(CONFIG_MIGRATION)) {
0697212a4 Christoph Lameter  2006-06-23  126  			swp_entry_t entry = pte_to_swp_entry(oldpte);
0697212a4 Christoph Lameter  2006-06-23  127  
0697212a4 Christoph Lameter  2006-06-23  128  			if (is_write_migration_entry(entry)) {
c3d16e165 Cyrill Gorcunov    2013-10-16  129  				pte_t newpte;
0697212a4 Christoph Lameter  2006-06-23  130  				/*
0697212a4 Christoph Lameter  2006-06-23  131  				 * A protection check is difficult so
0697212a4 Christoph Lameter  2006-06-23  132  				 * just be safe and disable write
0697212a4 Christoph Lameter  2006-06-23  133  				 */
0697212a4 Christoph Lameter  2006-06-23  134  				make_migration_entry_read(&entry);
c3d16e165 Cyrill Gorcunov    2013-10-16  135  				newpte = swp_entry_to_pte(entry);
c3d16e165 Cyrill Gorcunov    2013-10-16  136  				if (pte_swp_soft_dirty(oldpte))
c3d16e165 Cyrill Gorcunov    2013-10-16  137  					newpte = pte_swp_mksoft_dirty(newpte);
c7b45943b Mike Rapoport      2019-05-12  138  				set_pte_at(vma->mm, addr, pte, newpte);
e920e14ca Mel Gorman         2013-10-07  139  
7da4d641c Peter Zijlstra     2012-11-19  140  				pages++;
^1da177e4 Linus Torvalds     2005-04-16  141  			}
5042db43c Jérôme Glisse      2017-09-08  142  
5042db43c Jérôme Glisse      2017-09-08  143  			if (is_write_device_private_entry(entry)) {
5042db43c Jérôme Glisse      2017-09-08  144  				pte_t newpte;
5042db43c Jérôme Glisse      2017-09-08  145  
5042db43c Jérôme Glisse      2017-09-08  146  				/*
5042db43c Jérôme Glisse      2017-09-08  147  				 * We do not preserve soft-dirtiness. See
5042db43c Jérôme Glisse      2017-09-08  148  				 * copy_one_pte() for explanation.
5042db43c Jérôme Glisse      2017-09-08  149  				 */
5042db43c Jérôme Glisse      2017-09-08  150  				make_device_private_entry_read(&entry);
5042db43c Jérôme Glisse      2017-09-08  151  				newpte = swp_entry_to_pte(entry);
5042db43c Jérôme Glisse      2017-09-08 @152  				set_pte_at(mm, addr, pte, newpte);
5042db43c Jérôme Glisse      2017-09-08  153  
5042db43c Jérôme Glisse      2017-09-08  154  				pages++;
5042db43c Jérôme Glisse      2017-09-08  155  			}
e920e14ca Mel Gorman         2013-10-07  156  		}
^1da177e4 Linus Torvalds     2005-04-16  157  	} while (pte++, addr += PAGE_SIZE, addr != end);
6606c3e0d Zachary Amsden     2006-09-30  158  	arch_leave_lazy_mmu_mode();
705e87c0c Hugh Dickins       2005-10-29  159  	pte_unmap_unlock(pte - 1, ptl);
7da4d641c Peter Zijlstra     2012-11-19  160  
7da4d641c Peter Zijlstra     2012-11-19  161  	return pages;
^1da177e4 Linus Torvalds     2005-04-16  162  }
^1da177e4 Linus Torvalds     2005-04-16  163  

:::::: The code at line 152 was first introduced by commit
:::::: 5042db43cc26f51eed51c56192e2c2317e44315f mm/ZONE_DEVICE: new type of ZONE_DEVICE for unaddressable memory

:::::: TO: Jérôme Glisse <jglisse@xxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

---
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