* [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
* Re: [PATCH] mm/slab.c, kernel <2.4.20>
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
0 siblings, 1 reply; 3+ messages in thread
From: Marc-Christian Petersen @ 2003-01-08 22:12 UTC (permalink / raw)
To: linux-kernel; +Cc: markhe, Shangc
[-- Attachment #1: Type: text/plain, Size: 462 bytes --]
On Wednesday 08 January 2003 23:03, Shangc wrote:
Hi Shangc,
> --- 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)
if you use this you may also want this.
ciao, Marc
[-- Attachment #2: slab-other.patch --]
[-- Type: text/x-diff, Size: 434 bytes --]
diff -Naurp a/mm/slab.c b/mm/slab.c
--- a/mm/slab.c Wed Jul 17 12:25:04 2002
+++ b/mm/slab.c Wed Jul 17 12:25:04 2002
@@ -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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/slab.c, kernel <2.4.20>
2003-01-08 22:12 ` Marc-Christian Petersen
@ 2003-01-08 22:58 ` Shangc
0 siblings, 0 replies; 3+ messages in thread
From: Shangc @ 2003-01-08 22:58 UTC (permalink / raw)
To: Marc-Christian Petersen, linux-kernel; +Cc: markhe, Shangc
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 <m.c.p@wolk-project.de>
wrote:
> On Wednesday 08 January 2003 23:03, Shangc wrote:
>
> Hi Shangc,
>
> > --- 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)
> if you use this you may also want this.
>
> ciao, Marc> diff -Naurp a/mm/slab.c b/mm/slab.c
> --- a/mm/slab.c Wed Jul 17 12:25:04 2002
> +++ b/mm/slab.c Wed Jul 17 12:25:04 2002
> @@ -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)
>
__________________________________________________
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.