>Would it be usefull to create a kernel flag to mark all process stack >memory with |MAP_NORESERVE|, e.g. don't allocate swap memory for stacks >? The idea is to reduce the swap requirements for platforms like settop >boxes etc. with limited or no swap space by exploiting the detail that >almost all applications reserve memory for large stacks (8MB default) >but only use a tiny fraction (most shells and shell applications rarely >use more than 64k).
No, they do not reserve 8MB as by default the swap is MAP_NORESERVE (it's somewhat different than that). All thread stacks are MAP_NORESERVE also. The net gain would be 0. You can easily check this: $ swap -s total: 502992k bytes allocated + 25504k reserved = 528496k used, 10645456k available $ sh $ swap -s total: 503112k bytes allocated + 25520k reserved = 528632k used, 10645312k available See how only 16K is added to reserved? The whole system has 25MB "reserved" but has 125 processes (which would yield around 1G of reserved memory by you reckoning. Processes do get killed when swap space cannot be gotten when there's a page fault on an unmapped stack page. Casper _______________________________________________ opensolaris-code mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
