mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: Unfreeable buffer/cache problem in 2.4.17-rc1 still there
@ 2001-12-16 19:39 Dmitry Volkoff
  2001-12-17 17:01 ` vda
  0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Volkoff @ 2001-12-16 19:39 UTC (permalink / raw)
  To: linux-kernel

Hello!

Below is simple test case which I think is related to "memory disappear"
problem.

My real program is doing something like this:

// test.c
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>

int main(void) 
{
  int fd;
  int r;
  char data[10] = "0123456789";
  int i;
  int end = 30;
  for (i=0;i<end;i++) {
    fd = open("testfile", O_WRONLY | O_NDELAY | O_TRUNC | O_CREAT, 0644);
    if (fd == -1) {
      printf("unable to open\n");
      return;
    }
    r = write(fd,data,sizeof data);
    if (r == -1) {
      printf("unable to write\n");
      close(fd);
      return;
    }
    close(fd);
    sleep(1);
  }
}
// end test.c

Each time I run `free; ./test; free` I see evergrowing memory usage. 
I mean used memory + buffers. At some point system just starts swapping 
even if no other processes are running. Tested on 2.4.13 and 
2.4.17-pre4aa1. I think something is wrong here because the very same 
test program does not show such behaviour on 2.2.19. It does not lose 
any single byte of memory. I've even tested this on freebsd-4.4 with 
the same result as on 2.2.19. 

Example output on 2.4.17-pre4aa1:

bash-2.03$ free; ./test; free
total       used       free     shared    buffers     cached
Mem:        514528     212508     302020          0       7952     150664
-/+ buffers/cache:      53892     460636
Swap:      1028120          0    1028120
total       used       free     shared    buffers     cached
Mem:        514528     212616     301912          0       8000     150664
-/+ buffers/cache:      53952     460576
Swap:      1028120          0    1028120

bash-2.03$ free; ./test; free
total       used       free     shared    buffers     cached
Mem:        514528     212616     301912          0       8008     150664
-/+ buffers/cache:      53944     460584
Swap:      1028120          0    1028120
total       used       free     shared    buffers     cached
Mem:        514528     212700     301828          0       8056     150664
-/+ buffers/cache:      53980     460548
Swap:      1028120          0    1028120

The results are very consistent. I lose 30-40 byte per run.

-- 

    DV

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: Unfreeable buffer/cache problem in 2.4.17-rc1 still there
@ 2001-12-16 20:41 Willy Tarreau
  0 siblings, 0 replies; 11+ messages in thread
From: Willy Tarreau @ 2001-12-16 20:41 UTC (permalink / raw)
  To: vdb; +Cc: linux-kernel

Hi Dmitry !
> Below is simple test case which I think is related to "memory disappear"
> problem.
--snip--
> The results are very consistent. I lose 30-40 byte per run.

Nearly the same here on 2.4.10-ac12, but I loose only 4-8 kB each time.
So I think this is not related to the new VM, and perhaps it's a very
old thing.

Regards,
Willy


^ permalink raw reply	[flat|nested] 11+ messages in thread
[parent not found: <Pine.LNX.4.33.0112151141280.19022-100000@coffee.psychology.mcmaster.ca>]
* Re: Unfreeable buffer/cache problem in 2.4.17-rc1 still there
@ 2001-12-15 16:05 Ed Tomlinson
  0 siblings, 0 replies; 11+ messages in thread
From: Ed Tomlinson @ 2001-12-15 16:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrea Arcangeli

Andrea Arcangeli wrote:

> On Sat, Dec 15, 2001 at 01:36:11PM +0100, Chris Chabot wrote:
>> inode_cache       686896 686896    480 85862 85862    1 :  124   62
>> dentry_cache      696810 696810    128 23227 23227    1 :  252  126
> 
> this is an icache/dcache problem, can you reproduce on 2.4.17rc1aa1, it
> will shrink more aggressively.
> 
> really to get an even better balance we should add the icache/dcache
> slab pages into the lru as well... that would trigger the icache/dcache
> flushes more easily when too much ram is in those caches.

Interesting idea.  Is this what you are thinking?  We find a slab page at the tail of the
lru so we call the related shrink function.  If the page is still active after shrinking, we 
requeue it at the head of the lru.   The slab page freeing logic would have to how to 
unlink from the lru.

The priority arguement of the shink functions would now allow us to keep the ratio of
lru size vs icache/dcache/dqcache under control.   This might be a knob that would
be interesting to have in proc...

Comments?
Ed Tomlinson


^ permalink raw reply	[flat|nested] 11+ messages in thread
[parent not found: <004601c18567$a8be1600$0801a8c0@Stev.org>]

end of thread, other threads:[~2001-12-18  4:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-16 19:39 Unfreeable buffer/cache problem in 2.4.17-rc1 still there Dmitry Volkoff
2001-12-17 17:01 ` vda
2001-12-18  4:26   ` Dmitry Volkoff
  -- strict thread matches above, loose matches on Subject: below --
2001-12-16 20:41 Willy Tarreau
     [not found] <Pine.LNX.4.33.0112151141280.19022-100000@coffee.psychology.mcmaster.ca>
2001-12-15 17:09 ` Chris Chabot
2001-12-15 16:05 Ed Tomlinson
     [not found] <004601c18567$a8be1600$0801a8c0@Stev.org>
2001-12-15 12:36 ` Chris Chabot
2001-12-15 13:42   ` Chris Chabot
2001-12-15 14:24   ` Andrea Arcangeli
2001-12-15 16:05   ` Chris Chabot
2001-12-15 16:09     ` Ken Brownfield

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

Powered by JetHome