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, 30 Oct 2008 10:34:16 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	David Rientjes <rientjes@...gle.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Christoph Lameter <cl@...ux-foundation.org>,
	Nick Piggin <npiggin@...e.de>, Paul Menage <menage@...gle.com>,
	Derek Fults <dfults@....com>, linux-kernel@...r.kernel.org
Subject: Re: [patch 6/7] cpusets: per cpuset dirty ratios

On Thu, 2008-10-30 at 02:03 -0700, David Rientjes wrote:
> On Thu, 30 Oct 2008, Peter Zijlstra wrote:
> 
> > On Tue, 2008-10-28 at 09:08 -0700, David Rientjes wrote:
> > 
> > > +/*
> > > + * Determine the dirty ratios for the currently active cpuset
> > > + */
> > > +void cpuset_get_current_dirty_ratios(int *background, int *throttle)
> > > +{
> > > +	mutex_lock(&callback_mutex);
> > > +	task_lock(current);
> > > +	*background = task_cs(current)->dirty_background_ratio;
> > > +	*throttle = task_cs(current)->cpuset_dirty_ratio;
> > > +	task_unlock(current);
> > > +	mutex_unlock(&callback_mutex);
> > > +
> > > +	if (*background == -1)
> > > +		*background = dirty_background_ratio;
> > > +	if (*throttle == -1)
> > > +		*throttle = vm_dirty_ratio;
> > > +}
> > 
> > That's rather an awful lot of locking to read just two integers.
> > 
> 
> As far as I know, task_lock(current) is required to dereference 
> task_cs(current) and callback_mutex is required to ensure its the same 
> cpuset.

Since we read these things for every evaluation, getting it wrong isn't
too harmful.

So I would suggest just enough locking to ensure we don't reference any
NULL pointers and such.

IIRC the cpuset stuff is RCU freed, so some racy read should be
possible, no?
--
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