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] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 14 Oct 2010 02:07:44 -0700
From:	Paul Turner <pjt@...gle.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	bharata@...ux.vnet.ibm.com, linux-kernel@...r.kernel.org,
	Dhaval Giani <dhaval.giani@...il.com>,
	Balbir Singh <balbir@...ux.vnet.ibm.com>,
	Vaidyanathan Srinivasan <svaidy@...ux.vnet.ibm.com>,
	Srivatsa Vaddagiri <vatsa@...ibm.com>,
	Kamalesh Babulal <kamalesh@...ux.vnet.ibm.com>,
	Ingo Molnar <mingo@...e.hu>,
	Pavel Emelyanov <xemul@...nvz.org>,
	Herbert Poetzl <herbert@...hfloor.at>,
	Avi Kivity <avi@...hat.com>,
	Chris Friesen <cfriesen@...tel.com>,
	Paul Menage <menage@...gle.com>,
	Mike Waychison <mikew@...gle.com>,
	Nikhil Rao <ncrao@...gle.com>
Subject: Re: [PATCH v3 2/7] sched: accumulate per-cfs_rq cpu usage

On Thu, Oct 14, 2010 at 1:57 AM, Peter Zijlstra <peterz@...radead.org> wrote:
> On Tue, 2010-10-12 at 13:21 +0530, Bharata B Rao wrote:
>> +static u64 tg_request_cfs_quota(struct task_group *tg)
>> +{
>> +       struct cfs_bandwidth *cfs_b = tg_cfs_bandwidth(tg);
>> +       u64 delta = 0;
>> +
>> +       if (cfs_b->runtime > 0 || cfs_b->quota == RUNTIME_INF) {
>> +               raw_spin_lock(&cfs_b->lock);
>> +               /*
>> +                * it's possible a bandwidth update has changed the global
>> +                * pool.
>> +                */
>> +               if (cfs_b->quota == RUNTIME_INF)
>> +                       delta = sched_cfs_bandwidth_slice();
>> +               else {
>> +                       delta = min(cfs_b->runtime,
>> +                                       sched_cfs_bandwidth_slice());
>> +                       cfs_b->runtime -= delta;
>> +               }
>> +               raw_spin_unlock(&cfs_b->lock);
>> +       }
>> +       return delta;
>> +}
>
> Since you check cfs_b->quote outside of cfs_b->lock anyway, you might as
> well avoid taking the lock in that case and directly return slice.
>

Do you mean in the RUNTIME_INF case?

I suppose we could just avoid taking the lock there (theoretically it
would be possible to slightly over-commit on a RUNTIME_INF =>
constrained transition, but this should be the supremely uncommon case
and hey, it's transitioning from unlimited bandwidth anyway).

> Also, you possibly evaluate sched_cfs_bandwidth_slice() twice.
>

Separate branch no?  Should only be one evaluation.  (fwiw the min
macro looks to cache the evaluation)
--
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