All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/slab.c, kernel <2.4.20>
@ 2003-01-08 22:03 Shangc
  2003-01-08 22:12 ` Marc-Christian Petersen
  0 siblings, 1 reply; 3+ messages in thread
From: Shangc @ 2003-01-08 22:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: markhe

/**
 * --readme--
 * make a better initial value for i, which will
reduce the number of 
while loop.
 * the change can be proved mathematically:
 *
 * i*size + L1_CACHE_ALIGN(base+i*extra) <= wastage
 * ==> i*size + base + i*extra <= wastage
 * ==> solve about equation about i
 * ==> i <= (wastage - base) / (size + extra)
 *
 * Chen Shang
 * shangcs@yahoo.com
 */

--- slab.c	2003-02-08 04:26:50.000000000 -0500
+++ slab.c	2003-02-08 04:26:14.000000000 -0500
@@ -397,7 +397,7 @@
 		base = sizeof(slab_t);
 		extra = sizeof(kmem_bufctl_t);
 	}
-	i = 0;
+	i = (wastage - base) / (size + extra);
 	while (i*size + L1_CACHE_ALIGN(base+i*extra) <=
wastage)
 		i++;
 	if (i > 0)

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-01-08 22:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-08 22:03 [PATCH] mm/slab.c, kernel <2.4.20> Shangc
2003-01-08 22:12 ` Marc-Christian Petersen
2003-01-08 22:58   ` Shangc

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.