Re: [PATCH] mm: memcontrol: Expose THP events on a per-memcg basis

kbuild test robot
2019-02-01T02:57:33Z

[-- Attachment #1: Type: text/plain, Size: 5540 bytes --]

Hi Chris,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.0-rc4]
[cannot apply to next-20190131]
[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/Chris-Down/mm-memcontrol-Expose-THP-events-on-a-per-memcg-basis/20190201-022143
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 8.2.0-11) 8.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=8.2.0 make.cross ARCH=sh

All errors (new ones prefixed by >>):

mm/memcontrol.c: In function 'memory_stat_show':
>> mm/memcontrol.c:5625:52: error: 'THP_FAULT_ALLOC' undeclared (first use in this function); did you mean 'THP_FILE_ALLOC'?
seq_printf(m, "thp_fault_alloc %lu\n", acc.events[THP_FAULT_ALLOC]);
^~~~~~~~~~~~~~~
THP_FILE_ALLOC
mm/memcontrol.c:5625:52: note: each undeclared identifier is reported only once for each function it appears in
>> mm/memcontrol.c:5627:17: error: 'THP_COLLAPSE_ALLOC' undeclared (first use in this function); did you mean 'THP_FILE_ALLOC'?
acc.events[THP_COLLAPSE_ALLOC]);
^~~~~~~~~~~~~~~~~~
THP_FILE_ALLOC

vim +5625 mm/memcontrol.c

5541
5542 static int memory_stat_show(struct seq_file *m, void *v)
5543 {
5544 struct mem_cgroup *memcg = mem_cgroup_from_css(seq_css(m));
5545 struct accumulated_stats acc;
5546 int i;
5547
5548 /*
5549 * Provide statistics on the state of the memory subsystem as
5550 * well as cumulative event counters that show past behavior.
5551 *
5552 * This list is ordered following a combination of these gradients:
5553 * 1) generic big picture -> specifics and details
5554 * 2) reflecting userspace activity -> reflecting kernel heuristics
5555 *
5556 * Current memory state:
5557 */
5558
5559 memset(&acc, 0, sizeof(acc));
5560 acc.stats_size = MEMCG_NR_STAT;
5561 acc.events_size = NR_VM_EVENT_ITEMS;
5562 accumulate_memcg_tree(memcg, &acc);
5563
5564 seq_printf(m, "anon %llu\n",
5565 (u64)acc.stat[MEMCG_RSS] * PAGE_SIZE);
5566 seq_printf(m, "file %llu\n",
5567 (u64)acc.stat[MEMCG_CACHE] * PAGE_SIZE);
5568 seq_printf(m, "kernel_stack %llu\n",
5569 (u64)acc.stat[MEMCG_KERNEL_STACK_KB] * 1024);
5570 seq_printf(m, "slab %llu\n",
5571 (u64)(acc.stat[NR_SLAB_RECLAIMABLE] +
5572 acc.stat[NR_SLAB_UNRECLAIMABLE]) * PAGE_SIZE);
5573 seq_printf(m, "sock %llu\n",
5574 (u64)acc.stat[MEMCG_SOCK] * PAGE_SIZE);
5575
5576 seq_printf(m, "shmem %llu\n",
5577 (u64)acc.stat[NR_SHMEM] * PAGE_SIZE);
5578 seq_printf(m, "file_mapped %llu\n",
5579 (u64)acc.stat[NR_FILE_MAPPED] * PAGE_SIZE);
5580 seq_printf(m, "file_dirty %llu\n",
5581 (u64)acc.stat[NR_FILE_DIRTY] * PAGE_SIZE);
5582 seq_printf(m, "file_writeback %llu\n",
5583 (u64)acc.stat[NR_WRITEBACK] * PAGE_SIZE);
5584
5585 /*
5586 * TODO: We should eventually replace our own MEMCG_RSS_HUGE counter
5587 * with the NR_ANON_THP vm counter, but right now it's a pain in the
5588 * arse because it requires migrating the work out of rmap to a place
5589 * where the page->mem_cgroup is set up and stable.
5590 */
5591 seq_printf(m, "anon_thp %llu\n",
5592 (u64)acc.stat[MEMCG_RSS_HUGE] * PAGE_SIZE);
5593
5594 for (i = 0; i < NR_LRU_LISTS; i++)
5595 seq_printf(m, "%s %llu\n", mem_cgroup_lru_names[i],
5596 (u64)acc.lru_pages[i] * PAGE_SIZE);
5597
5598 seq_printf(m, "slab_reclaimable %llu\n",
5599 (u64)acc.stat[NR_SLAB_RECLAIMABLE] * PAGE_SIZE);
5600 seq_printf(m, "slab_unreclaimable %llu\n",
5601 (u64)acc.stat[NR_SLAB_UNRECLAIMABLE] * PAGE_SIZE);
5602
5603 /* Accumulated memory events */
5604
5605 seq_printf(m, "pgfault %lu\n", acc.events[PGFAULT]);
5606 seq_printf(m, "pgmajfault %lu\n", acc.events[PGMAJFAULT]);
5607
5608 seq_printf(m, "workingset_refault %lu\n",
5609 acc.stat[WORKINGSET_REFAULT]);
5610 seq_printf(m, "workingset_activate %lu\n",
5611 acc.stat[WORKINGSET_ACTIVATE]);
5612 seq_printf(m, "workingset_nodereclaim %lu\n",
5613 acc.stat[WORKINGSET_NODERECLAIM]);
5614
5615 seq_printf(m, "pgrefill %lu\n", acc.events[PGREFILL]);
5616 seq_printf(m, "pgscan %lu\n", acc.events[PGSCAN_KSWAPD] +
5617 acc.events[PGSCAN_DIRECT]);
5618 seq_printf(m, "pgsteal %lu\n", acc.events[PGSTEAL_KSWAPD] +
5619 acc.events[PGSTEAL_DIRECT]);
5620 seq_printf(m, "pgactivate %lu\n", acc.events[PGACTIVATE]);
5621 seq_printf(m, "pgdeactivate %lu\n", acc.events[PGDEACTIVATE]);
5622 seq_printf(m, "pglazyfree %lu\n", acc.events[PGLAZYFREE]);
5623 seq_printf(m, "pglazyfreed %lu\n", acc.events[PGLAZYFREED]);
5624
> 5625 seq_printf(m, "thp_fault_alloc %lu\n", acc.events[THP_FAULT_ALLOC]);
5626 seq_printf(m, "thp_collapse_alloc %lu\n",
> 5627 acc.events[THP_COLLAPSE_ALLOC]);
5628
5629 return 0;
5630 }
5631

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 50869 bytes --]