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:	Fri, 12 Sep 2008 07:28:56 -0700
From:	Mike Travis <travis@....com>
To:	Rusty Russell <rusty@...tcorp.com.au>
CC:	Ingo Molnar <mingo@...e.hu>, Peter Zijlstra <peterz@...radead.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	davej@...emonkey.org.uk, David Miller <davem@...emloft.net>,
	Eric Dumazet <dada1@...mosbay.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Jack Steiner <steiner@....com>,
	Jeremy Fitzhardinge <jeremy@...p.org>,
	Jes Sorensen <jes@....com>, "H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	linux-kernel@...r.kernel.org,
	Christoph Lameter <cl@...ux-foundation.org>,
	Andi Kleen <andi@...stfloor.org>
Subject: Re: [RFC] CPUMASK: proposal for replacing cpumask_t

Rusty Russell wrote:
> On Thursday 11 September 2008 08:47:58 Mike Travis wrote:
>> Here's an initial proposal for abstracting cpumask_t to be either
>> an array of 1 or a pointer to an array...   Hopefully this will
>> minimize the amount of code changes while providing the capabilities
>> this change is attempting to do.
>>
>> Comments most welcome. ;-)
> 
> I think this is still "wrong way go back".
> 
> I'm yet to be convinced that we really need to allocate cpumasks in any fast 
> paths.  And if not, we should simply allocate them everywhere.  I'd rather 
> see one #ifdef around a place where we can show a perf issue.
> 
> Get rid of CPU_MASK_ALL et al in favour of cpu_mask_all.  And cpu_mask_any_one 
> instead of CPU_MASK_CPU0 since that's usually what they want.
> 
> API looks like so (look Ma, no typedefs!)
> 
> 	struct cpumask *cpus;
> 
> 	cpus = cpumask_alloc();
> 	if (!cpus)
> 		return -ENOMEM;
> 
> 	cpumask_init_single(cpunum);
> 	OR
> 	cpumask_init(cpu_mask_all);
> 	...
> 	cpumask_free(cpus);
> 
> Unmistakable and really hard to screw up.  You can even be clever and not 
> reveal the struct cpumask definition so noone can declare one by accident...
> 
> Cheers,
> Rusty.

Using a typedef came from Linus, and the idea is basically if NR_CPUS fits
into a long, then it's carried as an array of one (ie., local variable).
If it's bigger, then it's a pointer to a remote array.  The references can
all be pointers (*cpumask), though most of the references use the cpu_XXX
operators which already treat the references correctly (in my proposal,
that is).  That way, small systems can optimize out the indirect reference
and the overhead becomes zero.

Also, cpumask_alloc/free() becomes nop's for small systems.

But I like the idea of dumping some of the initializers.  I should have
made CPU0 "cpumask_of_cpu(0)".  I'll have to look at where they are used to
see if this is feasible.

Thanks!
Mike
--
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