Last year I claimed that Servo had a number of huge stacks, as reported by /proc/<pid>/smaps. It turns out that these measurements are inaccurate -- if a non-stack mapping gets placed next to a stack mapping, the kernel merges them and the merged segment is marked as a stack. I've confirmed this happens by looking at the output of strace. It's also something I should have known since it came up in Firefox in bug 827691.
Nick On Fri, Jul 11, 2014 at 12:04 PM, Brian Anderson <bander...@mozilla.com> wrote: > > On 07/10/2014 11:11 PM, Nicholas Nethercote wrote: >> >> On Thu, Jul 10, 2014 at 10:34 PM, Patrick Walton <pcwal...@mozilla.com> >> wrote: >>> >>> Historically, Rust's large stacks were due to the fact that at the time >>> stack growth was removed, rustc had worse codegen than it did today, >>> resulting in frames with very large activation records. Coupled with the >>> fact that rustc itself uses recursion heavily (probably too heavily), the >>> easiest thing to do was to give tasks large stacks by default. Perhaps >>> this >>> decision should be revisited, as I think that it may well be the case >>> that >>> rustc is going to be the exception, not the rule. >>> >>> You can tune the size of stack growth when spawning a Rust task. Servo >>> could >>> definitely use a stack size audit; I bet a ton of MBs can be shaved off >>> with >>> some tuning. >> >> "Large default stack size" doesn't seem to explain it. >> >> I'd guess that the default is 2 MiB, because there are quite a few >> entries in smaps like this: >> >> 7f54091fe000-7f54093fe000 rw-p 00000000 00:00 0 >> [stack:28143] >> Size: 2048 kB >> Rss: 12 kB >> Pss: 12 kB >> >> 2 MiB has been allocated, but only a tiny amount has been touched and >> is thus in RSS. >> >> Here are the two biggest stacks: >> >> 7f540a700000-7f540b800000 rw-p 00000000 00:00 0 >> [stack:28139] >> Size: 17408 kB >> Rss: 7944 kB >> Pss: 7944 kB >> >> 7f5409600000-7f540a400000 rw-p 00000000 00:00 0 >> [stack:28141] >> Size: 14336 kB >> Rss: 8192 kB >> Pss: 8192 kB >> >> For both, |Rss| is big and |Size| (equivalent to vsize) is even bigger. >> > > Rust does have 2MB stacks by default. These giant numbers are surprising. > > > _______________________________________________ > dev-servo mailing list > dev-servo@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-servo _______________________________________________ dev-servo mailing list dev-servo@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-servo