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]
Date:	Thu, 12 Mar 2009 10:14:39 +0530
From:	Bharata B Rao <bharata@...ux.vnet.ibm.com>
To:	Balbir Singh <balbir@...ux.vnet.ibm.com>
Cc:	linux-kernel@...r.kernel.org, Balaji Rao <balajirrao@...il.com>,
	Dhaval Giani <dhaval@...ux.vnet.ibm.com>,
	Li Zefan <lizf@...fujitsu.com>,
	Paul Menage <menage@...gle.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Ingo Molnar <mingo@...e.hu>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Subject: Re: [RFC PATCH] cpuacct: per-cgroup utime/stime statistics - v1

On Wed, Mar 11, 2009 at 08:46:57PM +0530, Balbir Singh wrote:
> * Bharata B Rao <bharata@...ux.vnet.ibm.com> [2009-03-10 18:12:08]:
> 
> Hi, Bharata,
> 
> I did a quick run of the patch on my machine. The patch applied and
> compile cleanly, here are a few comments?
> 
> 1. We could consider enhancing the patch to account for irq, softirq,
> etc time like cpustat does. Not right away, but iteratively

Yes that should not be a problem. We can add those easily if needed.

> 2. The accounting is converted to milliseconds, I would much rather
> export it in cputime to be consistent with other cpu accounting.
> I remember we used to return nanosecond accurate accounting and then
> moved to cputime based accounting for cpuacct.

Ok had thought about it but was hesitant to do because that makes
percpu_counters to work directly on cputime_t type. But I guess that is fine.

> 3. How do we deal with CPU hotplug. Since we use a per-cpu counter,
> any hotplug would mean that the data related to the offlined CPU is
> lost. That is how the current CPU accounting system seems to work.

Not a problem as percpu_counter handles hotplug events as you noted
in the other thread.

> > 
> > @@ -9462,20 +9479,33 @@ static struct cgroup_subsys_state *cpuac
> >  	struct cgroup_subsys *ss, struct cgroup *cgrp)
> >  {
> >  	struct cpuacct *ca = kzalloc(sizeof(*ca), GFP_KERNEL);
> > +	int i;
> > 
> >  	if (!ca)
> > -		return ERR_PTR(-ENOMEM);
> > +		goto out1;
> > 
> >  	ca->cpuusage = alloc_percpu(u64);
> > -	if (!ca->cpuusage) {
> > -		kfree(ca);
> > -		return ERR_PTR(-ENOMEM);
> > -	}
> > +	if (!ca->cpuusage)
> > +		goto out2;
> > +
> > +	for (i = 0; i < CPUACCT_STAT_NSTATS; i++)
> > +		if (percpu_counter_init(&ca->cpustat[i], 0))
> > +			goto out3;
> > 
> >  	if (cgrp->parent)
> >  		ca->parent = cgroup_ca(cgrp->parent);
> > 
> >  	return &ca->css;
> > +
> > +out3:
> > +	i--;
> > +	while (i-- >= 0)
> > +		percpu_counter_destroy(&ca->cpustat[i]);
> > +	free_percpu(ca->cpuusage);
> > +out2:
> > +	kfree(ca);
> > +out1:
> > +	return ERR_PTR(-ENOMEM);
> >  }
> >
> 
> Don't like out* as labels, please let us have more meaningful labels.

Ok, I can change them if you don't like out* labels :)

Regards,
Bharata.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ