Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Re: A problem porting sbrk
@ 1997-02-24 19:38 Steven White
  0 siblings, 0 replies; 6+ messages in thread
From: Steven White @ 1997-02-24 19:38 UTC (permalink / raw)


Richard Henderson writes:

>> However, it seems to me that this doesn't address the main
>> problem. Regardless of the way the "out of memory" error is reported, 
>> the OSF program isn't able to get as much memory as the same
>> program compiled with gcc on the linux machine itself.
>
>I don't see this effect.  To be sure, I modified your program a 
>little to make sure memory was actually being allocated, rather 
>than getting a few hundred thousand copy-on-write duplicates of
>the zero page.  I append it.

I've verified I still get the same effect with your version of
the test program.

>In any case, on a machine with 64MB ram and no swap, I get 5227
>pages allocated by a native linux application, and 5100 pages
>allocated by a static OSF application -- roughly 40.8MB and 39.8MB
>respectively.  Some but not all of that can be explained by the
>larger static binary, but in any case would not seem to indicate
>the problem you describe.

Could it be something that comes up only for large-memory programs?
Something weird is going on near 100 Mb when I try it.

>Can anyone else duplicate this problem?  I recommend trying this
>without to terribly much swap, as it can take forever to page
>through even a 64M partition.

But more than about 100 Mb of memory and swap may be needed to 
duplicate the problem.

		Steve White
		srwhite@uci.edu
		UC Irvine Dept of Physics

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <199702232301.PAA30446@hedrock.ps.uci.edu>]
* Re: A problem porting sbrk
@ 1997-02-23 23:01 Steven White
  0 siblings, 0 replies; 6+ messages in thread
From: Steven White @ 1997-02-23 23:01 UTC (permalink / raw)


Richard Henderson writes:

> Would the person having the sbrk problem try this out?  I think
> this will be close enough to satisfy both OSF and current Linux libc. 

...
Changes to kernel source listed, adding new system call to the kernel...
...

(By the way, sbrk and brk are called by malloc, and so are
crucial to many programs.) 

Right now I'm afraid to try this, because I just got my machine
(preconfigured from SWT) and I haven't recompiled the kernel
myself yet, at this point. Even though the change looks simple,
I might screw it up and then I'd be in big trouble...

However, it seems to me that this doesn't address the main
problem. Regardless of the way the "out of memory" error is reported, 
the OSF program isn't able to get as much memory as the same
program compiled with gcc on the linux machine itself.
When I compile with gcc on linux and run on linux, I get 30
successful calls to sbrk before it runs out of memory (600 Mb). When I 
compile with cc on OSF and run on OSF, I get 10 successful calls
(200 Mb). Both of these are behaving correctly. But when I 
compile with cc on OSF and run on linux, I only get 5 successful
calls to sbrk--100 Mb when the machine has 256 Mb of RAM.
(limits are datasize=614400 kbytes, stacksize=8192 kbytes).

I don't really care about how it dies if it runs out of memory--
I just want to be able to run big programs. I purchased the OSF
c++ compiler cxx for my OSF machine, and it optimizes much better
than gcc.

		Steve White
		srwhite@uci.edu
		UC Irvine Dept of Physics

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 6+ messages in thread
* A problem porting sbrk
@ 1997-02-22  2:01 Steven White
  1997-02-23  2:45 ` Richard Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Steven White @ 1997-02-22  2:01 UTC (permalink / raw)


I have a problem for you sophisticated linux-alpha kernel hackers...

I'm trying to port some code compiled on a Digital UNIX V3.2C 
machine to an 500 MHz 21164 alpha linux machine, running Red Hat 
Linux 4.1, Kernel 2.0.27. It appears that sbrk doesn't work
right when I do this. Here is a simple test:

file tbrk.c:
#include <stdio.h>

extern void * sbrk(long inc);

int main()
    {

    double *pa;
    pa = sbrk(20000000); printf("%ld\n",(long)pa); printf("%f\n",*pa);
    pa = sbrk(20000000); printf("%ld\n",(long)pa); printf("%f\n",*pa);
    pa = sbrk(20000000); printf("%ld\n",(long)pa); printf("%f\n",*pa);
    pa = sbrk(20000000); printf("%ld\n",(long)pa); printf("%f\n",*pa);
    pa = sbrk(20000000); printf("%ld\n",(long)pa); printf("%f\n",*pa);
    pa = sbrk(20000000); printf("%ld\n",(long)pa); printf("%f\n",*pa);
    pa = sbrk(20000000); printf("%ld\n",(long)pa); printf("%f\n",*pa);
    pa = sbrk(20000000); printf("%ld\n",(long)pa); printf("%f\n",*pa);
    pa = sbrk(20000000); printf("%ld\n",(long)pa); printf("%f\n",*pa);
    pa = sbrk(20000000); printf("%ld\n",(long)pa); printf("%f\n",*pa);
    pa = sbrk(20000000); printf("%ld\n",(long)pa); printf("%f\n",*pa);
    pa = sbrk(20000000); printf("%ld\n",(long)pa); printf("%f\n",*pa);
    pa = sbrk(20000000); printf("%ld\n",(long)pa); printf("%f\n",*pa);
    pa = sbrk(20000000); printf("%ld\n",(long)pa); printf("%f\n",*pa);

    }

Now run on the Digital Unix machine:
5368734016
0.000000
5388734016
0.000000
5408734016
0.000000
5428734016
0.000000
5448734016
0.000000
5468734016
0.000000
5488734016
0.000000
5508734016
0.000000
5528734016
0.000000
5548734016
0.000000
-1
Segmentation fault

This does what you expect. It gets lots of memory (200 Meg, on a 160 Meg
machine), then dies in the appropriate fashion. 

Now I compile with 
cc -g -non_shared tbrk.c -o tbrk, 
move it to the 256 Meg linux machine, and I get

5368734016
0.000000
5388734016
0.000000
5408734016
0.000000
5428734016
0.000000
5448734016
0.000000
5468734016
Segmentation fault

It gets about 100 Meg of memory, then dies.
The last address is out of bounds, and I didn't get the -1 error
indicator.

Does anyone understand this or have any suggestions?

		Steve White
		UC Irvine Dept of Physics

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

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

end of thread, other threads:[~1997-02-24 19:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <199702230245.UAA27778@atheist.tamu.edu>
1997-02-23 17:12 ` A problem porting sbrk Richard Henderson
1997-02-24 19:38 Steven White
     [not found] <199702232301.PAA30446@hedrock.ps.uci.edu>
1997-02-24 17:29 ` Richard Henderson
  -- strict thread matches above, loose matches on Subject: below --
1997-02-23 23:01 Steven White
1997-02-22  2:01 Steven White
1997-02-23  2:45 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox