lkml.org 
[lkml]   [1999]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: tiny patch, reduces kernel memory usage (memory_save patch)
Date
> 
> On Wed, 13 Jan 1999, Max wrote:
>
> > Ok, so I grabbed a 128Mb PentiumII 266MHz and tested on it.
> >
> > The results are:
> > (still kernel compile, suggest something else and I'll try too)
> >
> > kernel: memory (code,reserved,data,init): compile time:
> >
> > stock 2.2.0-pre7 768k,404k,1744k,28k 5m 29s 75
> > 2.2.0-pre7 + my patch 768k,404k,1488k,28k 5m 29s 25
>
> Convinced (but note, I don't think it's an improvement, but it really
> seems that the overhead is zero and we save some bit of memory at the same
> time). Next arca patches will have map_nr killed too. Thanks Max.

I don't think it is a good idea, if you kill map_nr, you kill it in all
ports. And e.g. old 32bit sparc generates for division by 44 this:

%o0 <= (%o0 - %o1) / 44
sub %o0,%o1,%o1
sll %o1,5,%g2
sub %g2,%o1,%g2
sll %g2,5,%g2
add %g2,%o1,%g2
sll %g2,3,%g3
add %g2,%g3,%g2
sll %g2,15,%o0
sub %o0,%g2,%o0
sll %o0,2,%o0
add %o0,%o1,%o0
sub %g0,%o0,%o0
sra %o0,2,%o0

so it would need serious testing on all archs to see if it is a win, not
just a kernel compile on one machine.
On sparc64, for division by 80, one has to build a 64bit constant, so it is
rather long as well:

sethi %hi(0xcccccccc), %g2
sub %o0, %o1, %o0
or %g2, 0xcc, %g3
sllx %g3, 32, %g3
or %g2, 0xcd, %g2
add %g3, %g2, %g3 ! %g3 = 0xcccccccccccccccd
mulx %o0, %g3, %o0
srax %o0, 4, %o0

So, if you think it is a win on some architecture, move struct page to asm*
headers and make some macros for map_nr
(e.g.
#define map_nr(page) ((page) - mem_map)
on archs which will miss the map_nr pointer
and
#define map_nr(page) ((page)->_map_nr)
on others
).

Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
UltraLinux | http://ultra.linux.cz/ | http://ultra.penguin.cz/
Linux version 2.2.0-pre7 on a sparc64 machine (3958.37 BogoMips)
___________________________________________________________________

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:1.575 / U:0.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site