linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* address space reservation functionality?
@ 2005-01-10 20:52 Robert W. Fuller
  2005-01-11  7:42 ` Arjan van de Ven
  0 siblings, 1 reply; 5+ messages in thread
From: Robert W. Fuller @ 2005-01-10 20:52 UTC (permalink / raw)
  To: Linux Kernel Mailing List

Hi,

I was wondering if some functionality existed in Linux.  Specifically, 
in Solaris, you can mmap the null device in order to reserve part of the 
address space without otherwise consuming resources.  This is detailed 
in the Solaris manpage null(7D).  The same functionality is also 
available under Windows NT/XP/2K by calling the VirtualAlloc function 
with the MEM_RESERVE flag omitting the MEM_COMMIT flag.  Does Linux have 
a similar mechanism buried somewhere whereby I can reserve a part of the 
address space and not increase the "virtual size" of the process or the 
system's idea of the amount of memory in use?  I could not find one by 
using the source.

Regards,

Rob


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: address space reservation functionality?
  2005-01-10 20:52 address space reservation functionality? Robert W. Fuller
@ 2005-01-11  7:42 ` Arjan van de Ven
  2005-01-11 18:39   ` Robert W. Fuller
  2005-01-11 18:51   ` Robert W. Fuller
  0 siblings, 2 replies; 5+ messages in thread
From: Arjan van de Ven @ 2005-01-11  7:42 UTC (permalink / raw)
  To: Robert W. Fuller; +Cc: Linux Kernel Mailing List

On Mon, 2005-01-10 at 15:52 -0500, Robert W. Fuller wrote:
> Hi,
> 
> I was wondering if some functionality existed in Linux.  Specifically, 
> in Solaris, you can mmap the null device in order to reserve part of the 
> address space without otherwise consuming resources.  This is detailed 
> in the Solaris manpage null(7D).  The same functionality is also 
> available under Windows NT/XP/2K by calling the VirtualAlloc function 
> with the MEM_RESERVE flag omitting the MEM_COMMIT flag.  Does Linux have 
> a similar mechanism buried somewhere whereby I can reserve a part of the 
> address space and not increase the "virtual size" of the process or the 
> system's idea of the amount of memory in use?  I could not find one by 
> using the source.

malloc() already does this...
what you describe is the default behavior of linux; only when you
actually write to the memory does it get backed by ram.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: address space reservation functionality?
  2005-01-11  7:42 ` Arjan van de Ven
@ 2005-01-11 18:39   ` Robert W. Fuller
  2005-01-11 18:51   ` Robert W. Fuller
  1 sibling, 0 replies; 5+ messages in thread
From: Robert W. Fuller @ 2005-01-11 18:39 UTC (permalink / raw)
  To: linux-kernel

This is not quite the same thing.  This still does a check for whether 
or not there is enough memory and includes this in the virtual size of 
the process.  I simply want to reserve a part of the address space so 
I'm guaranteed I can map something else over a contiguous portion of the 
address space.  I don't want it to check for available memory or 
increase the virtual size of the process because I will be using this 
region sparsely.  That is why Solaris and Windows have separate 
interfaces for this.

Arjan van de Ven wrote:
> On Mon, 2005-01-10 at 15:52 -0500, Robert W. Fuller wrote:
> 
>>Hi,
>>
>>I was wondering if some functionality existed in Linux.  Specifically, 
>>in Solaris, you can mmap the null device in order to reserve part of the 
>>address space without otherwise consuming resources.  This is detailed 
>>in the Solaris manpage null(7D).  The same functionality is also 
>>available under Windows NT/XP/2K by calling the VirtualAlloc function 
>>with the MEM_RESERVE flag omitting the MEM_COMMIT flag.  Does Linux have 
>>a similar mechanism buried somewhere whereby I can reserve a part of the 
>>address space and not increase the "virtual size" of the process or the 
>>system's idea of the amount of memory in use?  I could not find one by 
>>using the source.
> 
> 
> malloc() already does this...
> what you describe is the default behavior of linux; only when you
> actually write to the memory does it get backed by ram.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: address space reservation functionality?
  2005-01-11  7:42 ` Arjan van de Ven
  2005-01-11 18:39   ` Robert W. Fuller
@ 2005-01-11 18:51   ` Robert W. Fuller
  2005-01-11 19:19     ` Arjan van de Ven
  1 sibling, 1 reply; 5+ messages in thread
From: Robert W. Fuller @ 2005-01-11 18:51 UTC (permalink / raw)
  To: linux-kernel

Arjan van de Ven wrote:
> On Mon, 2005-01-10 at 15:52 -0500, Robert W. Fuller wrote:
> 
>>Hi,
>>
>>I was wondering if some functionality existed in Linux.  Specifically, 
>>in Solaris, you can mmap the null device in order to reserve part of the 
>>address space without otherwise consuming resources.  This is detailed 
>>in the Solaris manpage null(7D).  The same functionality is also 
>>available under Windows NT/XP/2K by calling the VirtualAlloc function 
>>with the MEM_RESERVE flag omitting the MEM_COMMIT flag.  Does Linux have 
>>a similar mechanism buried somewhere whereby I can reserve a part of the 
>>address space and not increase the "virtual size" of the process or the 
>>system's idea of the amount of memory in use?  I could not find one by 
>>using the source.
> 
> 
> malloc() already does this...
> what you describe is the default behavior of linux; only when you
> actually write to the memory does it get backed by ram.
> 
> 

Sorry about the top posting.  This is a resend without it.

This is not quite the same thing.  This still does a check for whether 
or not there is enough memory and includes this in the virtual size of 
the process.  I simply want to reserve a part of the address space so 
I'm guaranteed I can map something else over a contiguous portion of the 
address space.  I don't want it to check for available memory or 
increase the virtual size of the process because I will be using this 
region sparsely.  That is why Solaris and Windows have separate 
interfaces for this.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: address space reservation functionality?
  2005-01-11 18:51   ` Robert W. Fuller
@ 2005-01-11 19:19     ` Arjan van de Ven
  0 siblings, 0 replies; 5+ messages in thread
From: Arjan van de Ven @ 2005-01-11 19:19 UTC (permalink / raw)
  To: Robert W. Fuller; +Cc: linux-kernel


> > 
> 
> Sorry about the top posting.  This is a resend without it.
> 
> This is not quite the same thing.  This still does a check for whether 
> or not there is enough memory 

no it doesn't


> and includes this in the virtual size of 
> the process.  

because the virtual size is taken.... by the reservation

> I simply want to reserve a part of the address space so 
> I'm guaranteed I can map something else over a contiguous portion of the 
> address space.  I don't want it to check for available memory or 
> increase the virtual size of the process because I will be using this 
> region sparsely.  That is why Solaris and Windows have separate 
> interfaces for this.

well you can mmap /dev/zero.. but that's about the same as malloc.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-01-11 19:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-10 20:52 address space reservation functionality? Robert W. Fuller
2005-01-11  7:42 ` Arjan van de Ven
2005-01-11 18:39   ` Robert W. Fuller
2005-01-11 18:51   ` Robert W. Fuller
2005-01-11 19:19     ` Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).