Hi zhangq95, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v4.17-rc3] [cannot apply to cgroup/for-next] [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/zhangq95/Add-a-file-named-cgroup-procs_stat-in-cgroup/20180505-115518 config: i386-randconfig-x014-201817 (attached as .config) compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386 All error/warnings (new ones prefixed by >>): kernel//cgroup/cgroup-v1.c: In function 'cgroup_procs_stat_show': >> kernel//cgroup/cgroup-v1.c:634:11: warning: return makes integer from pointer without a cast [-Wint-conversion] return ERR_PTR(ret); ^~~~~~~~~~~~ >> kernel//cgroup/cgroup-v1.c:645:21: error: 'cpuset_cgrp_id' undeclared (first use in this function); did you mean 'cpuset_init'? if (task_css(tsk, cpuset_cgrp_id)) { ^~~~~~~~~~~~~~ cpuset_init kernel//cgroup/cgroup-v1.c:645:21: note: each undeclared identifier is reported only once for each function it appears in >> kernel//cgroup/cgroup-v1.c:647:4: error: implicit declaration of function 'get_tsk_cpu_allowed'; did you mean 'do_set_cpus_allowed'? [-Werror=implicit-function-declaration] get_tsk_cpu_allowed(tsk, &cpus_allowed); ^~~~~~~~~~~~~~~~~~~ do_set_cpus_allowed >> kernel//cgroup/cgroup-v1.c:655:5: error: 'CPUACCT_PROCS_SWITCHES' undeclared (first use in this function) CPUACCT_PROCS_SWITCHES, 0); ^~~~~~~~~~~~~~~~~~~~~~ >> kernel//cgroup/cgroup-v1.c:657:5: error: 'CPUACCT_PROCS_FORKS' undeclared (first use in this function); did you mean 'CPUACCT_PROCS_SWITCHES'? CPUACCT_PROCS_FORKS, 0); ^~~~~~~~~~~~~~~~~~~ CPUACCT_PROCS_SWITCHES >> kernel//cgroup/cgroup-v1.c:659:5: error: 'CPUACCT_PROCS_RUNNING' undeclared (first use in this function); did you mean 'CPUACCT_PROCS_FORKS'? CPUACCT_PROCS_RUNNING, 0); ^~~~~~~~~~~~~~~~~~~~~ CPUACCT_PROCS_FORKS >> kernel//cgroup/cgroup-v1.c:661:5: error: 'CPUACCT_PROCS_IOWAIT' undeclared (first use in this function); did you mean 'CPUACCT_PROCS_FORKS'? CPUACCT_PROCS_IOWAIT, 0); ^~~~~~~~~~~~~~~~~~~~ CPUACCT_PROCS_FORKS cc1: some warnings being treated as errors -- kernel//sched/core.c: In function '__schedule': >> kernel//sched/core.c:3417:5: error: 'CPUACCT_PROCS_SWITCHES' undeclared (first use in this function) CPUACCT_PROCS_SWITCHES, 1, 0); ^~~~~~~~~~~~~~~~~~~~~~ kernel//sched/core.c:3417:5: note: each undeclared identifier is reported only once for each function it appears in -- kernel//sched/fair.c: In function 'enqueue_task_fair': >> kernel//sched/fair.c:5401:3: error: implicit declaration of function 'update_cpuacct_running_from_cfs'; did you mean 'update_cpuacct_running_from_tg'? [-Werror=implicit-function-declaration] update_cpuacct_running_from_cfs(cfs_rq, 1); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ update_cpuacct_running_from_tg cc1: some warnings being treated as errors -- kernel//sched/rt.c: In function 'enqueue_task_rt': >> kernel//sched/rt.c:1330:43: error: 'CPUACCT_PROCS_RUNNING' undeclared (first use in this function) update_cpuacct_procs_stat(p, cpu_of(rq), CPUACCT_PROCS_RUNNING, 1, 0); ^~~~~~~~~~~~~~~~~~~~~ kernel//sched/rt.c:1330:43: note: each undeclared identifier is reported only once for each function it appears in kernel//sched/rt.c: In function 'dequeue_task_rt': kernel//sched/rt.c:1342:43: error: 'CPUACCT_PROCS_RUNNING' undeclared (first use in this function) update_cpuacct_procs_stat(p, cpu_of(rq), CPUACCT_PROCS_RUNNING, -1, 0); ^~~~~~~~~~~~~~~~~~~~~ vim +645 kernel//cgroup/cgroup-v1.c 609 610 static int cgroup_procs_stat_show(struct seq_file *s, void *v) 611 { 612 struct kernfs_open_file *of = s->private; 613 struct cgroup *cgrp = seq_css(s)->cgroup; 614 struct cgroup_pidlist *l; 615 enum cgroup_filetype type = seq_cft(s)->private; 616 struct task_struct *tsk; 617 int ret, i = 0, j = 0, tmp = 0; 618 unsigned long forks = 0, iowait = 0, nr_runnable = 0; 619 pid_t *start; 620 struct timespec64 boottime; 621 unsigned long long start_time, switches = 0; 622 unsigned long per_softirq_nums[NR_SOFTIRQS] = {0}; 623 unsigned long sum_softirq = 0; 624 struct cpumask cpus_allowed; 625 626 mutex_lock(&cgrp->pidlist_mutex); 627 if (of->priv) 628 of->priv = cgroup_pidlist_find(cgrp, type); 629 630 if (!of->priv) { 631 ret = pidlist_array_load(cgrp, type, 632 (struct cgroup_pidlist **)&of->priv); 633 if (ret) > 634 return ERR_PTR(ret); 635 } 636 l = of->priv; 637 638 start = l->list; 639 640 tsk = find_task_by_pid_ns(*start, &init_pid_ns); 641 getboottime64(&boottime); 642 643 if (in_noninit_pid_ns(tsk) && 644 task_in_nonroot_cpuacct(tsk)) { > 645 if (task_css(tsk, cpuset_cgrp_id)) { 646 memset(&cpus_allowed, 0, sizeof(cpus_allowed)); > 647 get_tsk_cpu_allowed(tsk, &cpus_allowed); 648 } 649 650 start_time = tsk->real_start_time / NSEC_PER_SEC; 651 start_time += (unsigned long long)boottime.tv_sec; 652 653 for_each_cpu_and(i, cpu_possible_mask, &cpus_allowed) { 654 switches += task_ca_procs_stat(tsk, i, > 655 CPUACCT_PROCS_SWITCHES, 0); 656 forks += task_ca_procs_stat(tsk, i, > 657 CPUACCT_PROCS_FORKS, 0); 658 nr_runnable += task_ca_procs_stat(tsk, i, > 659 CPUACCT_PROCS_RUNNING, 0); 660 iowait += task_ca_procs_stat(tsk, i, > 661 CPUACCT_PROCS_IOWAIT, 0); 662 663 for (j = 0; j < NR_SOFTIRQS; j++) { 664 tmp = task_ca_procs_stat(tsk, i, j, 1); 665 per_softirq_nums[j] += tmp; 666 sum_softirq += tmp; 667 } 668 } 669 670 } else { 671 cpumask_copy(&cpus_allowed, cpu_possible_mask); 672 nr_runnable = nr_running(); 673 forks = total_forks; 674 iowait = nr_iowait(); 675 switches = nr_context_switches(); 676 start_time = (unsigned long long)boottime.tv_sec; 677 678 for (j = 0; j < NR_SOFTIRQS; j++) { 679 unsigned long softirq_stat = kstat_softirqs_cpu(j, i); 680 681 per_softirq_nums[j] += softirq_stat; 682 sum_softirq += softirq_stat; 683 } 684 } 685 686 seq_printf(s, "softirq %lu ", sum_softirq); 687 for (j = 0; j < NR_SOFTIRQS; j++) 688 seq_printf(s, "%lu ", per_softirq_nums[j]); 689 690 seq_puts(s, "\n"); 691 seq_printf(s, 692 "ctxt %llu\n" 693 "btime %llu\n" 694 "processes %lu\n" 695 "procs_running %lu\n" 696 "procs_blocked %lu\n", 697 switches, 698 start_time, 699 forks, 700 nr_runnable, 701 iowait); 702 703 mod_delayed_work(cgroup_pidlist_destroy_wq, &l->destroy_dwork, 704 CGROUP_PIDLIST_DESTROY_DELAY); 705 mutex_unlock(&cgrp->pidlist_mutex); 706 707 return 0; 708 } 709 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation