tree: https://gitee.com/openeuler/kernel.git OLK-6.6 head: 16a0cbac6609f8ba10a91a9d52b15bf28243c3ee commit: 7d1031b36ebd6c273d9aad316fd9e3e2daa01a85 [1667/1667] mm: support pagecache limit config: loongarch-randconfig-r121-20241227 (https://download.01.org/0day-ci/archive/20241227/202412270823.5Ug5pZtv-lkp@i...) compiler: loongarch64-linux-gcc (GCC) 14.2.0 reproduce: (https://download.01.org/0day-ci/archive/20241227/202412270823.5Ug5pZtv-lkp@i...)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot lkp@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202412270823.5Ug5pZtv-lkp@intel.com/
sparse warnings: (new ones prefixed by >>) mm/page_cache_limit.c:61:5: sparse: sparse: symbol 'cache_reclaim_enable_handler' was not declared. Should it be static? mm/page_cache_limit.c:77:5: sparse: sparse: symbol 'cache_reclaim_sysctl_handler' was not declared. Should it be static?
mm/page_cache_limit.c:103:52: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected void * @@ got void [noderef] __user *buffer @@
mm/page_cache_limit.c:103:52: sparse: expected void * mm/page_cache_limit.c:103:52: sparse: got void [noderef] __user *buffer
mm/page_cache_limit.c:94:5: sparse: sparse: symbol 'cache_limit_mbytes_sysctl_handler' was not declared. Should it be static? mm/page_cache_limit.c:187:35: sparse: sparse: incorrect type in initializer (incompatible argument 3 (different address spaces)) @@ expected int ( [usertype] *proc_handler )( ... ) @@ got int ( * )( ... ) @@
mm/page_cache_limit.c:187:35: sparse: expected int ( [usertype] *proc_handler )( ... ) mm/page_cache_limit.c:187:35: sparse: got int ( * )( ... )
vim +103 mm/page_cache_limit.c
93
94 int cache_limit_mbytes_sysctl_handler(struct ctl_table *table, int write,
95 void __user *buffer, size_t *length, loff_t *ppos) 96 { 97 int ret; 98 unsigned long vm_cache_limit_mbytes_max; 99 unsigned long origin_mbytes = vm_cache_limit_mbytes; 100 int nr_retries = MAX_RECLAIM_RETRIES; 101 102 vm_cache_limit_mbytes_max = totalram_pages() >> (20 - PAGE_SHIFT);
103 ret = proc_doulongvec_minmax(table, write, buffer, length, ppos);
104 if (ret || !write) 105 return ret; 106 107 if (vm_cache_limit_mbytes > vm_cache_limit_mbytes_max) { 108 vm_cache_limit_mbytes = origin_mbytes; 109 return -EINVAL; 110 } 111 112 if (write) { 113 while (should_reclaim_page_cache() && page_cache_over_limit() && 114 nr_retries--) { 115 if (signal_pending(current)) 116 return -EINTR; 117 118 shrink_memory(node_reclaim_num(), false); 119 } 120 } 121 122 return 0; 123 } 124 125 static void shrink_shepherd(struct work_struct *w) 126 { 127 int node; 128 129 if (!should_periodical_reclaim()) 130 return; 131 132 for_each_online_node(node) { 133 if (!work_pending(&vmscan_works[node])) 134 queue_work_node(node, system_unbound_wq, &vmscan_works[node]); 135 } 136 137 queue_delayed_work(system_unbound_wq, &shepherd, 138 round_jiffies_relative((unsigned long)vm_cache_reclaim_s * HZ)); 139 } 140 141 static void shrink_page_work(struct work_struct *w) 142 { 143 shrink_memory(node_reclaim_num(), true); 144 } 145 146 static void shrink_shepherd_timer(void) 147 { 148 int i; 149 150 for (i = 0; i < MAX_NUMNODES; i++) 151 INIT_WORK(&vmscan_works[i], shrink_page_work); 152 } 153 154 static struct ctl_table page_cache_limit_table[] = { 155 { 156 .procname = "cache_reclaim_s", 157 .data = &vm_cache_reclaim_s, 158 .maxlen = sizeof(vm_cache_reclaim_s), 159 .mode = 0644, 160 .proc_handler = cache_reclaim_sysctl_handler, 161 .extra1 = SYSCTL_ZERO, 162 .extra2 = &vm_cache_reclaim_s_max, 163 }, 164 { 165 .procname = "cache_reclaim_weight", 166 .data = &vm_cache_reclaim_weight, 167 .maxlen = sizeof(vm_cache_reclaim_weight), 168 .mode = 0644, 169 .proc_handler = proc_dointvec_minmax, 170 .extra1 = SYSCTL_ONE, 171 .extra2 = &vm_cache_reclaim_weight_max, 172 }, 173 { 174 .procname = "cache_reclaim_enable", 175 .data = &vm_cache_reclaim_enable, 176 .maxlen = sizeof(vm_cache_reclaim_enable), 177 .mode = 0644, 178 .proc_handler = cache_reclaim_enable_handler, 179 .extra1 = SYSCTL_ZERO, 180 .extra2 = SYSCTL_ONE, 181 }, 182 { 183 .procname = "cache_limit_mbytes", 184 .data = &vm_cache_limit_mbytes, 185 .maxlen = sizeof(vm_cache_limit_mbytes), 186 .mode = 0644,
187 .proc_handler = cache_limit_mbytes_sysctl_handler,
188 }, 189 }; 190