From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: From: erik quanstrom Date: Tue, 1 Sep 2009 19:49:33 -0400 To: 9fans@9fans.net In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] lowest valid stack address Topicbox-Message-UUID: 5df5e50c-ead5-11e9-9d60-3106f5b1d025 On Tue Sep 1 19:24:33 EDT 2009, rsc@swtch.com wrote: > I believe that the Stack line in /proc/$pid/segment > tells you the lowest possible stack address, not > the amount in use right now. I looked in the kernel > source and tried it in 9vx and it confirms my belief. > I don't have a Plan 9 kernel to try it on right now, > so maybe I'm wrong. > > Do you have two different /proc/$pid/segment > with different lowest stack addresses on the Stack line? evidently i misread /proc/$pid/segment. and i guess this should have been obvious. segments don't grow on demand. but inside a segment, you can have demand zero fill. aside: from the overcommit vm discussion. in http://9fans.net/archive/2000/06/634 rob says that plan 9 doesn't overcommit vm. what's the history here? - erik --- #include #include enum { Stack = 15*1024*1024, }; char *runargv[] = {"/bin/sed", "1q", 0, 0}; void run(char **argv) { switch(fork()){ case -1: sysfatal("fork: %r"); case 0: exec(*argv, argv); sysfatal("exec: %r"); default: waitpid(); } } void bigstack(void) { char big[Stack]; memset(big, 0, sizeof big); run(runargv); } void main(void) { char buf[64]; snprint(buf, sizeof buf, "/proc/%ud/segment", getpid()); runargv[2] = buf; run(runargv); bigstack(); exits(""); }