Re: Do not build vmstat_refresh if there is no procfs support

From: kbuild test robot
Date: Tue May 17 2016 - 01:32:37 EST


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@xxxxxxxx>
:::::: 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