mm/slab.c, kernel <2.4.20>
PATCH 1/1 mm/slab.c, kernel <2.4.20>
/**
* --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
* [email protected]
*/
slab.c +1 -1
@@ -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
On Wednesday 08 January 2003 23:03, Shangc wrote:
Hi Shangc,
slab.c line 403
Quoted 11 lines
slab.c +1
-1@@ -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 )
if you use this you may also want this.
ciao, Marc
mm/slab.c +2 -2
@@ -399,10 +399,10 @@ 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 ) +while (i*size +L1_CACHE_ALIGN (base+i*extra) > wastage) i--;if (i >SLAB_LIMIT )
thank you for reply. However, I am not very sure to be vary agree with you.
after assigned the calculated initial value for "i", it is very close to the break value for the next while loop, actually, it is only one loop at most, so "i" never goes to be
i*size + L1_CACHE_ALIGN(base+i*extra) > wastage + L1_CACHE_BYTES
so, we do not need change the line 399 of slab.c.
thanks,
chen
--- Marc-Christian Petersen <[email protected]>
Quoted 35 lines · wrote:
On Wednesday 08 January 2003 23:03, Shangc wrote:
Hi Shangc,
slab.c line 401
Quoted 9 lines
slab.c +1
-1@@ -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)
slab.c line 403
Quoted 2 lines
slab.c +0
-0i++;if (i >0 )if you use this you may also want this.
ciao, Marc> diff -Naurp
a/mm/slab.cb/mm/slab.cmm/slab.c +2
-2@@ -399,10 +399,10 @@ 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 ) +while (i*size +L1_CACHE_ALIGN (base+i*extra) > wastage) i--;
Quoted 2 lines
if (i >
SLAB_LIMIT)
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com