lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZoLkhvoXZhoYLWsc@slm.duckdns.org>
Date: Mon, 1 Jul 2024 07:16:54 -1000
From: Tejun Heo <tj@...nel.org>
To: Chen Ridong <chenridong@...wei.com>
Cc: lizefan.x@...edance.com, hannes@...xchg.org, longman@...hat.com,
	cgroups@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] cgroup/rstat: add force idle show helper

Hello,

On Mon, Jul 01, 2024 at 02:04:41PM +0000, Chen Ridong wrote:
> +#ifdef CONFIG_SCHED_CORE
> +static void cgroup_force_idle_show(struct seq_file *seq, struct cgroup_base_stat bstat)

Please pass bstat as a pointer. We don't want to copy the whole thing on
stack.

> +{
> +	u64 forceidle_time = bstat.forceidle_sum;
> +
> +	do_div(forceidle_time, NSEC_PER_USEC);
> +	seq_printf(seq, "core_sched.force_idle_usec %llu\n", forceidle_time);
> +}
> +#endif

And maybe move #ifdef and #endif inside the function body so that we don't
need #ifdef in the caller?

>  void cgroup_base_stat_cputime_show(struct seq_file *seq)
>  {
>  	struct cgroup *cgrp = seq_css(seq)->cgroup;
>  	u64 usage, utime, stime;
>  	struct cgroup_base_stat bstat;
> -#ifdef CONFIG_SCHED_CORE
> -	u64 forceidle_time;
> -#endif
>  
>  	if (cgroup_parent(cgrp)) {
>  		cgroup_rstat_flush_hold(cgrp);
>  		usage = cgrp->bstat.cputime.sum_exec_runtime;
>  		cputime_adjust(&cgrp->bstat.cputime, &cgrp->prev_cputime,
>  			       &utime, &stime);
> -#ifdef CONFIG_SCHED_CORE
> -		forceidle_time = cgrp->bstat.forceidle_sum;
> -#endif
> +		stat = cgrp->bstat;

Where is @stat defined? Is the patch even compile tested?

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ