All of lore.kernel.org
 help / color / mirror / Atom feed
* [opencloudos:next 77/98] kernel/cgroup/cpuset.c:3184:5: warning: no previous prototype for 'cpuset_cgroupfs_stat_cpuacct'
@ 2024-03-03 14:47 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-03-03 14:47 UTC (permalink / raw)
  To: jasperwang, kaixuxia, frankjpliu, kasong, sagazchen, kernelxing,
	aurelianliu, jason.zeng, wu.zheng, yingbao.jia, pei.p.jia
  Cc: oe-kbuild-all

tree:   https://gitee.com/OpenCloudOS/OpenCloudOS-Kernel.git next
head:   a4b2dc2ffad1810ebe7a86710aa1e5cc312aa2a1
commit: a4793456cf4437284a72e89d0ea5c991b0d4248c [77/98] cgroupfs: support stat based on cpuacct
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240303/202403032204.MATw06EB-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240303/202403032204.MATw06EB-lkp@intel.com/reproduce)

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/202403032204.MATw06EB-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> kernel/cgroup/cpuset.c:3184:5: warning: no previous prototype for 'cpuset_cgroupfs_stat_cpuacct' [-Wmissing-prototypes]
    3184 | int cpuset_cgroupfs_stat_cpuacct(struct cpuset *cs, struct seq_file *m, void *v, int max_cpu)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/cgroup/cpuset.c:3299:5: warning: no previous prototype for 'cpuset_cgroupfs_stat_show' [-Wmissing-prototypes]
    3299 | int cpuset_cgroupfs_stat_show(struct seq_file *m, void *v)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/cgroup/cpuset.c:3473:5: warning: no previous prototype for 'cpuset_cgroups_cpu_allowed' [-Wmissing-prototypes]
    3473 | int cpuset_cgroups_cpu_allowed(struct task_struct *task, int cpu, int once)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/cgroup/cpuset.c:3503:5: warning: no previous prototype for 'cpuset_cgroupfs_cpuinfo_show' [-Wmissing-prototypes]
    3503 | int cpuset_cgroupfs_cpuinfo_show(struct seq_file *m, void *v)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> kernel/cgroup/cpuset.c:3518:5: warning: no previous prototype for 'cpuset_cgroupfs_get_cpu_count' [-Wmissing-prototypes]
    3518 | int cpuset_cgroupfs_get_cpu_count(void)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/cgroup/cpuset.c:4898:6: warning: no previous prototype for 'cgroup_cpuset_calc_load' [-Wmissing-prototypes]
    4898 | void cgroup_cpuset_calc_load(void)
         |      ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/cgroup/cpuset.c:4972:5: warning: no previous prototype for 'cpuset_cgroupfs_loadavg_show' [-Wmissing-prototypes]
    4972 | int cpuset_cgroupfs_loadavg_show(struct seq_file *m, void *v)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from kernel/sched/build_utility.c:61:
   kernel/sched/cpuacct.c:322:5: warning: no previous prototype for 'cpuacct_cgroupfs_uptime_show' [-Wmissing-prototypes]
     322 | int cpuacct_cgroupfs_uptime_show(struct seq_file *m, void *v)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> kernel/sched/cpuacct.c:336:5: warning: no previous prototype for 'cpuacct_cgroupfs_cpu_usage' [-Wmissing-prototypes]
     336 | int cpuacct_cgroupfs_cpu_usage(struct cgroup_subsys_state *css, int cpu, u64 *sys, u64 *user)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/cpuset_cgroupfs_stat_cpuacct +3184 kernel/cgroup/cpuset.c

  3181	
  3182	#ifdef CONFIG_CGROUPFS
  3183	extern int cpuacct_cgroupfs_cpu_usage(struct cgroup_subsys_state *css, int cpu, u64 *sys, u64 *user);
> 3184	int cpuset_cgroupfs_stat_cpuacct(struct cpuset *cs, struct seq_file *m, void *v, int max_cpu)
  3185	{
  3186		typedef struct usage_info {
  3187			u64 sys, usr, idle;
  3188		} u_info;
  3189	
  3190		u_info *res;
  3191		struct timespec64 boottime;
  3192		struct cgroup_subsys_state *css;
  3193		u64 sys, usr, cpu_total, cpu_idle, acct_total, total_sys, total_usr, total_idle;
  3194		u64 n_ctx_switch, n_process, n_running, n_blocked;
  3195		int i, k = 0, num_cpu = nr_cpu_ids + 1;;
  3196		total_sys = 0, total_usr = 0, total_idle = 0;
  3197	
  3198		res = kmalloc(sizeof(u_info) * num_cpu, GFP_KERNEL);
  3199		if (!res)
  3200			return -ENOMEM;
  3201		getboottime64(&boottime);
  3202		/*
  3203		 * Tasks can run on any cpu of cpuset, consider with quota,
  3204		 * cpu number listed in stat may be less than cpuset, leading sum of usages
  3205		 * of each cpus less than total. To make sum of usage of each cpu equal to total,
  3206		 * set quota_aware=0 or configure quota equal to cpuset num.
  3207		 */
  3208		css = task_get_css(current, cpuacct_cgrp_id);
  3209		for_each_cpu(i, cs->cpus_allowed) {
  3210			struct kernel_cpustat kcs;
  3211			kcpustat_cpu_fetch(&kcs, i);
  3212	
  3213			++k;
  3214			cpu_total = 0;
  3215			cpu_idle = get_idle_time(&kcs, i);
  3216			cpu_total += kcpustat_cpu(i).cpustat[CPUTIME_USER];
  3217			cpu_total += kcpustat_cpu(i).cpustat[CPUTIME_NICE];
  3218			cpu_total += kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM];
  3219			cpu_total += get_iowait_time(i);
  3220			cpu_total += kcpustat_cpu(i).cpustat[CPUTIME_IRQ];
  3221			cpu_total += kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ];
  3222			cpu_total += kcpustat_cpu(i).cpustat[CPUTIME_STEAL];
  3223			cpu_total += kcpustat_cpu(i).cpustat[CPUTIME_GUEST];
  3224			cpu_total += kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE];
  3225			cpuacct_cgroupfs_cpu_usage(css, i, &sys, &usr);
  3226			acct_total = sys + usr;
  3227			if (cpu_total > acct_total)
  3228				cpu_idle = cpu_idle + (cpu_total - acct_total);
  3229			total_sys += sys;
  3230			total_usr += usr;
  3231			total_idle += cpu_idle;
  3232			if (k < num_cpu) {
  3233				res[k].sys = sys;
  3234				res[k].usr = usr;
  3235				res[k].idle = cpu_idle;
  3236			}
  3237		}
  3238		css_put(css);
  3239		res[0].sys = total_sys;
  3240		res[0].usr = total_usr;
  3241		res[0].idle = total_idle;
  3242		for (i = 0; i <= k && i <= max_cpu; i++) {
  3243			if (!i)
  3244				seq_printf(m, "cpu ");
  3245			else
  3246				seq_printf(m, "cpu%d", i - 1);
  3247			seq_put_decimal_ull(m, " ", nsec_to_clock_t(res[i].usr));
  3248			seq_put_decimal_ull(m, " ", 0);
  3249			seq_put_decimal_ull(m, " ", nsec_to_clock_t(res[i].sys));
  3250			seq_put_decimal_ull(m, " ", nsec_to_clock_t(res[i].idle));
  3251			seq_put_decimal_ull(m, " ", 0);
  3252			seq_put_decimal_ull(m, " ", 0);
  3253			seq_put_decimal_ull(m, " ", 0);
  3254			seq_put_decimal_ull(m, " ", 0);
  3255			seq_put_decimal_ull(m, " ", 0);
  3256			seq_put_decimal_ull(m, " ", 0);
  3257			seq_putc(m, '\n');
  3258		}
  3259		kfree(res);
  3260		seq_put_decimal_ull(m, "intr ", 0);
  3261		for_each_irq_nr(i)
  3262			seq_put_decimal_ull(m, " ", 0);
  3263	
  3264		n_ctx_switch = 0;
  3265		n_process = 0;
  3266		n_running = 0;
  3267		n_blocked = 0;
  3268		k = 0;
  3269		for_each_cpu(i, cs->cpus_allowed) {
  3270			if (++k > max_cpu)
  3271				break;
  3272			n_ctx_switch += nr_context_switches_cpu(i);
  3273			n_process += per_cpu(total_forks, i);
  3274			n_running += nr_running_cpu(i);
  3275			n_blocked += nr_iowait_cpu(i);
  3276		}
  3277		seq_printf(m,
  3278			"\nctxt %llu\n"
  3279			"btime %llu\n"
  3280			"processes %llu\n"
  3281			"procs_running %llu\n"
  3282			"procs_blocked %llu\n",
  3283			n_ctx_switch,
  3284			(unsigned long long)boottime.tv_sec,
  3285			n_process,
  3286			n_running,
  3287			n_blocked);
  3288	
  3289		seq_put_decimal_ull(m, "softirq ", 0);
  3290	
  3291		for (i = 0; i < NR_SOFTIRQS; i++)
  3292			seq_put_decimal_ull(m, " ", 0);
  3293		seq_putc(m, '\n');
  3294	
  3295		return 0;
  3296	}
  3297	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-03 14:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-03 14:47 [opencloudos:next 77/98] kernel/cgroup/cpuset.c:3184:5: warning: no previous prototype for 'cpuset_cgroupfs_stat_cpuacct' kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.