[lkml]   [2001]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: 2.4 and 2GB swap partition limit
J. A. Magallon wrote:
>I'm not so sure it's only a 'rule of thumb'. Do not know the state of
>paging in just released 2.4.4, but in previuos kernel, a page that was
>paged-out, reserves its place in swap even if it is paged-in again, so
>once you have paged-out all your ram at least once, you can't get any
>more memory, even if swap is 'empty'.

I am not sure if I see the behavior of the kernel mentioned above, but
it seems that once the swap partition is used,
it may not be released forever : kernel 2.4.x.

I experienced a very strange X server crash (when a certain page
is access via netscape, and a string is searched successively,
on the second or the third search, the X server crash.)
I downloaded the Xfree 86 source file to re-create the problem and
see where the segmentation error of X server occurs by having a server
with debug symbols in it, and finally
traced it to an incorrect pointer value used in the backing store bitblt
However, I can't see the pointer value is an incorrect one at all.
(Maybe I am not familar enough with mmap and unmap calls invoked
by malloc() and free().)
Also, I was a little surprised to see a bug of this nature to remain
in X server at this stage.

Anyway, suspecting some sort of VM problem on the kernel side,
I wrote the attached program and run it to see
the behavior of the system when swap partition was first used.
(The situation where X server crashes is when the system is
just about to use Swap in my current config: 256 MB memory
and 80MB swap).

After running the few invocation of the attached program with
varying arguments, I noticed that once the swap is used (I view it
usinx xosview from X or cat /proc/meminfo ).
the used swap does not seem to get released!?

I thought it was suspicious, but didn't speak up since if this were
a bug, this would indeed be a showstopper for many commercial
Someone must have realized this and fixed it already, so I thought.

From the current discussion, I notice that this may be indeed
an unwanted behavior.
If this is a bug of 2.4.x VM, then I think some installations
would appreciate it very much.

--- memhog.c

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

* using realloc() will call mremap().
* using malloc() and free calls mmap, and munmap().
static usage()
fprintf(stderr,"memhog [limit]\nlimit is in MB units Default is 64

int main(argc, argv)
int argc;
char *argv[];

int i;
char *p = NULL;

#define MB (1024 * 1024 )
int limit = 64 * MB;

if (argc == 2)
int t;
t = atoi(argv[1]);
if(t <= 0)

limit = t * MB;

else if (argc >= 3)

i = MB;

while (i <= limit )
printf("i = %d\n", i);

p = realloc(p, i);
p = malloc(i);

if( p == NULL)
printf("malloc returned NULL\n");

memset(p, 0xA5, i);

sleep (1);

/* free(p); */

/* i *= 2; */
i += 1 * MB;



To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

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