Messages in this thread | | | Date | Sun, 18 Dec 2005 20:29:31 +0100 | From | Luuk van der Duim <> | Subject | Re: [PATCH] micro optimization of cache_estimate in slab.c |
| |
> 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)
Yes, I recognised the patch because I passed Balbirs version over to Micheal Cohen in early 2002. The patch originaly was intended for 2.4
Complexity of Stevens patch has gone, readability has improved, Steven has taken advantage of context-code and the rationale has been explained in the comment.
Sounds fine to me.
Luuk van der Duim
Partners aan het Werk - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |