[linux-next:master 11895/11991] fs/proc/task_mmu.c:933:3: error: implicit declaration of function 'test_and_clear_page_young'

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   66c198deda3725c57939c6cdaf2c9f5375cd79ad
commit: 38c4fffbad3cbfc55e9e69d5e304c82baced199a [11895/11991] mm: check the return value of lookup_page_ext for all call sites
config: i386-randconfig-x0-05251403 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
        git checkout 38c4fffbad3cbfc55e9e69d5e304c82baced199a
        # save the attached .config to linux build tree
        make ARCH=i386 

Note: the linux-next/master HEAD 66c198deda3725c57939c6cdaf2c9f5375cd79ad builds fine.
      It may have been fixed somewhere.

All error/warnings (new ones prefixed by >>):

                       ^~~~~~~~~~~~~
   In file included from fs/proc/task_mmu.c:22:0:
   fs/proc/internal.h:69:15: error: field 'vfs_inode' has incomplete type
     struct inode vfs_inode;
                  ^~~~~~~~~
   fs/proc/internal.h:75:34: error: invalid storage class for function 'PROC_I'
    static inline struct proc_inode *PROC_I(const struct inode *inode)
                                     ^~~~~~
   In file included from include/asm-generic/bug.h:13:0,
                    from arch/x86/include/asm/bug.h:35,
                    from include/linux/bug.h:4,
                    from include/linux/mmdebug.h:4,
                    from include/linux/mm.h:8,
                    from fs/proc/task_mmu.c:1:
   fs/proc/internal.h: In function 'PROC_I':
   include/linux/kernel.h:831:48: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     const typeof( ((type *)0)->member ) *__mptr = (ptr); \
                                                   ^
   fs/proc/internal.h:77:9: note: in expansion of macro 'container_of'
     return container_of(inode, struct proc_inode, vfs_inode);
            ^~~~~~~~~~~~
   In file included from fs/proc/task_mmu.c:22:0:
   fs/proc/internal.h: In function 'page_is_young':
   fs/proc/internal.h:80:38: error: invalid storage class for function 'PDE'
    static inline struct proc_dir_entry *PDE(const struct inode *inode)
                                         ^~~
   fs/proc/internal.h:85:21: error: invalid storage class for function '__PDE_DATA'
    static inline void *__PDE_DATA(const struct inode *inode)
                        ^~~~~~~~~~
   fs/proc/internal.h:90:27: error: invalid storage class for function 'proc_pid'
    static inline struct pid *proc_pid(struct inode *inode)
                              ^~~~~~~~
   fs/proc/internal.h:95:35: error: invalid storage class for function 'get_proc_task'
    static inline struct task_struct *get_proc_task(struct inode *inode)
                                      ^~~~~~~~~~~~~
   fs/proc/internal.h: In function 'get_proc_task':
   fs/proc/internal.h:97:9: error: return from incompatible pointer type [-Werror=incompatible-pointer-types]
     return get_pid_task(proc_pid(inode), PIDTYPE_PID);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/proc/internal.h: In function 'page_is_young':
   fs/proc/internal.h:100:19: error: invalid storage class for function 'task_dumpable'
    static inline int task_dumpable(struct task_struct *task)
                      ^~~~~~~~~~~~~
   fs/proc/internal.h: In function 'task_dumpable':
   fs/proc/internal.h:105:12: error: passing argument 1 of 'task_lock' from incompatible pointer type [-Werror=incompatible-pointer-types]
     task_lock(task);
               ^~~~
   In file included from include/linux/vmacache.h:4:0,
                    from fs/proc/task_mmu.c:2:
   include/linux/sched.h:2914:20: note: expected 'struct task_struct *' but argument is of type 'struct task_struct *'
    static inline void task_lock(struct task_struct *p)
                       ^~~~~~~~~
   In file included from fs/proc/task_mmu.c:22:0:
   fs/proc/internal.h:106:11: error: dereferencing pointer to incomplete type 'struct task_struct'
     mm = task->mm;
              ^~
   fs/proc/internal.h:109:14: error: passing argument 1 of 'task_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
     task_unlock(task);
                 ^~~~
   In file included from include/linux/vmacache.h:4:0,
                    from fs/proc/task_mmu.c:2:
   include/linux/sched.h:2919:20: note: expected 'struct task_struct *' but argument is of type 'struct task_struct *'
    static inline void task_unlock(struct task_struct *p)
                       ^~~~~~~~~~~
   In file included from fs/proc/task_mmu.c:22:0:
   fs/proc/internal.h: In function 'page_is_young':
   fs/proc/internal.h:115:24: error: invalid storage class for function 'name_to_int'
    static inline unsigned name_to_int(const struct qstr *qstr)
                           ^~~~~~~~~~~
   fs/proc/internal.h:187:38: error: invalid storage class for function 'pde_get'
    static inline struct proc_dir_entry *pde_get(struct proc_dir_entry *pde)
                                         ^~~~~~~
   fs/proc/internal.h:194:20: error: invalid storage class for function 'is_empty_pde'
    static inline bool is_empty_pde(const struct proc_dir_entry *pde)
                       ^~~~~~~~~~~~
   fs/proc/task_mmu.c:24:6: error: static declaration of 'task_mem' follows non-static declaration
    void task_mem(struct seq_file *m, struct mm_struct *mm)
         ^~~~~~~~
   In file included from fs/proc/task_mmu.c:22:0:
   fs/proc/internal.h:305:13: note: previous declaration of 'task_mem' was here
    extern void task_mem(struct seq_file *, struct mm_struct *);
                ^~~~~~~~
   fs/proc/task_mmu.c:86:15: error: static declaration of 'task_vsize' follows non-static declaration
    unsigned long task_vsize(struct mm_struct *mm)
                  ^~~~~~~~~~
   In file included from fs/proc/task_mmu.c:22:0:
   fs/proc/internal.h:301:22: note: previous declaration of 'task_vsize' was here
    extern unsigned long task_vsize(struct mm_struct *);
                         ^~~~~~~~~~
   fs/proc/task_mmu.c:91:15: error: static declaration of 'task_statm' follows non-static declaration
    unsigned long task_statm(struct mm_struct *mm,
                  ^~~~~~~~~~
   In file included from fs/proc/task_mmu.c:22:0:
   fs/proc/internal.h:302:22: note: previous declaration of 'task_statm' was here
    extern unsigned long task_statm(struct mm_struct *,
                         ^~~~~~~~~~
   fs/proc/task_mmu.c:108:13: error: invalid storage class for function 'hold_task_mempolicy'
    static void hold_task_mempolicy(struct proc_maps_private *priv)
                ^~~~~~~~~~~~~~~~~~~
   fs/proc/task_mmu.c: In function 'hold_task_mempolicy':
>> fs/proc/task_mmu.c:112:12: error: passing argument 1 of 'task_lock' from incompatible pointer type [-Werror=incompatible-pointer-types]
     task_lock(task);
               ^~~~
   In file included from include/linux/vmacache.h:4:0,
                    from fs/proc/task_mmu.c:2:
   include/linux/sched.h:2914:20: note: expected 'struct task_struct *' but argument is of type 'struct task_struct *'
    static inline void task_lock(struct task_struct *p)
                       ^~~~~~~~~
>> fs/proc/task_mmu.c:113:41: error: passing argument 1 of 'get_task_policy' from incompatible pointer type [-Werror=incompatible-pointer-types]
     priv->task_mempolicy = get_task_policy(task);
                                            ^~~~
   In file included from include/linux/hugetlb.h:19:0,
                    from fs/proc/task_mmu.c:3:
   include/linux/mempolicy.h:137:19: note: expected 'struct task_struct *' but argument is of type 'struct task_struct *'
    struct mempolicy *get_task_policy(struct task_struct *p);
                      ^~~~~~~~~~~~~~~
   fs/proc/task_mmu.c:113:23: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
     priv->task_mempolicy = get_task_policy(task);
                          ^
>> fs/proc/task_mmu.c:114:11: error: passing argument 1 of 'mpol_get' from incompatible pointer type [-Werror=incompatible-pointer-types]
     mpol_get(priv->task_mempolicy);
              ^~~~
   In file included from include/linux/hugetlb.h:19:0,
                    from fs/proc/task_mmu.c:3:
   include/linux/mempolicy.h:95:20: note: expected 'struct mempolicy *' but argument is of type 'struct mempolicy *'
    static inline void mpol_get(struct mempolicy *pol)
                       ^~~~~~~~
>> fs/proc/task_mmu.c:115:14: error: passing argument 1 of 'task_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
     task_unlock(task);
                 ^~~~
   In file included from include/linux/vmacache.h:4:0,
                    from fs/proc/task_mmu.c:2:
   include/linux/sched.h:2919:20: note: expected 'struct task_struct *' but argument is of type 'struct task_struct *'
    static inline void task_unlock(struct task_struct *p)
                       ^~~~~~~~~~~
   fs/proc/task_mmu.c: In function 'page_is_young':
   fs/proc/task_mmu.c:117:13: error: invalid storage class for function 'release_task_mempolicy'
    static void release_task_mempolicy(struct proc_maps_private *priv)
                ^~~~~~~~~~~~~~~~~~~~~~
   fs/proc/task_mmu.c: In function 'release_task_mempolicy':
>> fs/proc/task_mmu.c:119:11: error: passing argument 1 of 'mpol_put' from incompatible pointer type [-Werror=incompatible-pointer-types]
     mpol_put(priv->task_mempolicy);
              ^~~~
   In file included from include/linux/hugetlb.h:19:0,
                    from fs/proc/task_mmu.c:3:
   include/linux/mempolicy.h:64:20: note: expected 'struct mempolicy *' but argument is of type 'struct mempolicy *'
    static inline void mpol_put(struct mempolicy *pol)
                       ^~~~~~~~
   fs/proc/task_mmu.c: In function 'page_is_young':
   fs/proc/task_mmu.c:130:13: error: invalid storage class for function 'vma_stop'
    static void vma_stop(struct proc_maps_private *priv)
                ^~~~~~~~
   fs/proc/task_mmu.c:140:1: error: invalid storage class for function 'm_next_vma'
    m_next_vma(struct proc_maps_private *priv, struct vm_area_struct *vma)
    ^~~~~~~~~~
   fs/proc/task_mmu.c:147:13: error: invalid storage class for function 'm_cache_vma'
    static void m_cache_vma(struct seq_file *m, struct vm_area_struct *vma)
                ^~~~~~~~~~~
   fs/proc/task_mmu.c:153:14: error: invalid storage class for function 'm_start'
    static void *m_start(struct seq_file *m, loff_t *ppos)
                 ^~~~~~~
   fs/proc/task_mmu.c:200:14: error: invalid storage class for function 'm_next'
    static void *m_next(struct seq_file *m, void *v, loff_t *pos)
                 ^~~~~~
   fs/proc/task_mmu.c:212:13: error: invalid storage class for function 'm_stop'
    static void m_stop(struct seq_file *m, void *v)
                ^~~~~~
   fs/proc/task_mmu.c: In function 'm_stop':
   fs/proc/task_mmu.c:219:19: error: passing argument 1 of 'put_task_struct' from incompatible pointer type [-Werror=incompatible-pointer-types]
      put_task_struct(priv->task);
                      ^~~~
   In file included from include/linux/vmacache.h:4:0,
                    from fs/proc/task_mmu.c:2:
   include/linux/sched.h:2137:20: note: expected 'struct task_struct *' but argument is of type 'struct task_struct *'
    static inline void put_task_struct(struct task_struct *t)
                       ^~~~~~~~~~~~~~~
   fs/proc/task_mmu.c: In function 'page_is_young':
   fs/proc/task_mmu.c:224:12: error: invalid storage class for function 'proc_maps_open'
    static int proc_maps_open(struct inode *inode, struct file *file,
               ^~~~~~~~~~~~~~
   fs/proc/task_mmu.c: In function 'proc_maps_open':
   fs/proc/task_mmu.c:237:23: error: passing argument 1 of 'seq_release_private' from incompatible pointer type [-Werror=incompatible-pointer-types]
      seq_release_private(inode, file);
                          ^~~~~
   In file included from include/linux/cgroup.h:17:0,
                    from include/linux/hugetlb.h:8,
                    from fs/proc/task_mmu.c:3:
   include/linux/seq_file.h:140:5: note: expected 'struct inode *' but argument is of type 'struct inode *'
    int seq_release_private(struct inode *, struct file *);
        ^~~~~~~~~~~~~~~~~~~
   fs/proc/task_mmu.c: In function 'page_is_young':
   fs/proc/task_mmu.c:244:12: error: invalid storage class for function 'proc_map_release'
    static int proc_map_release(struct inode *inode, struct file *file)
               ^~~~~~~~~~~~~~~~
   fs/proc/task_mmu.c: In function 'proc_map_release':
   fs/proc/task_mmu.c:252:29: error: passing argument 1 of 'seq_release_private' from incompatible pointer type [-Werror=incompatible-pointer-types]
     return seq_release_private(inode, file);
                                ^~~~~
   In file included from include/linux/cgroup.h:17:0,
                    from include/linux/hugetlb.h:8,
                    from fs/proc/task_mmu.c:3:
   include/linux/seq_file.h:140:5: note: expected 'struct inode *' but argument is of type 'struct inode *'
    int seq_release_private(struct inode *, struct file *);
        ^~~~~~~~~~~~~~~~~~~
   fs/proc/task_mmu.c: In function 'page_is_young':
   fs/proc/task_mmu.c:255:12: error: invalid storage class for function 'do_maps_open'
    static int do_maps_open(struct inode *inode, struct file *file,
               ^~~~~~~~~~~~
   fs/proc/task_mmu.c:266:12: error: invalid storage class for function 'is_stack'
    static int is_stack(struct proc_maps_private *priv,
               ^~~~~~~~
   fs/proc/task_mmu.c: In function 'is_stack':
   fs/proc/task_mmu.c:279:8: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
      task = pid_task(proc_pid(inode), PIDTYPE_PID);
           ^
   fs/proc/task_mmu.c:281:39: error: passing argument 2 of 'vma_is_stack_for_task' from incompatible pointer type [-Werror=incompatible-pointer-types]
       stack = vma_is_stack_for_task(vma, task);
                                          ^~~~
   In file included from fs/proc/task_mmu.c:1:0:
   include/linux/mm.h:1367:5: note: expected 'struct task_struct *' but argument is of type 'struct task_struct *'
    int vma_is_stack_for_task(struct vm_area_struct *vma, struct task_struct *t);
        ^~~~~~~~~~~~~~~~~~~~~
   fs/proc/task_mmu.c: In function 'page_is_young':
   fs/proc/task_mmu.c:288:1: error: invalid storage class for function 'show_map_vma'
    show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
    ^~~~~~~~~~~~
   fs/proc/task_mmu.c: In function 'show_map_vma':
   fs/proc/task_mmu.c:301:25: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
      struct inode *inode = file_inode(vma->vm_file);
                            ^~~~~~~~~~
   fs/proc/task_mmu.c:302:14: error: dereferencing pointer to incomplete type 'struct inode'
      dev = inode->i_sb->s_dev;
                 ^~
   fs/proc/task_mmu.c: In function 'page_is_young':
   fs/proc/task_mmu.c:367:12: error: invalid storage class for function 'show_map'
    static int show_map(struct seq_file *m, void *v, int is_pid)
               ^~~~~~~~
   fs/proc/task_mmu.c:374:12: error: invalid storage class for function 'show_pid_map'
    static int show_pid_map(struct seq_file *m, void *v)
               ^~~~~~~~~~~~
   fs/proc/task_mmu.c:379:12: error: invalid storage class for function 'show_tid_map'
--
   fs/proc/task_mmu.c:393:10: error: initializer element is not constant
     .next = m_next,
             ^~~~~~
   fs/proc/task_mmu.c:393:10: note: (near initialization for 'proc_tid_maps_op.next')
   fs/proc/task_mmu.c:394:10: error: initializer element is not constant
     .stop = m_stop,
             ^~~~~~
   fs/proc/task_mmu.c:394:10: note: (near initialization for 'proc_tid_maps_op.stop')
   fs/proc/task_mmu.c:395:10: error: initializer element is not constant
     .show = show_tid_map
             ^~~~~~~~~~~~
   fs/proc/task_mmu.c:395:10: note: (near initialization for 'proc_tid_maps_op.show')
   fs/proc/task_mmu.c:398:12: error: invalid storage class for function 'pid_maps_open'
    static int pid_maps_open(struct inode *inode, struct file *file)
               ^~~~~~~~~~~~~
   fs/proc/task_mmu.c:403:12: error: invalid storage class for function 'tid_maps_open'
    static int tid_maps_open(struct inode *inode, struct file *file)
               ^~~~~~~~~~~~~
   fs/proc/task_mmu.c:408:14: error: variable 'proc_pid_maps_operations' has initializer but incomplete type
    const struct file_operations proc_pid_maps_operations = {
                 ^~~~~~~~~~~~~~~
   fs/proc/task_mmu.c:408:30: error: declaration of 'proc_pid_maps_operations' with no linkage follows extern declaration
    const struct file_operations proc_pid_maps_operations = {
                                 ^~~~~~~~~~~~~~~~~~~~~~~~
   In file included from fs/proc/task_mmu.c:22:0:
   fs/proc/internal.h:292:37: note: previous declaration of 'proc_pid_maps_operations' was here
    extern const struct file_operations proc_pid_maps_operations;
                                        ^~~~~~~~~~~~~~~~~~~~~~~~
   fs/proc/task_mmu.c:409:2: error: unknown field 'open' specified in initializer
     .open  = pid_maps_open,
     ^
   fs/proc/task_mmu.c:409:11: warning: excess elements in struct initializer
     .open  = pid_maps_open,
              ^~~~~~~~~~~~~
   fs/proc/task_mmu.c:409:11: note: (near initialization for 'proc_pid_maps_operations')
   fs/proc/task_mmu.c:410:2: error: unknown field 'read' specified in initializer
     .read  = seq_read,
     ^
   fs/proc/task_mmu.c:410:11: warning: excess elements in struct initializer
     .read  = seq_read,
              ^~~~~~~~
   fs/proc/task_mmu.c:410:11: note: (near initialization for 'proc_pid_maps_operations')
   fs/proc/task_mmu.c:411:2: error: unknown field 'llseek' specified in initializer
     .llseek  = seq_lseek,
     ^
   fs/proc/task_mmu.c:411:13: warning: excess elements in struct initializer
     .llseek  = seq_lseek,
                ^~~~~~~~~
   fs/proc/task_mmu.c:411:13: note: (near initialization for 'proc_pid_maps_operations')
   fs/proc/task_mmu.c:412:2: error: unknown field 'release' specified in initializer
     .release = proc_map_release,
     ^
   fs/proc/task_mmu.c:412:13: warning: excess elements in struct initializer
     .release = proc_map_release,
                ^~~~~~~~~~~~~~~~
   fs/proc/task_mmu.c:412:13: note: (near initialization for 'proc_pid_maps_operations')
   fs/proc/task_mmu.c:408:30: error: storage size of 'proc_pid_maps_operations' isn't known
    const struct file_operations proc_pid_maps_operations = {
                                 ^~~~~~~~~~~~~~~~~~~~~~~~
   fs/proc/task_mmu.c:415:14: error: variable 'proc_tid_maps_operations' has initializer but incomplete type
    const struct file_operations proc_tid_maps_operations = {
                 ^~~~~~~~~~~~~~~
   fs/proc/task_mmu.c:415:30: error: declaration of 'proc_tid_maps_operations' with no linkage follows extern declaration
    const struct file_operations proc_tid_maps_operations = {
                                 ^~~~~~~~~~~~~~~~~~~~~~~~
   In file included from fs/proc/task_mmu.c:22:0:
   fs/proc/internal.h:293:37: note: previous declaration of 'proc_tid_maps_operations' was here
    extern const struct file_operations proc_tid_maps_operations;
                                        ^~~~~~~~~~~~~~~~~~~~~~~~
   fs/proc/task_mmu.c:416:2: error: unknown field 'open' specified in initializer
     .open  = tid_maps_open,
     ^
   fs/proc/task_mmu.c:416:11: warning: excess elements in struct initializer
     .open  = tid_maps_open,
              ^~~~~~~~~~~~~
   fs/proc/task_mmu.c:416:11: note: (near initialization for 'proc_tid_maps_operations')
   fs/proc/task_mmu.c:417:2: error: unknown field 'read' specified in initializer
     .read  = seq_read,
     ^
   fs/proc/task_mmu.c:417:11: warning: excess elements in struct initializer
     .read  = seq_read,
              ^~~~~~~~
   fs/proc/task_mmu.c:417:11: note: (near initialization for 'proc_tid_maps_operations')
   fs/proc/task_mmu.c:418:2: error: unknown field 'llseek' specified in initializer
     .llseek  = seq_lseek,
     ^
   fs/proc/task_mmu.c:418:13: warning: excess elements in struct initializer
     .llseek  = seq_lseek,
                ^~~~~~~~~
   fs/proc/task_mmu.c:418:13: note: (near initialization for 'proc_tid_maps_operations')
   fs/proc/task_mmu.c:419:2: error: unknown field 'release' specified in initializer
     .release = proc_map_release,
     ^
   fs/proc/task_mmu.c:419:13: warning: excess elements in struct initializer
     .release = proc_map_release,
                ^~~~~~~~~~~~~~~~
   fs/proc/task_mmu.c:419:13: note: (near initialization for 'proc_tid_maps_operations')
   fs/proc/task_mmu.c:415:30: error: storage size of 'proc_tid_maps_operations' isn't known
    const struct file_operations proc_tid_maps_operations = {
                                 ^~~~~~~~~~~~~~~~~~~~~~~~
>> fs/proc/task_mmu.c:459:13: error: invalid storage class for function 'smaps_account'
    static void smaps_account(struct mem_size_stats *mss, struct page *page,
                ^~~~~~~~~~~~~
>> fs/proc/task_mmu.c:507:12: error: invalid storage class for function 'smaps_pte_hole'
    static int smaps_pte_hole(unsigned long addr, unsigned long end,
               ^~~~~~~~~~~~~~
>> fs/proc/task_mmu.c:519:13: error: invalid storage class for function 'smaps_pte_entry'
    static void smaps_pte_entry(pte_t *pte, unsigned long addr,
                ^~~~~~~~~~~~~~~
>> fs/proc/task_mmu.c:583:13: error: invalid storage class for function 'smaps_pmd_entry'
    static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
                ^~~~~~~~~~~~~~~
>> fs/proc/task_mmu.c:589:12: error: invalid storage class for function 'smaps_pte_range'
    static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
               ^~~~~~~~~~~~~~~
>> fs/proc/task_mmu.c:618:13: error: invalid storage class for function 'show_smap_vma_flags'
    static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
                ^~~~~~~~~~~~~~~~~~~
>> fs/proc/task_mmu.c:686:12: error: invalid storage class for function 'smaps_hugetlb_range'
    static int smaps_hugetlb_range(pte_t *pte, unsigned long hmask,
               ^~~~~~~~~~~~~~~~~~~
>> fs/proc/task_mmu.c:718:12: error: invalid storage class for function 'show_smap'
    static int show_smap(struct seq_file *m, void *v, int is_pid)
               ^~~~~~~~~
>> fs/proc/task_mmu.c:805:12: error: invalid storage class for function 'show_pid_smap'
    static int show_pid_smap(struct seq_file *m, void *v)
               ^~~~~~~~~~~~~
>> fs/proc/task_mmu.c:810:12: error: invalid storage class for function 'show_tid_smap'
    static int show_tid_smap(struct seq_file *m, void *v)
               ^~~~~~~~~~~~~
   fs/proc/task_mmu.c:816:11: error: initializer element is not constant
     .start = m_start,
              ^~~~~~~
   fs/proc/task_mmu.c:816:11: note: (near initialization for 'proc_pid_smaps_op.start')
   fs/proc/task_mmu.c:817:10: error: initializer element is not constant
     .next = m_next,
             ^~~~~~
   fs/proc/task_mmu.c:817:10: note: (near initialization for 'proc_pid_smaps_op.next')
   fs/proc/task_mmu.c:818:10: error: initializer element is not constant
     .stop = m_stop,
             ^~~~~~
   fs/proc/task_mmu.c:818:10: note: (near initialization for 'proc_pid_smaps_op.stop')
   fs/proc/task_mmu.c:819:10: error: initializer element is not constant
     .show = show_pid_smap
             ^~~~~~~~~~~~~
   fs/proc/task_mmu.c:819:10: note: (near initialization for 'proc_pid_smaps_op.show')
   fs/proc/task_mmu.c:823:11: error: initializer element is not constant
     .start = m_start,
              ^~~~~~~
   fs/proc/task_mmu.c:823:11: note: (near initialization for 'proc_tid_smaps_op.start')
   fs/proc/task_mmu.c:824:10: error: initializer element is not constant
     .next = m_next,
             ^~~~~~
   fs/proc/task_mmu.c:824:10: note: (near initialization for 'proc_tid_smaps_op.next')
   fs/proc/task_mmu.c:825:10: error: initializer element is not constant
     .stop = m_stop,
             ^~~~~~
   fs/proc/task_mmu.c:825:10: note: (near initialization for 'proc_tid_smaps_op.stop')
   fs/proc/task_mmu.c:826:10: error: initializer element is not constant
     .show = show_tid_smap
             ^~~~~~~~~~~~~
   fs/proc/task_mmu.c:826:10: note: (near initialization for 'proc_tid_smaps_op.show')
>> fs/proc/task_mmu.c:829:12: error: invalid storage class for function 'pid_smaps_open'
    static int pid_smaps_open(struct inode *inode, struct file *file)
               ^~~~~~~~~~~~~~
>> fs/proc/task_mmu.c:834:12: error: invalid storage class for function 'tid_smaps_open'
    static int tid_smaps_open(struct inode *inode, struct file *file)
               ^~~~~~~~~~~~~~
>> fs/proc/task_mmu.c:839:14: error: variable 'proc_pid_smaps_operations' has initializer but incomplete type
    const struct file_operations proc_pid_smaps_operations = {
                 ^~~~~~~~~~~~~~~
>> fs/proc/task_mmu.c:839:30: error: declaration of 'proc_pid_smaps_operations' with no linkage follows extern declaration
    const struct file_operations proc_pid_smaps_operations = {
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from fs/proc/task_mmu.c:22:0:
   fs/proc/internal.h:296:37: note: previous declaration of 'proc_pid_smaps_operations' was here
    extern const struct file_operations proc_pid_smaps_operations;
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
   fs/proc/task_mmu.c:840:2: error: unknown field 'open' specified in initializer
     .open  = pid_smaps_open,
     ^
   fs/proc/task_mmu.c:840:11: warning: excess elements in struct initializer
     .open  = pid_smaps_open,
              ^~~~~~~~~~~~~~
   fs/proc/task_mmu.c:840:11: note: (near initialization for 'proc_pid_smaps_operations')
   fs/proc/task_mmu.c:841:2: error: unknown field 'read' specified in initializer
     .read  = seq_read,
     ^
   fs/proc/task_mmu.c:841:11: warning: excess elements in struct initializer
     .read  = seq_read,
              ^~~~~~~~
   fs/proc/task_mmu.c:841:11: note: (near initialization for 'proc_pid_smaps_operations')
   fs/proc/task_mmu.c:842:2: error: unknown field 'llseek' specified in initializer
     .llseek  = seq_lseek,
     ^
   fs/proc/task_mmu.c:842:13: warning: excess elements in struct initializer
     .llseek  = seq_lseek,
                ^~~~~~~~~
   fs/proc/task_mmu.c:842:13: note: (near initialization for 'proc_pid_smaps_operations')
   fs/proc/task_mmu.c:843:2: error: unknown field 'release' specified in initializer
     .release = proc_map_release,
     ^
   fs/proc/task_mmu.c:843:13: warning: excess elements in struct initializer
     .release = proc_map_release,
                ^~~~~~~~~~~~~~~~
   fs/proc/task_mmu.c:843:13: note: (near initialization for 'proc_pid_smaps_operations')
>> fs/proc/task_mmu.c:839:30: error: storage size of 'proc_pid_smaps_operations' isn't known
    const struct file_operations proc_pid_smaps_operations = {
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
..

vim +/test_and_clear_page_young +933 fs/proc/task_mmu.c

c1192f842 Dave Hansen           2016-02-12   799  	arch_show_smap(m, vma);
834f82e2a Cyrill Gorcunov       2012-12-17   800  	show_smap_vma_flags(m, vma);
b8c20a9b8 Oleg Nesterov         2014-10-09   801  	m_cache_vma(m, vma);
7c88db0cb Joe Korty             2008-10-16   802  	return 0;
e070ad49f Mauricio Lin          2005-09-03   803  }
e070ad49f Mauricio Lin          2005-09-03   804  
b76437579 Siddhesh Poyarekar    2012-03-21  @805  static int show_pid_smap(struct seq_file *m, void *v)
b76437579 Siddhesh Poyarekar    2012-03-21   806  {
b76437579 Siddhesh Poyarekar    2012-03-21   807  	return show_smap(m, v, 1);
b76437579 Siddhesh Poyarekar    2012-03-21   808  }
b76437579 Siddhesh Poyarekar    2012-03-21   809  
b76437579 Siddhesh Poyarekar    2012-03-21  @810  static int show_tid_smap(struct seq_file *m, void *v)
b76437579 Siddhesh Poyarekar    2012-03-21   811  {
b76437579 Siddhesh Poyarekar    2012-03-21   812  	return show_smap(m, v, 0);
b76437579 Siddhesh Poyarekar    2012-03-21   813  }
b76437579 Siddhesh Poyarekar    2012-03-21   814  
03a44825b Jan Engelhardt        2008-02-08   815  static const struct seq_operations proc_pid_smaps_op = {
a6198797c Matt Mackall          2008-02-04   816  	.start	= m_start,
a6198797c Matt Mackall          2008-02-04   817  	.next	= m_next,
a6198797c Matt Mackall          2008-02-04   818  	.stop	= m_stop,
b76437579 Siddhesh Poyarekar    2012-03-21   819  	.show	= show_pid_smap
a6198797c Matt Mackall          2008-02-04   820  };
a6198797c Matt Mackall          2008-02-04   821  
b76437579 Siddhesh Poyarekar    2012-03-21   822  static const struct seq_operations proc_tid_smaps_op = {
b76437579 Siddhesh Poyarekar    2012-03-21   823  	.start	= m_start,
b76437579 Siddhesh Poyarekar    2012-03-21  @824  	.next	= m_next,
b76437579 Siddhesh Poyarekar    2012-03-21  @825  	.stop	= m_stop,
b76437579 Siddhesh Poyarekar    2012-03-21  @826  	.show	= show_tid_smap
b76437579 Siddhesh Poyarekar    2012-03-21   827  };
b76437579 Siddhesh Poyarekar    2012-03-21   828  
b76437579 Siddhesh Poyarekar    2012-03-21  @829  static int pid_smaps_open(struct inode *inode, struct file *file)
a6198797c Matt Mackall          2008-02-04   830  {
a6198797c Matt Mackall          2008-02-04   831  	return do_maps_open(inode, file, &proc_pid_smaps_op);
a6198797c Matt Mackall          2008-02-04   832  }
a6198797c Matt Mackall          2008-02-04   833  
b76437579 Siddhesh Poyarekar    2012-03-21  @834  static int tid_smaps_open(struct inode *inode, struct file *file)
b76437579 Siddhesh Poyarekar    2012-03-21   835  {
b76437579 Siddhesh Poyarekar    2012-03-21   836  	return do_maps_open(inode, file, &proc_tid_smaps_op);
b76437579 Siddhesh Poyarekar    2012-03-21   837  }
b76437579 Siddhesh Poyarekar    2012-03-21   838  
b76437579 Siddhesh Poyarekar    2012-03-21  @839  const struct file_operations proc_pid_smaps_operations = {
b76437579 Siddhesh Poyarekar    2012-03-21   840  	.open		= pid_smaps_open,
b76437579 Siddhesh Poyarekar    2012-03-21   841  	.read		= seq_read,
b76437579 Siddhesh Poyarekar    2012-03-21  @842  	.llseek		= seq_lseek,
29a40ace8 Oleg Nesterov         2014-10-09  @843  	.release	= proc_map_release,
b76437579 Siddhesh Poyarekar    2012-03-21   844  };
b76437579 Siddhesh Poyarekar    2012-03-21   845  
b76437579 Siddhesh Poyarekar    2012-03-21  @846  const struct file_operations proc_tid_smaps_operations = {
b76437579 Siddhesh Poyarekar    2012-03-21   847  	.open		= tid_smaps_open,
a6198797c Matt Mackall          2008-02-04   848  	.read		= seq_read,
a6198797c Matt Mackall          2008-02-04  @849  	.llseek		= seq_lseek,
29a40ace8 Oleg Nesterov         2014-10-09  @850  	.release	= proc_map_release,
a6198797c Matt Mackall          2008-02-04   851  };
a6198797c Matt Mackall          2008-02-04   852  
040fa0207 Pavel Emelyanov       2013-07-03   853  enum clear_refs_types {
040fa0207 Pavel Emelyanov       2013-07-03   854  	CLEAR_REFS_ALL = 1,
040fa0207 Pavel Emelyanov       2013-07-03   855  	CLEAR_REFS_ANON,
040fa0207 Pavel Emelyanov       2013-07-03   856  	CLEAR_REFS_MAPPED,
0f8975ec4 Pavel Emelyanov       2013-07-03   857  	CLEAR_REFS_SOFT_DIRTY,
695f05593 Petr Cermak           2015-02-12   858  	CLEAR_REFS_MM_HIWATER_RSS,
040fa0207 Pavel Emelyanov       2013-07-03   859  	CLEAR_REFS_LAST,
040fa0207 Pavel Emelyanov       2013-07-03   860  };
040fa0207 Pavel Emelyanov       2013-07-03   861  
af9de7eb1 Pavel Emelyanov       2013-07-03   862  struct clear_refs_private {
0f8975ec4 Pavel Emelyanov       2013-07-03   863  	enum clear_refs_types type;
af9de7eb1 Pavel Emelyanov       2013-07-03   864  };
af9de7eb1 Pavel Emelyanov       2013-07-03   865  
7d5b3bfaa Kirill A. Shutemov    2015-02-11   866  #ifdef CONFIG_MEM_SOFT_DIRTY
0f8975ec4 Pavel Emelyanov       2013-07-03   867  static inline void clear_soft_dirty(struct vm_area_struct *vma,
0f8975ec4 Pavel Emelyanov       2013-07-03   868  		unsigned long addr, pte_t *pte)
0f8975ec4 Pavel Emelyanov       2013-07-03   869  {
0f8975ec4 Pavel Emelyanov       2013-07-03   870  	/*
0f8975ec4 Pavel Emelyanov       2013-07-03   871  	 * The soft-dirty tracker uses #PF-s to catch writes
0f8975ec4 Pavel Emelyanov       2013-07-03   872  	 * to pages, so write-protect the pte as well. See the
0f8975ec4 Pavel Emelyanov       2013-07-03   873  	 * Documentation/vm/soft-dirty.txt for full description
0f8975ec4 Pavel Emelyanov       2013-07-03   874  	 * of how soft-dirty works.
0f8975ec4 Pavel Emelyanov       2013-07-03   875  	 */
0f8975ec4 Pavel Emelyanov       2013-07-03   876  	pte_t ptent = *pte;
179ef71cb Cyrill Gorcunov       2013-08-13   877  
179ef71cb Cyrill Gorcunov       2013-08-13   878  	if (pte_present(ptent)) {
326c2597a Laurent Dufour        2015-11-05   879  		ptent = ptep_modify_prot_start(vma->vm_mm, addr, pte);
0f8975ec4 Pavel Emelyanov       2013-07-03   880  		ptent = pte_wrprotect(ptent);
a7b761749 Martin Schwidefsky    2015-04-22   881  		ptent = pte_clear_soft_dirty(ptent);
326c2597a Laurent Dufour        2015-11-05   882  		ptep_modify_prot_commit(vma->vm_mm, addr, pte, ptent);
179ef71cb Cyrill Gorcunov       2013-08-13   883  	} else if (is_swap_pte(ptent)) {
179ef71cb Cyrill Gorcunov       2013-08-13   884  		ptent = pte_swp_clear_soft_dirty(ptent);
0f8975ec4 Pavel Emelyanov       2013-07-03   885  		set_pte_at(vma->vm_mm, addr, pte, ptent);
0f8975ec4 Pavel Emelyanov       2013-07-03   886  	}
326c2597a Laurent Dufour        2015-11-05   887  }
5d3875a01 Laurent Dufour        2015-11-05   888  #else
5d3875a01 Laurent Dufour        2015-11-05  @889  static inline void clear_soft_dirty(struct vm_area_struct *vma,
5d3875a01 Laurent Dufour        2015-11-05   890  		unsigned long addr, pte_t *pte)
5d3875a01 Laurent Dufour        2015-11-05   891  {
5d3875a01 Laurent Dufour        2015-11-05   892  }
5d3875a01 Laurent Dufour        2015-11-05   893  #endif
0f8975ec4 Pavel Emelyanov       2013-07-03   894  
5d3875a01 Laurent Dufour        2015-11-05   895  #if defined(CONFIG_MEM_SOFT_DIRTY) && defined(CONFIG_TRANSPARENT_HUGEPAGE)
7d5b3bfaa Kirill A. Shutemov    2015-02-11   896  static inline void clear_soft_dirty_pmd(struct vm_area_struct *vma,
7d5b3bfaa Kirill A. Shutemov    2015-02-11   897  		unsigned long addr, pmd_t *pmdp)
7d5b3bfaa Kirill A. Shutemov    2015-02-11   898  {
326c2597a Laurent Dufour        2015-11-05   899  	pmd_t pmd = pmdp_huge_get_and_clear(vma->vm_mm, addr, pmdp);
7d5b3bfaa Kirill A. Shutemov    2015-02-11   900  
7d5b3bfaa Kirill A. Shutemov    2015-02-11   901  	pmd = pmd_wrprotect(pmd);
a7b761749 Martin Schwidefsky    2015-04-22   902  	pmd = pmd_clear_soft_dirty(pmd);
7d5b3bfaa Kirill A. Shutemov    2015-02-11   903  
7d5b3bfaa Kirill A. Shutemov    2015-02-11   904  	set_pmd_at(vma->vm_mm, addr, pmdp, pmd);
7d5b3bfaa Kirill A. Shutemov    2015-02-11   905  }
7d5b3bfaa Kirill A. Shutemov    2015-02-11   906  #else
7d5b3bfaa Kirill A. Shutemov    2015-02-11  @907  static inline void clear_soft_dirty_pmd(struct vm_area_struct *vma,
7d5b3bfaa Kirill A. Shutemov    2015-02-11   908  		unsigned long addr, pmd_t *pmdp)
7d5b3bfaa Kirill A. Shutemov    2015-02-11   909  {
7d5b3bfaa Kirill A. Shutemov    2015-02-11   910  }
7d5b3bfaa Kirill A. Shutemov    2015-02-11   911  #endif
7d5b3bfaa Kirill A. Shutemov    2015-02-11   912  
a6198797c Matt Mackall          2008-02-04  @913  static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr,
2165009bd Dave Hansen           2008-06-12   914  				unsigned long end, struct mm_walk *walk)
a6198797c Matt Mackall          2008-02-04   915  {
af9de7eb1 Pavel Emelyanov       2013-07-03   916  	struct clear_refs_private *cp = walk->private;
5c64f52ac Naoya Horiguchi       2015-02-11   917  	struct vm_area_struct *vma = walk->vma;
a6198797c Matt Mackall          2008-02-04   918  	pte_t *pte, ptent;
a6198797c Matt Mackall          2008-02-04   919  	spinlock_t *ptl;
a6198797c Matt Mackall          2008-02-04   920  	struct page *page;
a6198797c Matt Mackall          2008-02-04   921  
b6ec57f4b Kirill A. Shutemov    2016-01-21   922  	ptl = pmd_trans_huge_lock(pmd, vma);
b6ec57f4b Kirill A. Shutemov    2016-01-21   923  	if (ptl) {
7d5b3bfaa Kirill A. Shutemov    2015-02-11   924  		if (cp->type == CLEAR_REFS_SOFT_DIRTY) {
7d5b3bfaa Kirill A. Shutemov    2015-02-11   925  			clear_soft_dirty_pmd(vma, addr, pmd);
7d5b3bfaa Kirill A. Shutemov    2015-02-11   926  			goto out;
7d5b3bfaa Kirill A. Shutemov    2015-02-11   927  		}
7d5b3bfaa Kirill A. Shutemov    2015-02-11   928  
7d5b3bfaa Kirill A. Shutemov    2015-02-11   929  		page = pmd_page(*pmd);
7d5b3bfaa Kirill A. Shutemov    2015-02-11   930  
7d5b3bfaa Kirill A. Shutemov    2015-02-11   931  		/* Clear accessed and referenced bits. */
7d5b3bfaa Kirill A. Shutemov    2015-02-11   932  		pmdp_test_and_clear_young(vma, addr, pmd);
33c3fc71c Vladimir Davydov      2015-09-09  @933  		test_and_clear_page_young(page);
7d5b3bfaa Kirill A. Shutemov    2015-02-11   934  		ClearPageReferenced(page);
7d5b3bfaa Kirill A. Shutemov    2015-02-11   935  out:
7d5b3bfaa Kirill A. Shutemov    2015-02-11   936  		spin_unlock(ptl);
7d5b3bfaa Kirill A. Shutemov    2015-02-11   937  		return 0;
7d5b3bfaa Kirill A. Shutemov    2015-02-11   938  	}
7d5b3bfaa Kirill A. Shutemov    2015-02-11   939  
1a5a9906d Andrea Arcangeli      2012-03-21   940  	if (pmd_trans_unstable(pmd))
1a5a9906d Andrea Arcangeli      2012-03-21   941  		return 0;
033193275 Dave Hansen           2011-03-22   942  
a6198797c Matt Mackall          2008-02-04   943  	pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
a6198797c Matt Mackall          2008-02-04   944  	for (; addr != end; pte++, addr += PAGE_SIZE) {
a6198797c Matt Mackall          2008-02-04   945  		ptent = *pte;
a6198797c Matt Mackall          2008-02-04   946  
0f8975ec4 Pavel Emelyanov       2013-07-03   947  		if (cp->type == CLEAR_REFS_SOFT_DIRTY) {
0f8975ec4 Pavel Emelyanov       2013-07-03   948  			clear_soft_dirty(vma, addr, pte);
0f8975ec4 Pavel Emelyanov       2013-07-03   949  			continue;
0f8975ec4 Pavel Emelyanov       2013-07-03   950  		}
0f8975ec4 Pavel Emelyanov       2013-07-03   951  
179ef71cb Cyrill Gorcunov       2013-08-13   952  		if (!pte_present(ptent))
179ef71cb Cyrill Gorcunov       2013-08-13   953  			continue;
179ef71cb Cyrill Gorcunov       2013-08-13   954  
a6198797c Matt Mackall          2008-02-04   955  		page = vm_normal_page(vma, addr, ptent);
a6198797c Matt Mackall          2008-02-04   956  		if (!page)
a6198797c Matt Mackall          2008-02-04   957  			continue;
a6198797c Matt Mackall          2008-02-04   958  
a6198797c Matt Mackall          2008-02-04   959  		/* Clear accessed and referenced bits. */
a6198797c Matt Mackall          2008-02-04   960  		ptep_test_and_clear_young(vma, addr, pte);
33c3fc71c Vladimir Davydov      2015-09-09   961  		test_and_clear_page_young(page);
a6198797c Matt Mackall          2008-02-04   962  		ClearPageReferenced(page);
a6198797c Matt Mackall          2008-02-04   963  	}
a6198797c Matt Mackall          2008-02-04   964  	pte_unmap_unlock(pte - 1, ptl);
a6198797c Matt Mackall          2008-02-04   965  	cond_resched();
a6198797c Matt Mackall          2008-02-04   966  	return 0;
a6198797c Matt Mackall          2008-02-04   967  }
a6198797c Matt Mackall          2008-02-04   968  
5c64f52ac Naoya Horiguchi       2015-02-11  @969  static int clear_refs_test_walk(unsigned long start, unsigned long end,
5c64f52ac Naoya Horiguchi       2015-02-11   970  				struct mm_walk *walk)
5c64f52ac Naoya Horiguchi       2015-02-11   971  {
5c64f52ac Naoya Horiguchi       2015-02-11   972  	struct clear_refs_private *cp = walk->private;
5c64f52ac Naoya Horiguchi       2015-02-11   973  	struct vm_area_struct *vma = walk->vma;
5c64f52ac Naoya Horiguchi       2015-02-11   974  
48684a65b Naoya Horiguchi       2015-02-11   975  	if (vma->vm_flags & VM_PFNMAP)
48684a65b Naoya Horiguchi       2015-02-11   976  		return 1;
48684a65b Naoya Horiguchi       2015-02-11   977  
5c64f52ac Naoya Horiguchi       2015-02-11   978  	/*
5c64f52ac Naoya Horiguchi       2015-02-11   979  	 * Writing 1 to /proc/pid/clear_refs affects all pages.
5c64f52ac Naoya Horiguchi       2015-02-11   980  	 * Writing 2 to /proc/pid/clear_refs only affects anonymous pages.
5c64f52ac Naoya Horiguchi       2015-02-11   981  	 * Writing 3 to /proc/pid/clear_refs only affects file mapped pages.
5c64f52ac Naoya Horiguchi       2015-02-11   982  	 * Writing 4 to /proc/pid/clear_refs affects all pages.
5c64f52ac Naoya Horiguchi       2015-02-11   983  	 */
5c64f52ac Naoya Horiguchi       2015-02-11   984  	if (cp->type == CLEAR_REFS_ANON && vma->vm_file)
5c64f52ac Naoya Horiguchi       2015-02-11   985  		return 1;
5c64f52ac Naoya Horiguchi       2015-02-11   986  	if (cp->type == CLEAR_REFS_MAPPED && !vma->vm_file)
5c64f52ac Naoya Horiguchi       2015-02-11   987  		return 1;
5c64f52ac Naoya Horiguchi       2015-02-11   988  	return 0;
5c64f52ac Naoya Horiguchi       2015-02-11   989  }
5c64f52ac Naoya Horiguchi       2015-02-11   990  
f248dcb34 Matt Mackall          2008-02-04  @991  static ssize_t clear_refs_write(struct file *file, const char __user *buf,
f248dcb34 Matt Mackall          2008-02-04   992  				size_t count, loff_t *ppos)
b813e931b David Rientjes        2007-05-06   993  {
f248dcb34 Matt Mackall          2008-02-04   994  	struct task_struct *task;
fb92a4b06 Vincent Li            2009-09-22   995  	char buffer[PROC_NUMBUF];
f248dcb34 Matt Mackall          2008-02-04   996  	struct mm_struct *mm;
b813e931b David Rientjes        2007-05-06   997  	struct vm_area_struct *vma;
040fa0207 Pavel Emelyanov       2013-07-03   998  	enum clear_refs_types type;
040fa0207 Pavel Emelyanov       2013-07-03   999  	int itype;
0a8cb8e34 Alexey Dobriyan       2011-05-26  1000  	int rv;
b813e931b David Rientjes        2007-05-06  1001  
f248dcb34 Matt Mackall          2008-02-04  1002  	memset(buffer, 0, sizeof(buffer));
f248dcb34 Matt Mackall          2008-02-04  1003  	if (count > sizeof(buffer) - 1)
f248dcb34 Matt Mackall          2008-02-04  1004  		count = sizeof(buffer) - 1;
f248dcb34 Matt Mackall          2008-02-04  1005  	if (copy_from_user(buffer, buf, count))
f248dcb34 Matt Mackall          2008-02-04  1006  		return -EFAULT;
040fa0207 Pavel Emelyanov       2013-07-03  1007  	rv = kstrtoint(strstrip(buffer), 10, &itype);
0a8cb8e34 Alexey Dobriyan       2011-05-26  1008  	if (rv < 0)
0a8cb8e34 Alexey Dobriyan       2011-05-26  1009  		return rv;
040fa0207 Pavel Emelyanov       2013-07-03  1010  	type = (enum clear_refs_types)itype;
040fa0207 Pavel Emelyanov       2013-07-03  1011  	if (type < CLEAR_REFS_ALL || type >= CLEAR_REFS_LAST)
f248dcb34 Matt Mackall          2008-02-04  1012  		return -EINVAL;
541c237c0 Pavel Emelyanov       2013-07-03  1013  
496ad9aa8 Al Viro               2013-01-23 @1014  	task = get_proc_task(file_inode(file));
f248dcb34 Matt Mackall          2008-02-04  1015  	if (!task)
f248dcb34 Matt Mackall          2008-02-04  1016  		return -ESRCH;
f248dcb34 Matt Mackall          2008-02-04 @1017  	mm = get_task_mm(task);
f248dcb34 Matt Mackall          2008-02-04  1018  	if (mm) {
af9de7eb1 Pavel Emelyanov       2013-07-03  1019  		struct clear_refs_private cp = {
0f8975ec4 Pavel Emelyanov       2013-07-03  1020  			.type = type,
af9de7eb1 Pavel Emelyanov       2013-07-03  1021  		};
20cbc9726 Andrew Morton         2008-07-05  1022  		struct mm_walk clear_refs_walk = {
20cbc9726 Andrew Morton         2008-07-05  1023  			.pmd_entry = clear_refs_pte_range,
5c64f52ac Naoya Horiguchi       2015-02-11  1024  			.test_walk = clear_refs_test_walk,
20cbc9726 Andrew Morton         2008-07-05  1025  			.mm = mm,
af9de7eb1 Pavel Emelyanov       2013-07-03  1026  			.private = &cp,
20cbc9726 Andrew Morton         2008-07-05  1027  		};
695f05593 Petr Cermak           2015-02-12  1028  
695f05593 Petr Cermak           2015-02-12  1029  		if (type == CLEAR_REFS_MM_HIWATER_RSS) {
527157715 Michal Hocko          2016-05-24  1030  			if (down_write_killable(&mm->mmap_sem)) {
527157715 Michal Hocko          2016-05-24  1031  				count = -EINTR;
527157715 Michal Hocko          2016-05-24  1032  				goto out_mm;
527157715 Michal Hocko          2016-05-24  1033  			}
527157715 Michal Hocko          2016-05-24  1034  
695f05593 Petr Cermak           2015-02-12  1035  			/*
695f05593 Petr Cermak           2015-02-12  1036  			 * Writing 5 to /proc/pid/clear_refs resets the peak
695f05593 Petr Cermak           2015-02-12  1037  			 * resident set size to this mm's current rss value.
695f05593 Petr Cermak           2015-02-12  1038  			 */
695f05593 Petr Cermak           2015-02-12  1039  			reset_mm_hiwater_rss(mm);
695f05593 Petr Cermak           2015-02-12  1040  			up_write(&mm->mmap_sem);
695f05593 Petr Cermak           2015-02-12  1041  			goto out_mm;
695f05593 Petr Cermak           2015-02-12  1042  		}
695f05593 Petr Cermak           2015-02-12  1043  
b813e931b David Rientjes        2007-05-06  1044  		down_read(&mm->mmap_sem);
64e455079 Peter Feiner          2014-10-13  1045  		if (type == CLEAR_REFS_SOFT_DIRTY) {
64e455079 Peter Feiner          2014-10-13  1046  			for (vma = mm->mmap; vma; vma = vma->vm_next) {
64e455079 Peter Feiner          2014-10-13  1047  				if (!(vma->vm_flags & VM_SOFTDIRTY))
64e455079 Peter Feiner          2014-10-13  1048  					continue;
64e455079 Peter Feiner          2014-10-13  1049  				up_read(&mm->mmap_sem);
527157715 Michal Hocko          2016-05-24  1050  				if (down_write_killable(&mm->mmap_sem)) {
527157715 Michal Hocko          2016-05-24  1051  					count = -EINTR;
527157715 Michal Hocko          2016-05-24  1052  					goto out_mm;
527157715 Michal Hocko          2016-05-24  1053  				}
64e455079 Peter Feiner          2014-10-13  1054  				for (vma = mm->mmap; vma; vma = vma->vm_next) {
64e455079 Peter Feiner          2014-10-13  1055  					vma->vm_flags &= ~VM_SOFTDIRTY;
64e455079 Peter Feiner          2014-10-13  1056  					vma_set_page_prot(vma);
64e455079 Peter Feiner          2014-10-13  1057  				}
64e455079 Peter Feiner          2014-10-13  1058  				downgrade_write(&mm->mmap_sem);
64e455079 Peter Feiner          2014-10-13  1059  				break;
64e455079 Peter Feiner          2014-10-13  1060  			}
0f8975ec4 Pavel Emelyanov       2013-07-03  1061  			mmu_notifier_invalidate_range_start(mm, 0, -1);
64e455079 Peter Feiner          2014-10-13  1062  		}
5c64f52ac Naoya Horiguchi       2015-02-11  1063  		walk_page_range(0, ~0UL, &clear_refs_walk);
0f8975ec4 Pavel Emelyanov       2013-07-03  1064  		if (type == CLEAR_REFS_SOFT_DIRTY)
0f8975ec4 Pavel Emelyanov       2013-07-03  1065  			mmu_notifier_invalidate_range_end(mm, 0, -1);
b813e931b David Rientjes        2007-05-06  1066  		flush_tlb_mm(mm);
b813e931b David Rientjes        2007-05-06  1067  		up_read(&mm->mmap_sem);
695f05593 Petr Cermak           2015-02-12  1068  out_mm:
f248dcb34 Matt Mackall          2008-02-04  1069  		mmput(mm);
b813e931b David Rientjes        2007-05-06  1070  	}
f248dcb34 Matt Mackall          2008-02-04 @1071  	put_task_struct(task);
fb92a4b06 Vincent Li            2009-09-22  1072  
fb92a4b06 Vincent Li            2009-09-22  1073  	return count;
f248dcb34 Matt Mackall          2008-02-04  1074  }
f248dcb34 Matt Mackall          2008-02-04  1075  
f248dcb34 Matt Mackall          2008-02-04 @1076  const struct file_operations proc_clear_refs_operations = {
f248dcb34 Matt Mackall          2008-02-04 @1077  	.write		= clear_refs_write,
6038f373a Arnd Bergmann         2010-08-15 @1078  	.llseek		= noop_llseek,
f248dcb34 Matt Mackall          2008-02-04  1079  };
b813e931b David Rientjes        2007-05-06  1080  
092b50bac Naoya Horiguchi       2012-03-21  1081  typedef struct {
092b50bac Naoya Horiguchi       2012-03-21  1082  	u64 pme;
092b50bac Naoya Horiguchi       2012-03-21  1083  } pagemap_entry_t;
092b50bac Naoya Horiguchi       2012-03-21  1084  
85863e475 Matt Mackall          2008-02-04  1085  struct pagemapread {
8c8296223 yonghua zheng         2013-08-13  1086  	int pos, len;		/* units: PM_ENTRY_BYTES, not bytes */
092b50bac Naoya Horiguchi       2012-03-21  1087  	pagemap_entry_t *buffer;
1c90308e7 Konstantin Khlebnikov 2015-09-08  1088  	bool show_pfn;
85863e475 Matt Mackall          2008-02-04  1089  };
85863e475 Matt Mackall          2008-02-04  1090  
5aaabe831 Naoya Horiguchi       2012-03-21  1091  #define PAGEMAP_WALK_SIZE	(PMD_SIZE)
5aaabe831 Naoya Horiguchi       2012-03-21  1092  #define PAGEMAP_WALK_MASK	(PMD_MASK)
5aaabe831 Naoya Horiguchi       2012-03-21  1093  
8c8296223 yonghua zheng         2013-08-13  1094  #define PM_ENTRY_BYTES		sizeof(pagemap_entry_t)
deb945441 Konstantin Khlebnikov 2015-09-08  1095  #define PM_PFRAME_BITS		55
deb945441 Konstantin Khlebnikov 2015-09-08  1096  #define PM_PFRAME_MASK		GENMASK_ULL(PM_PFRAME_BITS - 1, 0)
deb945441 Konstantin Khlebnikov 2015-09-08  1097  #define PM_SOFT_DIRTY		BIT_ULL(55)
77bb499bb Konstantin Khlebnikov 2015-09-08  1098  #define PM_MMAP_EXCLUSIVE	BIT_ULL(56)
deb945441 Konstantin Khlebnikov 2015-09-08  1099  #define PM_FILE			BIT_ULL(61)
deb945441 Konstantin Khlebnikov 2015-09-08  1100  #define PM_SWAP			BIT_ULL(62)
deb945441 Konstantin Khlebnikov 2015-09-08  1101  #define PM_PRESENT		BIT_ULL(63)
deb945441 Konstantin Khlebnikov 2015-09-08  1102  
85863e475 Matt Mackall          2008-02-04  1103  #define PM_END_OF_BUFFER    1
85863e475 Matt Mackall          2008-02-04  1104  
deb945441 Konstantin Khlebnikov 2015-09-08 @1105  static inline pagemap_entry_t make_pme(u64 frame, u64 flags)
092b50bac Naoya Horiguchi       2012-03-21  1106  {
deb945441 Konstantin Khlebnikov 2015-09-08  1107  	return (pagemap_entry_t) { .pme = (frame & PM_PFRAME_MASK) | flags };
092b50bac Naoya Horiguchi       2012-03-21  1108  }
092b50bac Naoya Horiguchi       2012-03-21  1109  
092b50bac Naoya Horiguchi       2012-03-21 @1110  static int add_to_pagemap(unsigned long addr, pagemap_entry_t *pme,
85863e475 Matt Mackall          2008-02-04  1111  			  struct pagemapread *pm)
85863e475 Matt Mackall          2008-02-04  1112  {
092b50bac Naoya Horiguchi       2012-03-21  1113  	pm->buffer[pm->pos++] = *pme;
d82ef020c KAMEZAWA Hiroyuki     2010-04-02  1114  	if (pm->pos >= pm->len)
aae8679b0 Thomas Tuttle         2008-06-05  1115  		return PM_END_OF_BUFFER;
85863e475 Matt Mackall          2008-02-04  1116  	return 0;
85863e475 Matt Mackall          2008-02-04  1117  }
85863e475 Matt Mackall          2008-02-04  1118  
85863e475 Matt Mackall          2008-02-04 @1119  static int pagemap_pte_hole(unsigned long start, unsigned long end,
2165009bd Dave Hansen           2008-06-12  1120  				struct mm_walk *walk)
85863e475 Matt Mackall          2008-02-04  1121  {
2165009bd Dave Hansen           2008-06-12  1122  	struct pagemapread *pm = walk->private;

:::::: The code at line 933 was first introduced by commit
:::::: 33c3fc71c8cfa3cc3a98beaa901c069c177dc295 mm: introduce idle page tracking

:::::: TO: Vladimir Davydov <vdavydov@xxxxxxxxxxxxx>
:::::: 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: 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]