Re: Kernel: /dev/ram1 (rd.c) not releasing unused memory automatically any more?
From: Peter T. Breuer (ptb_at_oboe.it.uc3m.es)
Date: 11/16/05
- Next message: Peter T. Breuer: "Re: Number of elements in a sequence"
- Previous message: Daniel Kabs: "Re: Kernel: /dev/ram1 (rd.c) not releasing unused memory automatically any more?"
- In reply to: Daniel Kabs: "Re: Kernel: /dev/ram1 (rd.c) not releasing unused memory automatically any more?"
- Next in thread: Daniel Kabs: "Re: Kernel: /dev/ram1 (rd.c) not releasing unused memory automatically any more?"
- Reply: Daniel Kabs: "Re: Kernel: /dev/ram1 (rd.c) not releasing unused memory automatically any more?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 16 Nov 2005 12:01:01 +0100
Daniel Kabs <daniel.kabs@gmx.de> wrote:
> Hello Tauno Voipio,
> thanks for getting back to me. :-)
> Tauno Voipio wrote:
>> There is one point: A demand-paged virtual memory system
>> does not allocate physical memory at allocation time. The
>> physical memory is allocated only when it is accessed, when
>> the kernel checks whether to give a page or trap for an
>> illegal access.
> Therefore my malloc() programm does not only mallocate the memory but
> also writes to it. This makes sure that all the allocated memory is also
> mapped to physical memory.
No no no. "Physical memory" does not equate to "the ram disk". PLEASE
take on board what I and others are saying to you. All you are doing is
dirtying buffers - the ram disk never gets to see them, just as your hard
disk never gets to see the writes to buffers that are aimed at the IDE
driver, until a long time later. "Buffers" as far as IDE disks are
concerned is precisely the count of writes that are NOT ON THE DISK YET,
and the same is true of the ram driver, with the exception that the ram
driver, when it eventually "gets" the write that long time later, does not
transfer the data out of the buffer, so no change of accounting stats is
seen.
>> This applies also to memory for the RAM disks.
> Please bear with me, but data written to a file on the ram disk does
> have to be stored somewhere. And this is physical memory which is now
> dirty/allocated/busy/used, isn't it?
Of course, but that's irrelevant. The only thing the RAM driver does is
mark temporary buffers as permanent. There is no change of state
involved, only a change of METASTATE, and you are completely disregarding
that change, which is the only thing the ram driver does.
Before that change occurs, the buffers are temporary, and will evaporate
after removing their referents, which is what removing the file to which
you wrote does. After it, they will stay around, even if you remove the
file.
You are not taking ANY of this into account, and it is so simple!
>> To complicate things, there are memory blocks used for
>> saving physical disk blocks for cacheing. ...
> I think, this is not relevant in my case: my system has no hard drive at
> all.
It's completely relevant, given that your ramdisk is a block device, just
like all other disks!
Peter
- Next message: Peter T. Breuer: "Re: Number of elements in a sequence"
- Previous message: Daniel Kabs: "Re: Kernel: /dev/ram1 (rd.c) not releasing unused memory automatically any more?"
- In reply to: Daniel Kabs: "Re: Kernel: /dev/ram1 (rd.c) not releasing unused memory automatically any more?"
- Next in thread: Daniel Kabs: "Re: Kernel: /dev/ram1 (rd.c) not releasing unused memory automatically any more?"
- Reply: Daniel Kabs: "Re: Kernel: /dev/ram1 (rd.c) not releasing unused memory automatically any more?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|