* [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP @ 2016-05-11 14:54 Arnd Bergmann 2016-05-11 15:32 ` Christoph Lameter ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: Arnd Bergmann @ 2016-05-11 14:54 UTC (permalink / raw) To: Andrew Morton, Hugh Dickins Cc: Arnd Bergmann, Vlastimil Babka, Michal Hocko, Christoph Lameter, Mel Gorman, Joonsoo Kim, linux-mm, linux-kernel In randconfig builds with sysfs, procfs and numa all disabled, but SMP enabled, we now get a link error in the newly introduced vmstat_refresh function: mm/built-in.o: In function `vmstat_refresh': :(.text+0x15c78): undefined reference to `vmstat_text' This modifes the already elaborate #ifdef to also cover that configuration. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: mmotm ("mm: /proc/sys/vm/stat_refresh to force vmstat update") --- mm/vmstat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/vmstat.c b/mm/vmstat.c index 57a24e919907..5367eb9b858b 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -678,7 +678,8 @@ int fragmentation_index(struct zone *zone, unsigned int order) } #endif -#if defined(CONFIG_PROC_FS) || defined(CONFIG_SYSFS) || defined(CONFIG_NUMA) +#if defined(CONFIG_PROC_FS) || defined(CONFIG_SYSFS) || \ + defined(CONFIG_NUMA) || defined(CONFIG_SMP) #ifdef CONFIG_ZONE_DMA #define TEXT_FOR_DMA(xx) xx "_dma", #else @@ -857,7 +858,7 @@ const char * const vmstat_text[] = { #endif #endif /* CONFIG_VM_EVENTS_COUNTERS */ }; -#endif /* CONFIG_PROC_FS || CONFIG_SYSFS || CONFIG_NUMA */ +#endif /* CONFIG_PROC_FS || CONFIG_SYSFS || CONFIG_NUMA || CONFIG_SMP */ #if (defined(CONFIG_DEBUG_FS) && defined(CONFIG_COMPACTION)) || \ -- 2.7.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP 2016-05-11 14:54 [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP Arnd Bergmann @ 2016-05-11 15:32 ` Christoph Lameter 2016-05-16 7:31 ` Michal Hocko 2016-05-17 5:31 ` Do not build vmstat_refresh if there is no procfs support kbuild test robot 2016-05-16 7:37 ` [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP Michal Hocko 2016-05-16 14:23 ` Michal Hocko 2 siblings, 2 replies; 10+ messages in thread From: Christoph Lameter @ 2016-05-11 15:32 UTC (permalink / raw) To: Arnd Bergmann Cc: Andrew Morton, Hugh Dickins, Vlastimil Babka, Michal Hocko, Mel Gorman, Joonsoo Kim, linux-mm, linux-kernel On Wed, 11 May 2016, Arnd Bergmann wrote: > In randconfig builds with sysfs, procfs and numa all disabled, > but SMP enabled, we now get a link error in the newly introduced > vmstat_refresh function: > > mm/built-in.o: In function `vmstat_refresh': Hmmm... vmstat_refresh should not be build if CONFIG_PROC_FS is not set since there will be no way to trigger it. Lets not complicate this further. Subject: Do not build vmstat_refresh if there is no procfs support It makes no sense to build functionality into the kernel that cannot be used and causes build issues. Signed-off-by: Christoph Lameter <cl@linux.com> Index: linux/mm/vmstat.c =================================================================== --- linux.orig/mm/vmstat.c +++ linux/mm/vmstat.c @@ -1358,7 +1358,6 @@ static const struct file_operations proc .llseek = seq_lseek, .release = seq_release, }; -#endif /* CONFIG_PROC_FS */ #ifdef CONFIG_SMP static struct workqueue_struct *vmstat_wq; @@ -1422,7 +1421,10 @@ int vmstat_refresh(struct ctl_table *tab *lenp = 0; return 0; } +#endif /* CONFIG_SMP */ +#endif /* CONFIG_PROC_FS */ +#ifdef CONFIG_SMP static void vmstat_update(struct work_struct *w) { if (refresh_cpu_vm_stats(true)) { ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP 2016-05-11 15:32 ` Christoph Lameter @ 2016-05-16 7:31 ` Michal Hocko 2016-05-17 5:31 ` Do not build vmstat_refresh if there is no procfs support kbuild test robot 1 sibling, 0 replies; 10+ messages in thread From: Michal Hocko @ 2016-05-16 7:31 UTC (permalink / raw) To: Christoph Lameter Cc: Arnd Bergmann, Andrew Morton, Hugh Dickins, Vlastimil Babka, Mel Gorman, Joonsoo Kim, linux-mm, linux-kernel On Wed 11-05-16 10:32:11, Christoph Lameter wrote: > Subject: Do not build vmstat_refresh if there is no procfs support > > It makes no sense to build functionality into the kernel that > cannot be used and causes build issues. > > Signed-off-by: Christoph Lameter <cl@linux.com> > > Index: linux/mm/vmstat.c > =================================================================== > --- linux.orig/mm/vmstat.c > +++ linux/mm/vmstat.c > @@ -1358,7 +1358,6 @@ static const struct file_operations proc > .llseek = seq_lseek, > .release = seq_release, > }; > -#endif /* CONFIG_PROC_FS */ > > #ifdef CONFIG_SMP > static struct workqueue_struct *vmstat_wq; This doesn't work because it makes the whole vmstat_wq depend on CONFIG_PROC_FS. Which is obviously bad because we both rely on doing the periodic sync even when counters are not exported to the userspace and it wound't compile anyway... -- Michal Hocko SUSE Labs ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Do not build vmstat_refresh if there is no procfs support 2016-05-11 15:32 ` Christoph Lameter 2016-05-16 7:31 ` Michal Hocko @ 2016-05-17 5:31 ` kbuild test robot 1 sibling, 0 replies; 10+ messages in thread From: kbuild test robot @ 2016-05-17 5:31 UTC (permalink / raw) To: Christoph Lameter Cc: kbuild-all, Arnd Bergmann, Andrew Morton, Hugh Dickins, Vlastimil Babka, Michal Hocko, Mel Gorman, Joonsoo Kim, linux-mm, linux-kernel [-- Attachment #1: Type: text/plain, Size: 14871 bytes --] Hi, [auto build test ERROR on next-20160511] [cannot apply to v4.6-rc7 v4.6-rc6 v4.6-rc5 v4.6] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Christoph-Lameter/Do-not-build-vmstat_refresh-if-there-is-no-procfs-support/20160511-233405 config: arm64-allnoconfig (attached as .config) compiler: aarch64-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205 reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=arm64 All error/warnings (new ones prefixed by >>): mm/vmstat.c: In function 'vmstat_update': >> mm/vmstat.c:1436:45: error: 'vmstat_wq' undeclared (first use in this function) queue_delayed_work_on(smp_processor_id(), vmstat_wq, ^ mm/vmstat.c:1436:45: note: each undeclared identifier is reported only once for each function it appears in In file included from include/asm-generic/percpu.h:6:0, from arch/arm64/include/asm/percpu.h:276, from include/linux/percpu.h:12, from include/linux/percpu-rwsem.h:6, from include/linux/fs.h:30, from mm/vmstat.c:12: >> mm/vmstat.c:1437:19: error: 'vmstat_work' undeclared (first use in this function) this_cpu_ptr(&vmstat_work), ^ include/linux/percpu-defs.h:206:47: note: in definition of macro '__verify_pcpu_ptr' const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \ ^ include/linux/percpu-defs.h:239:27: note: in expansion of macro 'raw_cpu_ptr' #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) ^ >> mm/vmstat.c:1437:5: note: in expansion of macro 'this_cpu_ptr' this_cpu_ptr(&vmstat_work), ^ In file included from include/linux/fs.h:32:0, from mm/vmstat.c:12: mm/vmstat.c: In function 'quiet_vmstat': mm/vmstat.c:1480:42: error: 'vmstat_work' undeclared (first use in this function) if (!delayed_work_pending(this_cpu_ptr(&vmstat_work))) ^ include/linux/workqueue.h:26:51: note: in definition of macro 'work_data_bits' #define work_data_bits(work) ((unsigned long *)(&(work)->data)) ^ include/linux/workqueue.h:271:2: note: in expansion of macro 'work_pending' work_pending(&(w)->work) ^ >> mm/vmstat.c:1480:7: note: in expansion of macro 'delayed_work_pending' if (!delayed_work_pending(this_cpu_ptr(&vmstat_work))) ^ include/linux/percpu-defs.h:228:2: note: in expansion of macro '__verify_pcpu_ptr' __verify_pcpu_ptr(ptr); \ ^ include/linux/percpu-defs.h:239:27: note: in expansion of macro 'raw_cpu_ptr' #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) ^ mm/vmstat.c:1480:28: note: in expansion of macro 'this_cpu_ptr' if (!delayed_work_pending(this_cpu_ptr(&vmstat_work))) ^ In file included from include/asm-generic/percpu.h:6:0, from arch/arm64/include/asm/percpu.h:276, from include/linux/percpu.h:12, from include/linux/percpu-rwsem.h:6, from include/linux/fs.h:30, from mm/vmstat.c:12: mm/vmstat.c: In function 'vmstat_shepherd': mm/vmstat.c:1512:38: error: 'vmstat_work' undeclared (first use in this function) struct delayed_work *dw = &per_cpu(vmstat_work, cpu); ^ include/linux/percpu-defs.h:206:47: note: in definition of macro '__verify_pcpu_ptr' const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \ ^ include/linux/percpu-defs.h:256:29: note: in expansion of macro 'per_cpu_ptr' #define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu)) ^ >> mm/vmstat.c:1512:30: note: in expansion of macro 'per_cpu' struct delayed_work *dw = &per_cpu(vmstat_work, cpu); ^ mm/vmstat.c:1515:32: error: 'vmstat_wq' undeclared (first use in this function) queue_delayed_work_on(cpu, vmstat_wq, dw, 0); ^ In file included from include/linux/fs.h:32:0, from mm/vmstat.c:12: mm/vmstat.c: In function 'start_shepherd_timer': mm/vmstat.c:1528:37: error: 'vmstat_work' undeclared (first use in this function) INIT_DEFERRABLE_WORK(per_cpu_ptr(&vmstat_work, cpu), ^ include/linux/workqueue.h:216:16: note: in definition of macro '__INIT_WORK' __init_work((_work), _onstack); \ ^ include/linux/workqueue.h:231:3: note: in expansion of macro 'INIT_WORK' INIT_WORK(&(_work)->work, (_func)); \ ^ include/linux/workqueue.h:253:2: note: in expansion of macro '__INIT_DELAYED_WORK' __INIT_DELAYED_WORK(_work, _func, TIMER_DEFERRABLE) ^ >> mm/vmstat.c:1528:3: note: in expansion of macro 'INIT_DEFERRABLE_WORK' INIT_DEFERRABLE_WORK(per_cpu_ptr(&vmstat_work, cpu), ^ include/linux/percpu-defs.h:222:2: note: in expansion of macro '__verify_pcpu_ptr' __verify_pcpu_ptr(ptr); \ ^ >> mm/vmstat.c:1528:24: note: in expansion of macro 'per_cpu_ptr' INIT_DEFERRABLE_WORK(per_cpu_ptr(&vmstat_work, cpu), ^ mm/vmstat.c:1531:2: error: 'vmstat_wq' undeclared (first use in this function) vmstat_wq = alloc_workqueue("vmstat", WQ_FREEZABLE|WQ_MEM_RECLAIM, 0); ^ In file included from include/asm-generic/percpu.h:6:0, from arch/arm64/include/asm/percpu.h:276, from include/linux/percpu.h:12, from include/linux/percpu-rwsem.h:6, from include/linux/fs.h:30, from mm/vmstat.c:12: mm/vmstat.c: In function 'vmstat_cpuup_callback': mm/vmstat.c:1568:37: error: 'vmstat_work' undeclared (first use in this function) cancel_delayed_work_sync(&per_cpu(vmstat_work, cpu)); ^ include/linux/percpu-defs.h:206:47: note: in definition of macro '__verify_pcpu_ptr' const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \ ^ include/linux/percpu-defs.h:256:29: note: in expansion of macro 'per_cpu_ptr' #define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu)) ^ mm/vmstat.c:1568:29: note: in expansion of macro 'per_cpu' cancel_delayed_work_sync(&per_cpu(vmstat_work, cpu)); ^ vim +/vmstat_wq +1436 mm/vmstat.c 0eb77e988 Christoph Lameter 2016-01-14 1430 if (refresh_cpu_vm_stats(true)) { 7cc36bbdd Christoph Lameter 2014-10-09 1431 /* 7cc36bbdd Christoph Lameter 2014-10-09 1432 * Counters were updated so we expect more updates 7cc36bbdd Christoph Lameter 2014-10-09 1433 * to occur in the future. Keep on running the 7cc36bbdd Christoph Lameter 2014-10-09 1434 * update worker thread. 7cc36bbdd Christoph Lameter 2014-10-09 1435 */ 373ccbe59 Michal Hocko 2015-12-11 @1436 queue_delayed_work_on(smp_processor_id(), vmstat_wq, 176bed1de Linus Torvalds 2015-10-15 @1437 this_cpu_ptr(&vmstat_work), 98f4ebb29 Anton Blanchard 2009-04-02 1438 round_jiffies_relative(sysctl_stat_interval)); f01f17d37 Michal Hocko 2016-02-05 1439 } 7cc36bbdd Christoph Lameter 2014-10-09 1440 } 7cc36bbdd Christoph Lameter 2014-10-09 1441 7cc36bbdd Christoph Lameter 2014-10-09 1442 /* 0eb77e988 Christoph Lameter 2016-01-14 1443 * Switch off vmstat processing and then fold all the remaining differentials 0eb77e988 Christoph Lameter 2016-01-14 1444 * until the diffs stay at zero. The function is used by NOHZ and can only be 0eb77e988 Christoph Lameter 2016-01-14 1445 * invoked when tick processing is not active. 0eb77e988 Christoph Lameter 2016-01-14 1446 */ 0eb77e988 Christoph Lameter 2016-01-14 1447 /* 7cc36bbdd Christoph Lameter 2014-10-09 1448 * Check if the diffs for a certain cpu indicate that 7cc36bbdd Christoph Lameter 2014-10-09 1449 * an update is needed. 7cc36bbdd Christoph Lameter 2014-10-09 1450 */ 7cc36bbdd Christoph Lameter 2014-10-09 1451 static bool need_update(int cpu) 7cc36bbdd Christoph Lameter 2014-10-09 1452 { 7cc36bbdd Christoph Lameter 2014-10-09 1453 struct zone *zone; 7cc36bbdd Christoph Lameter 2014-10-09 1454 7cc36bbdd Christoph Lameter 2014-10-09 1455 for_each_populated_zone(zone) { 7cc36bbdd Christoph Lameter 2014-10-09 1456 struct per_cpu_pageset *p = per_cpu_ptr(zone->pageset, cpu); 7cc36bbdd Christoph Lameter 2014-10-09 1457 7cc36bbdd Christoph Lameter 2014-10-09 1458 BUILD_BUG_ON(sizeof(p->vm_stat_diff[0]) != 1); 7cc36bbdd Christoph Lameter 2014-10-09 1459 /* 7cc36bbdd Christoph Lameter 2014-10-09 1460 * The fast way of checking if there are any vmstat diffs. 7cc36bbdd Christoph Lameter 2014-10-09 1461 * This works because the diffs are byte sized items. 7cc36bbdd Christoph Lameter 2014-10-09 1462 */ 7cc36bbdd Christoph Lameter 2014-10-09 1463 if (memchr_inv(p->vm_stat_diff, 0, NR_VM_ZONE_STAT_ITEMS)) 7cc36bbdd Christoph Lameter 2014-10-09 1464 return true; 7cc36bbdd Christoph Lameter 2014-10-09 1465 7cc36bbdd Christoph Lameter 2014-10-09 1466 } 7cc36bbdd Christoph Lameter 2014-10-09 1467 return false; 7cc36bbdd Christoph Lameter 2014-10-09 1468 } 7cc36bbdd Christoph Lameter 2014-10-09 1469 043daba0d Christoph Lameter 2016-05-11 1470 /* 043daba0d Christoph Lameter 2016-05-11 1471 * Switch off vmstat processing and then fold all the remaining differentials 043daba0d Christoph Lameter 2016-05-11 1472 * until the diffs stay at zero. The function is used by NOHZ and can only be 043daba0d Christoph Lameter 2016-05-11 1473 * invoked when tick processing is not active. 043daba0d Christoph Lameter 2016-05-11 1474 */ f01f17d37 Michal Hocko 2016-02-05 1475 void quiet_vmstat(void) f01f17d37 Michal Hocko 2016-02-05 1476 { f01f17d37 Michal Hocko 2016-02-05 1477 if (system_state != SYSTEM_RUNNING) f01f17d37 Michal Hocko 2016-02-05 1478 return; f01f17d37 Michal Hocko 2016-02-05 1479 043daba0d Christoph Lameter 2016-05-11 @1480 if (!delayed_work_pending(this_cpu_ptr(&vmstat_work))) f01f17d37 Michal Hocko 2016-02-05 1481 return; f01f17d37 Michal Hocko 2016-02-05 1482 f01f17d37 Michal Hocko 2016-02-05 1483 if (!need_update(smp_processor_id())) f01f17d37 Michal Hocko 2016-02-05 1484 return; f01f17d37 Michal Hocko 2016-02-05 1485 f01f17d37 Michal Hocko 2016-02-05 1486 /* f01f17d37 Michal Hocko 2016-02-05 1487 * Just refresh counters and do not care about the pending delayed f01f17d37 Michal Hocko 2016-02-05 1488 * vmstat_update. It doesn't fire that often to matter and canceling f01f17d37 Michal Hocko 2016-02-05 1489 * it would be too expensive from this path. f01f17d37 Michal Hocko 2016-02-05 1490 * vmstat_shepherd will take care about that for us. f01f17d37 Michal Hocko 2016-02-05 1491 */ f01f17d37 Michal Hocko 2016-02-05 1492 refresh_cpu_vm_stats(false); f01f17d37 Michal Hocko 2016-02-05 1493 } f01f17d37 Michal Hocko 2016-02-05 1494 7cc36bbdd Christoph Lameter 2014-10-09 1495 /* 7cc36bbdd Christoph Lameter 2014-10-09 1496 * Shepherd worker thread that checks the 7cc36bbdd Christoph Lameter 2014-10-09 1497 * differentials of processors that have their worker 7cc36bbdd Christoph Lameter 2014-10-09 1498 * threads for vm statistics updates disabled because of 7cc36bbdd Christoph Lameter 2014-10-09 1499 * inactivity. 7cc36bbdd Christoph Lameter 2014-10-09 1500 */ 7cc36bbdd Christoph Lameter 2014-10-09 1501 static void vmstat_shepherd(struct work_struct *w); 7cc36bbdd Christoph Lameter 2014-10-09 1502 0eb77e988 Christoph Lameter 2016-01-14 1503 static DECLARE_DEFERRABLE_WORK(shepherd, vmstat_shepherd); 7cc36bbdd Christoph Lameter 2014-10-09 1504 7cc36bbdd Christoph Lameter 2014-10-09 1505 static void vmstat_shepherd(struct work_struct *w) 7cc36bbdd Christoph Lameter 2014-10-09 1506 { 7cc36bbdd Christoph Lameter 2014-10-09 1507 int cpu; 7cc36bbdd Christoph Lameter 2014-10-09 1508 7cc36bbdd Christoph Lameter 2014-10-09 1509 get_online_cpus(); 7cc36bbdd Christoph Lameter 2014-10-09 1510 /* Check processors whose vmstat worker threads have been disabled */ 043daba0d Christoph Lameter 2016-05-11 1511 for_each_online_cpu(cpu) { f01f17d37 Michal Hocko 2016-02-05 @1512 struct delayed_work *dw = &per_cpu(vmstat_work, cpu); 7cc36bbdd Christoph Lameter 2014-10-09 1513 043daba0d Christoph Lameter 2016-05-11 1514 if (!delayed_work_pending(dw) && need_update(cpu)) f01f17d37 Michal Hocko 2016-02-05 1515 queue_delayed_work_on(cpu, vmstat_wq, dw, 0); f01f17d37 Michal Hocko 2016-02-05 1516 } 7cc36bbdd Christoph Lameter 2014-10-09 1517 put_online_cpus(); 7cc36bbdd Christoph Lameter 2014-10-09 1518 7cc36bbdd Christoph Lameter 2014-10-09 1519 schedule_delayed_work(&shepherd, 7cc36bbdd Christoph Lameter 2014-10-09 1520 round_jiffies_relative(sysctl_stat_interval)); d1187ed21 Christoph Lameter 2007-05-09 1521 } d1187ed21 Christoph Lameter 2007-05-09 1522 7cc36bbdd Christoph Lameter 2014-10-09 1523 static void __init start_shepherd_timer(void) d1187ed21 Christoph Lameter 2007-05-09 1524 { 7cc36bbdd Christoph Lameter 2014-10-09 1525 int cpu; 7cc36bbdd Christoph Lameter 2014-10-09 1526 7cc36bbdd Christoph Lameter 2014-10-09 1527 for_each_possible_cpu(cpu) ccde8bd40 Michal Hocko 2016-02-05 @1528 INIT_DEFERRABLE_WORK(per_cpu_ptr(&vmstat_work, cpu), 7cc36bbdd Christoph Lameter 2014-10-09 1529 vmstat_update); 7cc36bbdd Christoph Lameter 2014-10-09 1530 751e5f5c7 Michal Hocko 2016-01-08 1531 vmstat_wq = alloc_workqueue("vmstat", WQ_FREEZABLE|WQ_MEM_RECLAIM, 0); :::::: The code at line 1436 was first introduced by commit :::::: 373ccbe5927034b55bdc80b0f8b54d6e13fe8d12 mm, vmstat: allow WQ concurrency to discover memory reclaim doesn't make any progress :::::: TO: Michal Hocko <mhocko@suse.com> :::::: CC: Linus Torvalds <torvalds@linux-foundation.org> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/octet-stream, Size: 6049 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP 2016-05-11 14:54 [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP Arnd Bergmann 2016-05-11 15:32 ` Christoph Lameter @ 2016-05-16 7:37 ` Michal Hocko 2016-05-16 13:54 ` Christoph Lameter 2016-05-16 14:23 ` Michal Hocko 2 siblings, 1 reply; 10+ messages in thread From: Michal Hocko @ 2016-05-16 7:37 UTC (permalink / raw) To: Arnd Bergmann Cc: Andrew Morton, Hugh Dickins, Vlastimil Babka, Christoph Lameter, Mel Gorman, Joonsoo Kim, linux-mm, linux-kernel On Wed 11-05-16 16:54:55, Arnd Bergmann wrote: > In randconfig builds with sysfs, procfs and numa all disabled, > but SMP enabled, we now get a link error in the newly introduced > vmstat_refresh function: > > mm/built-in.o: In function `vmstat_refresh': > :(.text+0x15c78): undefined reference to `vmstat_text' > > This modifes the already elaborate #ifdef to also cover that > configuration. > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > Fixes: mmotm ("mm: /proc/sys/vm/stat_refresh to force vmstat update") I agree with Christoph that vmstat_refresh is PROC_FS only so we should fix it there. It is not like this would be generally reusable helper... Why don't we just do: --- diff --git a/mm/vmstat.c b/mm/vmstat.c index 57a24e919907..c759b526287b 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1370,6 +1370,7 @@ static void refresh_vm_stats(struct work_struct *work) refresh_cpu_vm_stats(true); } +#ifdef CONFIG_PROC_FS int vmstat_refresh(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { @@ -1422,6 +1423,7 @@ int vmstat_refresh(struct ctl_table *table, int write, *lenp = 0; return 0; } +#endif static void vmstat_update(struct work_struct *w) { -- Michal Hocko SUSE Labs ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP 2016-05-16 7:37 ` [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP Michal Hocko @ 2016-05-16 13:54 ` Christoph Lameter 0 siblings, 0 replies; 10+ messages in thread From: Christoph Lameter @ 2016-05-16 13:54 UTC (permalink / raw) To: Michal Hocko Cc: Arnd Bergmann, Andrew Morton, Hugh Dickins, Vlastimil Babka, Mel Gorman, Joonsoo Kim, linux-mm, linux-kernel On Mon, 16 May 2016, Michal Hocko wrote: > I agree with Christoph that vmstat_refresh is PROC_FS only so we should > fix it there. It is not like this would be generally reusable helper... > Why don't we just do: Looks good. Acked-by: Christoph Lameter <cl@linux.com> > --- > diff --git a/mm/vmstat.c b/mm/vmstat.c > index 57a24e919907..c759b526287b 100644 > --- a/mm/vmstat.c > +++ b/mm/vmstat.c > @@ -1370,6 +1370,7 @@ static void refresh_vm_stats(struct work_struct *work) > refresh_cpu_vm_stats(true); > } > > +#ifdef CONFIG_PROC_FS > int vmstat_refresh(struct ctl_table *table, int write, > void __user *buffer, size_t *lenp, loff_t *ppos) > { > @@ -1422,6 +1423,7 @@ int vmstat_refresh(struct ctl_table *table, int write, > *lenp = 0; > return 0; > } > +#endif > > static void vmstat_update(struct work_struct *w) > { > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP 2016-05-11 14:54 [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP Arnd Bergmann 2016-05-11 15:32 ` Christoph Lameter 2016-05-16 7:37 ` [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP Michal Hocko @ 2016-05-16 14:23 ` Michal Hocko 2016-05-16 22:36 ` Andrew Morton 2 siblings, 1 reply; 10+ messages in thread From: Michal Hocko @ 2016-05-16 14:23 UTC (permalink / raw) To: Andrew Morton Cc: Arnd Bergmann, Hugh Dickins, Vlastimil Babka, Christoph Lameter, Mel Gorman, Joonsoo Kim, linux-mm, linux-kernel Andrew, I think that the following is more straightforward fix and should be folded in to the patch which has introduced vmstat_refresh. --- >From b8dd18fb7df040e1bfe61aadde1d903589de15e4 Mon Sep 17 00:00:00 2001 From: Michal Hocko <mhocko@suse.com> Date: Mon, 16 May 2016 16:19:53 +0200 Subject: [PATCH] mmotm: mm-proc-sys-vm-stat_refresh-to-force-vmstat-update-fix Arnd has reported: In randconfig builds with sysfs, procfs and numa all disabled, but SMP enabled, we now get a link error in the newly introduced vmstat_refresh function: mm/built-in.o: In function `vmstat_refresh': :(.text+0x15c78): undefined reference to `vmstat_text' vmstat_refresh is proc_fs specific so there is no reason to define it when !CONFIG_PROC_FS. Reported-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Christoph Lameter <cl@linux.com> Signed-off-by: Michal Hocko <mhocko@suse.com> --- mm/vmstat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/vmstat.c b/mm/vmstat.c index 57a24e919907..c759b526287b 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1370,6 +1370,7 @@ static void refresh_vm_stats(struct work_struct *work) refresh_cpu_vm_stats(true); } +#ifdef CONFIG_PROC_FS int vmstat_refresh(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { @@ -1422,6 +1423,7 @@ int vmstat_refresh(struct ctl_table *table, int write, *lenp = 0; return 0; } +#endif static void vmstat_update(struct work_struct *w) { -- 2.8.1 -- Michal Hocko SUSE Labs ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP 2016-05-16 14:23 ` Michal Hocko @ 2016-05-16 22:36 ` Andrew Morton 2016-05-17 7:05 ` Michal Hocko 0 siblings, 1 reply; 10+ messages in thread From: Andrew Morton @ 2016-05-16 22:36 UTC (permalink / raw) To: Michal Hocko Cc: Arnd Bergmann, Hugh Dickins, Vlastimil Babka, Christoph Lameter, Mel Gorman, Joonsoo Kim, linux-mm, linux-kernel On Mon, 16 May 2016 16:23:33 +0200 Michal Hocko <mhocko@kernel.org> wrote: > Andrew, I think that the following is more straightforward fix and > should be folded in to the patch which has introduced vmstat_refresh. > --- > >From b8dd18fb7df040e1bfe61aadde1d903589de15e4 Mon Sep 17 00:00:00 2001 > From: Michal Hocko <mhocko@suse.com> > Date: Mon, 16 May 2016 16:19:53 +0200 > Subject: [PATCH] mmotm: mm-proc-sys-vm-stat_refresh-to-force-vmstat-update-fix > > Arnd has reported: > In randconfig builds with sysfs, procfs and numa all disabled, > but SMP enabled, we now get a link error in the newly introduced > vmstat_refresh function: > > mm/built-in.o: In function `vmstat_refresh': > :(.text+0x15c78): undefined reference to `vmstat_text' > > vmstat_refresh is proc_fs specific so there is no reason to define it > when !CONFIG_PROC_FS. I already had this: From: Christoph Lameter <cl@linux.com> Subject: Do not build vmstat_refresh if there is no procfs support It makes no sense to build functionality into the kernel that cannot be used and causes build issues. Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1605111011260.9351@east.gentwo.org Signed-off-by: Christoph Lameter <cl@linux.com> Reported-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> --- mm/vmstat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff -puN mm/vmstat.c~mm-proc-sys-vm-stat_refresh-to-force-vmstat-update-fix mm/vmstat.c --- a/mm/vmstat.c~mm-proc-sys-vm-stat_refresh-to-force-vmstat-update-fix +++ a/mm/vmstat.c @@ -1371,7 +1371,6 @@ static const struct file_operations proc .llseek = seq_lseek, .release = seq_release, }; -#endif /* CONFIG_PROC_FS */ #ifdef CONFIG_SMP static struct workqueue_struct *vmstat_wq; @@ -1436,7 +1435,10 @@ int vmstat_refresh(struct ctl_table *tab *lenp = 0; return 0; } +#endif /* CONFIG_SMP */ +#endif /* CONFIG_PROC_FS */ +#ifdef CONFIG_SMP static void vmstat_update(struct work_struct *w) { if (refresh_cpu_vm_stats(true)) { _ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP 2016-05-16 22:36 ` Andrew Morton @ 2016-05-17 7:05 ` Michal Hocko 2016-05-18 1:02 ` Hugh Dickins 0 siblings, 1 reply; 10+ messages in thread From: Michal Hocko @ 2016-05-17 7:05 UTC (permalink / raw) To: Andrew Morton Cc: Arnd Bergmann, Hugh Dickins, Vlastimil Babka, Christoph Lameter, Mel Gorman, Joonsoo Kim, linux-mm, linux-kernel On Mon 16-05-16 15:36:56, Andrew Morton wrote: > On Mon, 16 May 2016 16:23:33 +0200 Michal Hocko <mhocko@kernel.org> wrote: > > > Andrew, I think that the following is more straightforward fix and > > should be folded in to the patch which has introduced vmstat_refresh. > > --- > > >From b8dd18fb7df040e1bfe61aadde1d903589de15e4 Mon Sep 17 00:00:00 2001 > > From: Michal Hocko <mhocko@suse.com> > > Date: Mon, 16 May 2016 16:19:53 +0200 > > Subject: [PATCH] mmotm: mm-proc-sys-vm-stat_refresh-to-force-vmstat-update-fix > > > > Arnd has reported: > > In randconfig builds with sysfs, procfs and numa all disabled, > > but SMP enabled, we now get a link error in the newly introduced > > vmstat_refresh function: > > > > mm/built-in.o: In function `vmstat_refresh': > > :(.text+0x15c78): undefined reference to `vmstat_text' > > > > vmstat_refresh is proc_fs specific so there is no reason to define it > > when !CONFIG_PROC_FS. > > I already had this: > > From: Christoph Lameter <cl@linux.com> > Subject: Do not build vmstat_refresh if there is no procfs support > > It makes no sense to build functionality into the kernel that > cannot be used and causes build issues. > > Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1605111011260.9351@east.gentwo.org > Signed-off-by: Christoph Lameter <cl@linux.com> > Reported-by: Arnd Bergmann <arnd@arndb.de> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org> But this is broken: http://lkml.kernel.org/r/20160516073144.GA23146@dhcp22.suse.cz and kbuild robot agrees http://lkml.kernel.org/r/201605171333.ANqJcwpy%fengguang.wu@intel.com > --- > > mm/vmstat.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff -puN mm/vmstat.c~mm-proc-sys-vm-stat_refresh-to-force-vmstat-update-fix mm/vmstat.c > --- a/mm/vmstat.c~mm-proc-sys-vm-stat_refresh-to-force-vmstat-update-fix > +++ a/mm/vmstat.c > @@ -1371,7 +1371,6 @@ static const struct file_operations proc > .llseek = seq_lseek, > .release = seq_release, > }; > -#endif /* CONFIG_PROC_FS */ > > #ifdef CONFIG_SMP > static struct workqueue_struct *vmstat_wq; > @@ -1436,7 +1435,10 @@ int vmstat_refresh(struct ctl_table *tab > *lenp = 0; > return 0; > } > +#endif /* CONFIG_SMP */ > +#endif /* CONFIG_PROC_FS */ > > +#ifdef CONFIG_SMP > static void vmstat_update(struct work_struct *w) > { > if (refresh_cpu_vm_stats(true)) { > _ -- Michal Hocko SUSE Labs ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP 2016-05-17 7:05 ` Michal Hocko @ 2016-05-18 1:02 ` Hugh Dickins 0 siblings, 0 replies; 10+ messages in thread From: Hugh Dickins @ 2016-05-18 1:02 UTC (permalink / raw) To: Andrew Morton Cc: Michal Hocko, Arnd Bergmann, Hugh Dickins, Vlastimil Babka, Christoph Lameter, Mel Gorman, Joonsoo Kim, linux-mm, linux-kernel On Tue, 17 May 2016, Michal Hocko wrote: > On Mon 16-05-16 15:36:56, Andrew Morton wrote: > > On Mon, 16 May 2016 16:23:33 +0200 Michal Hocko <mhocko@kernel.org> wrote: > > > > > Andrew, I think that the following is more straightforward fix and > > > should be folded in to the patch which has introduced vmstat_refresh. > > > --- > > > >From b8dd18fb7df040e1bfe61aadde1d903589de15e4 Mon Sep 17 00:00:00 2001 > > > From: Michal Hocko <mhocko@suse.com> > > > Date: Mon, 16 May 2016 16:19:53 +0200 > > > Subject: [PATCH] mmotm: mm-proc-sys-vm-stat_refresh-to-force-vmstat-update-fix > > > > > > Arnd has reported: > > > In randconfig builds with sysfs, procfs and numa all disabled, > > > but SMP enabled, we now get a link error in the newly introduced > > > vmstat_refresh function: > > > > > > mm/built-in.o: In function `vmstat_refresh': > > > :(.text+0x15c78): undefined reference to `vmstat_text' > > > > > > vmstat_refresh is proc_fs specific so there is no reason to define it > > > when !CONFIG_PROC_FS. > > > > I already had this: > > > > From: Christoph Lameter <cl@linux.com> > > Subject: Do not build vmstat_refresh if there is no procfs support > > > > It makes no sense to build functionality into the kernel that > > cannot be used and causes build issues. > > > > Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1605111011260.9351@east.gentwo.org > > Signed-off-by: Christoph Lameter <cl@linux.com> > > Reported-by: Arnd Bergmann <arnd@arndb.de> > > Signed-off-by: Andrew Morton <akpm@linux-foundation.org> > > But this is broken: > http://lkml.kernel.org/r/20160516073144.GA23146@dhcp22.suse.cz and > kbuild robot agrees > http://lkml.kernel.org/r/201605171333.ANqJcwpy%fengguang.wu@intel.com Sorry for my noise, sorry for my silence, thanks to Arnd and everyone for chipping in. But now I try it, I find that even Michal's is not quite right: if you build without CONFIG_PROC_FS, then it gives you mm/vmstat.c:1381:13: warning: `refresh_vm_stats' defined but not used [-Wunused-function] (well, that was on a tree with different line numbering). So here's my attempt... Signed-off-by: Hugh Dickins <hughd@google.com> --- Fix to merge into mm-proc-sys-vm-stat_refresh-to-force-vmstat-update.patch mm/vmstat.c | 2 ++ 1 file changed, 2 insertions(+) --- 4.6-rc7-mm1/mm/vmstat.c 2016-05-14 08:29:10.609386264 -0700 +++ linux/mm/vmstat.c 2016-05-17 17:43:02.861862648 -0700 @@ -1365,6 +1365,7 @@ static struct workqueue_struct *vmstat_w static DEFINE_PER_CPU(struct delayed_work, vmstat_work); int sysctl_stat_interval __read_mostly = HZ; +#ifdef CONFIG_PROC_FS static void refresh_vm_stats(struct work_struct *work) { refresh_cpu_vm_stats(true); @@ -1422,6 +1423,7 @@ int vmstat_refresh(struct ctl_table *tab *lenp = 0; return 0; } +#endif /* CONFIG_PROC_FS */ static void vmstat_update(struct work_struct *w) { ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-05-18 1:02 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-05-11 14:54 [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP Arnd Bergmann 2016-05-11 15:32 ` Christoph Lameter 2016-05-16 7:31 ` Michal Hocko 2016-05-17 5:31 ` Do not build vmstat_refresh if there is no procfs support kbuild test robot 2016-05-16 7:37 ` [PATCH] mm: unhide vmstat_text definition for CONFIG_SMP Michal Hocko 2016-05-16 13:54 ` Christoph Lameter 2016-05-16 14:23 ` Michal Hocko 2016-05-16 22:36 ` Andrew Morton 2016-05-17 7:05 ` Michal Hocko 2016-05-18 1:02 ` Hugh Dickins
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).