On Mon, Jul 25, 2011 at 9:56 AM, Paolo Bonzini <pbonz...@redhat.com> wrote: > On 07/19/2011 12:57 PM, Stefan Hajnoczi wrote: >> >> From what I understand "committed" on Windows means that physical >> pages have been allocated and pagefile space has been set aside: >> http://msdn.microsoft.com/en-us/library/ms810627.aspx > > Yes, memory that is "reserved" on Windows is just a contiguous part of the > address space that is set aside, like MAP_NORESERVE under Linux. Memory that > is "committed" is really allocated. > >> The question is how can we get the same effect on Windows and does the >> current Fibers implementation not already work? > > Windows thread and fiber stacks have both a reserved and a committed part. > The dwStackSize argument to CreateFiber indeed represents _committed_ stack > size, so we're now committing 4 MB of stack per fiber. The maximum size > that the stack can grow to is set to the (per-executable) default. > > If you want to specify both the reserved and committed stack sizes, you can > do that with CreateFiberEx. > > http://msdn.microsoft.com/en-us/library/ms682406%28v=vs.85%29.aspx > > 4 MB is quite a lot of address space anyway to waste for a thread. A > coroutine should not need that much, even on Linux. I think for Windows 64 > KB of initial stack size and 1 MB of maximum size should do (for Linux it > would 1 MB overall).
I agree, let's make sure not to commit all this memory upfront. Stefan