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]
Message-ID: <87egnbmamr.fsf@rasmusvillemoes.dk>
Date:	Thu, 23 Apr 2015 11:55:56 +0200
From:	Rasmus Villemoes <linux@...musvillemoes.dk>
To:	Gavin Guo <gavin.guo@...onical.com>
Cc:	cl@...ux.com, penberg@...nel.org, rientjes@...gle.com,
	iamjoonsoo.kim@....com, akpm@...ux-foundation.org,
	linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] mm/slab_common: Support the slub_debug boot option on specific object size

On Wed, Apr 22 2015, Gavin Guo <gavin.guo@...onical.com> wrote:

>  	/*
> +	 * The kmalloc_names is for temporary usage to make
> +	 * slub_debug=,kmalloc-xx option work in the boot time. The
> +	 * kmalloc_index() support to 2^26=64MB. So, the final entry of the
> +	 * table is kmalloc-67108864.
> +	 */
> +	static const char *kmalloc_names[] = {

The array itself could be const, but more importantly it should be
marked __initconst so that the 27*sizeof(char*) bytes can be released after init.

> +		"0",			"kmalloc-96",		"kmalloc-192",
> +		"kmalloc-8",		"kmalloc-16",		"kmalloc-32",
> +		"kmalloc-64",		"kmalloc-128",		"kmalloc-256",
> +		"kmalloc-512",		"kmalloc-1024",		"kmalloc-2048",
> +		"kmalloc-4196",		"kmalloc-8192",		"kmalloc-16384",

"kmalloc-4096"

> +		"kmalloc-32768",	"kmalloc-65536",
> +		"kmalloc-131072",	"kmalloc-262144",
> +		"kmalloc-524288",	"kmalloc-1048576",
> +		"kmalloc-2097152",	"kmalloc-4194304",
> +		"kmalloc-8388608",	"kmalloc-16777216",
> +		"kmalloc-33554432",	"kmalloc-67108864"
> +	};

On Wed, Apr 22 2015, Andrew Morton <akpm@...ux-foundation.org> wrote:

> You could do something like
>
> 		kmalloc_caches[i] = create_kmalloc_cache(
> 					kmalloc_names[i],
> 					kstrtoul(kmalloc_names[i] + 8),
> 					flags);
>
> here, and remove those weird "96" and "192" cases.

Eww. At least spell 8 as strlen("kmalloc-").

> Or if that's considered too messy, make it
>
> 	static const struct {
> 		const char *name;
> 		unsigned size;
> 	} kmalloc_cache_info[] = {
> 		{ NULL, 0 },
> 		{ "kmalloc-96", 96 },
> 		...
> 	};

I'd vote for this color for the bikeshed :-)

Rasmus
--
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