Thread (4 messages) 4 messages, 2 authors, 2012-09-04

Re: C13 [13/14] Shrink __kmem_cache_create() parameter lists

From: Glauber Costa <hidden>
Date: 2012-09-03 15:38:50

On 09/03/2012 07:33 PM, Glauber Costa wrote:
On 08/24/2012 08:17 PM, Christoph Lameter wrote:
quoted
-__kmem_cache_create (struct kmem_cache *cachep, const char *name, size_t size, size_t align,
-	unsigned long flags, void (*ctor)(void *))
+__kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)
 {
 	size_t left_over, slab_size, ralign;
 	gfp_t gfp;
@@ -2385,9 +2383,9 @@ __kmem_cache_create (struct kmem_cache *
 	 * unaligned accesses for some archs when redzoning is used, and makes
 	 * sure any on-slab bufctl's are also correctly aligned.
 	 */
-	if (size & (BYTES_PER_WORD - 1)) {
-		size += (BYTES_PER_WORD - 1);
-		size &= ~(BYTES_PER_WORD - 1);
+	if (cachep->size & (BYTES_PER_WORD - 1)) {
+		cachep->size += (BYTES_PER_WORD - 1);
+		cachep->size &= ~(BYTES_PER_WORD - 1);
 	}
There are still one reference to "size" inside this function that will
break the build. This reference is enclosed inside CONFIG_DEBUG.
Actually, Christoph, it would be a lot cleaner if you would just do

   size_t size = cachep->size;

in the beginning of this function. The resulting patch size would be a
lot smaller since you don't need to patch the references, and would
avoid mistakes like that altogether.


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help