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, 11 Sep 2008 08:04:58 -0700
From:	Mike Travis <travis@....com>
To:	Peter Zijlstra <peterz@...radead.org>
CC:	Ingo Molnar <mingo@...e.hu>,
	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

Peter Zijlstra wrote:
...
>> So in function prototypes:
>>
>> 	cpumask_t function(const cpumask_t *A,
>> 			   cpumask_t *B,
>> 			   cpumask_t cpumask_C)
>>
>> becomes:
>>
>> 	cpumask_val function(cpumask_t A,
>> 			     cpumask_var B,
>> 			     cpumask_t cpumask_C)
> 
> I guess we have to stick the const into the typedef otherwise we get a
> const pointer instead of a const array member, right?
> 
> In which case I much prefer the following names:
> 
>  cpumask_data_t  - value
> 
>  const_cpumask_t - pointer to constant value
>  cpumask_t       - pointer to value

There were some comments previously such that we should "imply" that the
incoming cpumask_t args are const, so the compiler would flag those
who arbitrarily modify it.

> 
...
>> 	alloc_cpumask(&mask);
> 
> Don't you have to deal with allocation errors?

In a perfect world, no... ;-)
...
>> 	static inline void alloc_cpumask(cpumask_t *m)
>> 	{
>> 		cpumask_t d = kmalloc(BYTES_PER_CPUMASK, GFP_KERNEL);
>> 		if (no_cpumask(&d))
>> 			BUG();
> 
> yuckery yuck yuck!
> 
>> 		*m = d;
>> 	}
>>
>> 	static inline void alloc_cpumask_nopanic(cpumask_t *m)
>> 	{
>> 		cpumask_t d = kmalloc(BYTES_PER_CPUMASK, GFP_KERNEL);
>>
>> 		*m = d;
>> 	}
> 
> gah - at the very least you got the naming wrong, methinks the one
> panic-ing should have panic in its name - if you really want to persist
> with that variant.

Yeah, I rather rushed through the allocation part (yuck indeed ;-).

There are some other alternatives:

	- reserve one or more of these in the task struct
	- reserve one or more in a per-cpu area
	- setup some kind of allocation pool similar to alloc_bootmem
	- ???

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