All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ishikawa <ishikawa@yk.rim.or.jp>
To: linux-kernel@vger.kernel.org
Subject: Re: 2.4 and 2GB swap partition limit
Date: Thu, 03 May 2001 23:04:22 +0900	[thread overview]
Message-ID: <3AF16566.D682BF38@yk.rim.or.jp> (raw)

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.

Background:
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
routine.
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
application.
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
(MB).\n");
  exit(EXIT_FAILURE);
}

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)
        {
          usage();
        }

      limit = t * MB;

    }
  else if (argc >= 3)
    {
      usage();
    }


  i = MB;

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

#ifdef USE_REALLOC
      p = realloc(p, i);
#else
      p = malloc(i);
#endif

      if( p == NULL)
        {
          printf("malloc returned NULL\n");
          exit(EXIT_FAILURE);
        }

      memset(p, 0xA5, i);

      sleep (1);

#ifdef USE_REALLOC
      /* free(p); */
#else
      free(p);
#endif

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


  exit (EXIT_SUCCESS);

}





             reply	other threads:[~2001-05-03 14:04 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-03 14:04 Ishikawa [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-04-30 18:45 2.4 and 2GB swap partition limit Torrey Hoffman
2001-04-30 19:04 ` Richard B. Johnson
2001-04-30 19:07   ` David S. Miller
2001-04-30 19:14     ` Richard B. Johnson
2001-04-30 21:04       ` Andreas Ferber
2001-05-02 14:31     ` Andi Kleen
2001-05-02 22:17       ` Andreas Dilger
2001-05-04  8:16         ` Andi Kleen
2001-03-05 16:53 Andries.Brouwer
2001-03-04 22:04 Matt_Domsch
2001-03-05  8:58 ` Christoph Rohland
2001-03-05 14:30   ` Rik van Riel
2001-03-05 14:36   ` Rik van Riel
2001-03-05 14:52   ` Matti Aarnio
2001-03-05 13:30 ` Christoph Hellwig
2001-03-02 21:23 Matt_Domsch
2001-03-02 23:52 ` Kenneth Johansson
2001-03-03  6:14 ` William T Wilson
2001-03-03 11:14   ` Rogier Wolff
2001-03-08 13:05     ` Goswin Brederlow
2001-04-27 10:51       ` Xavier Bestel
2001-04-27 11:13         ` Rogier Wolff
2001-04-27 20:52           ` LA Walsh
2001-04-27 21:44             ` Rik van Riel
2001-04-27 22:06               ` Thomas Dodd
2001-04-27 22:40               ` Hugh Dickins
2001-04-27 22:40                 ` Rik van Riel
2001-04-29 15:12                 ` Ingo Oeser
2001-04-27 22:44               ` LA Walsh
2001-04-28  7:47             ` Rogier Wolff
2001-04-27 22:22           ` Wakko Warner
2001-04-28 13:17             ` Rogier Wolff
2001-04-28 13:37               ` Wakko Warner
2001-04-28 14:11                 ` Rogier Wolff
2001-04-28 14:28                   ` J . A . Magallon
2001-04-30 18:12                     ` Alan Cox
2001-05-01 13:00                       ` Stephen C. Tweedie
2001-05-01 16:14                         ` Rogier Wolff
2001-05-01 16:35                           ` Stephen C. Tweedie
2001-05-02 10:54                             ` Rogier Wolff
2001-05-02 11:04                               ` Stephen C. Tweedie
2001-05-02 12:49                                 ` Hugh Dickins
2001-05-02 13:43                                   ` Stephen C. Tweedie
2001-05-02  0:28                         ` Rik van Riel
2001-05-02  0:34                           ` David S. Miller
2001-05-02  0:43                             ` Rik van Riel
2001-05-02  1:14                               ` Roger Larsson
2001-05-02  1:30                                 ` Rik van Riel
2001-05-01 13:39                       ` Christoph Rohland
2001-05-01 23:25                         ` Rik van Riel
2001-04-28 18:04                   ` Albert D. Cahalan
2001-04-28 21:23                     ` Rogier Wolff
2001-04-29  1:43                     ` Jonathan Lundell
2001-04-29  9:17                       ` Kenneth Johansson
2001-04-28 18:21                   ` David Lang
2001-04-28 21:25                     ` Rogier Wolff
2001-04-30 18:14               ` Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3AF16566.D682BF38@yk.rim.or.jp \
    --to=ishikawa@yk.rim.or.jp \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.