Re: [PATCH] micro optimization of cache_estimate in slab.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 18 Dec 2005, Steven Rostedt wrote:
> Index: linux-2.6.15-rc5/mm/slab.c
> ===================================================================
> --- linux-2.6.15-rc5.orig/mm/slab.c	2005-12-16 16:24:09.000000000 -0500
> +++ linux-2.6.15-rc5/mm/slab.c	2005-12-18 13:30:13.000000000 -0500
> @@ -708,7 +708,14 @@
>  		base = sizeof(struct slab);
>  		extra = sizeof(kmem_bufctl_t);
>  	}
> -	i = 0;
> +	/*
> +	 * Divide the amount we have, by the amount we need for
> +	 * each object.  Since the size is already calculated
> +	 * to be no less than the alignment, this result will
> +	 * not be any greater than 1 that we need, and this will
> +	 * be subtracted after the while loop.
> +	 */
> +	i = (wastage - base)/(size + extra);
>  	while (i*size + ALIGN(base+i*extra, align) <= wastage)
>  		i++;
>  	if (i > 0)

Thanks. Looks much better but I am still wondering if we could get rid of 
the loop altogether. Hmm.

			Pekka
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux