lkml.org 
[lkml]   [1997]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectUnmapping memory

Pardon me if this subject has already been discussed -- I haven't been
tracking linux-kernel for a while.

Given the periodic discussions about how traditional sbrk() based malloc
fails to return free()'d memory to the OS, it occured to me that a new
primitive might prove useful here.

Would it be possible to add a syscall to "zero" a range of memory? I mean
not only clear it to zero, as with memset, but if any complete pages are
within the range, unmap them, and replace them with zero mappings (as
mmap()'ing /dev/zero gives you).

With this ability, a free() implementation could invoke this call any time
a largish chunk of memory is truly discarded, and thereby genuinely give
memory back to the OS, _without_ the significant overhead and limitations
of using mmap() and munmap().

I suppose the biggest question is whether the memory manager is capable of
inserting zeroed page mappings like this. If it isn't, what would be the
cost of implementing it?

--
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)



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