Closed Bug 1144535 Opened 5 years ago Closed 5 years ago

Increase stack size in the Nuwa process

Categories

(Core :: IPC, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- fixed

People

(Reporter: cyu, Assigned: cyu)

References

Details

Attachments

(1 file, 1 obsolete file)

This is a followup to bug 1119157 comment #14 to increase the stack size of the threads cloned by Nuwa.
We allocate thread stacks using mmap() in the Nuwa process(). Increase the stack size to default (= 1MiB) should have no effect on memory usage.
Assignee: nobody → cyu
Attachment #8579256 - Flags: review?(bugmail)
Is there not some way to do it based on the stack size that was actually requested when the thread was created? Hard-coding any size seems like it will bite us somewhere eventually.
Comment on attachment 8579256 [details] [diff] [review]
Increase thread stack size in the Nuwa process

I agree with Ben.  The requested stack size (which defaults to 1 megabyte in at least some versions of bionic) is in the 'attr' attribute to pthread_create.  We should just use that.
Attachment #8579256 - Flags: review?(bugmail) → review-
(Using pthread_attr_getstacksize/pthread_attr_getstackaddr/pthread_attr_getstack.  We may also want to care about pthread_attr_getguardsize too.)
Changes:
* Respect the attributes (detachstate, stacksize, guardsize) when creating the threads in the Nuwa process.
* If the caller doesn't specify pthread_attr_t, use the default 1MB stack size as Android does.

Try push log: https://treeherder.mozilla.org/#/jobs?repo=try&revision=12f23ec99289

* We might still need to copy other pthread_attr_t attributes. Or maybe it's better if we don't copy the thread attributes one by one, but just modify the one as necessary (pthread_attr_setstack()).
Attachment #8579256 - Attachment is obsolete: true
Attachment #8580649 - Flags: review?(bugmail)
Comment on attachment 8580649 [details] [diff] [review]
Respect caller-specified thread attributes.

Yes, I think it would be an improvement to propagate the other pthread_attr_t attributes some way.  And/or causing the thread creation to fail if the attributes aren't expected, like starting a thread in the detached state might be a concerning thing to happen in the pre-fork NuWa process.  But that seems like it wants to be a separate bug.
Attachment #8580649 - Flags: review?(bugmail) → review+
https://hg.mozilla.org/mozilla-central/rev/d8c2f3038fbd
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
You need to log in before you can comment on or make changes to this bug.