Closed Bug 1234126 Opened 9 years ago Closed 9 years ago

Add Chaos Mode support for setting thread affinity on OS X and Windows

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

Details

Attachments

(1 file)

cset f741f55301ef added Chaos Mode support for setting Linux thread affinities to increase thread contention. This patch adds support for OS X and Windows.

https://hg.mozilla.org/mozilla-central/rev/f741f55301ef

(MOZ_ALWAYS_TRUE asserts in debug builds, but still executes the asserted code in release builds.)
Attachment #8700480 - Flags: review?(continuation)
Attachment #8700480 - Flags: review?(continuation) → review?(nfroyd)
Comment on attachment 8700480 [details] [diff] [review]
set-thread-affinity.patch

Review of attachment 8700480 [details] [diff] [review]:
-----------------------------------------------------------------

::: xpcom/threads/nsThread.cpp
@@ +309,5 @@
> +  sched_setaffinity(0, sizeof(cpus), &cpus);
> +  // Don't assert sched_setaffinity's return value because it intermittently (?)
> +  // fails with EINVAL on Linux x64 try runs.
> +#elif defined(XP_MACOSX)
> +  // OS X does not provide APIs to pin threads to specific processors, but you

Thank you for this comment!

@@ +319,5 @@
> +  policy.affinity_tag = cpu + 1;
> +  MOZ_ALWAYS_TRUE(thread_policy_set(mach_thread_self(), THREAD_AFFINITY_POLICY,
> +                                    &policy.affinity_tag, 1) == KERN_SUCCESS);
> +#elif defined(XP_WIN)
> +  MOZ_ALWAYS_TRUE(SetThreadIdealProcessor(GetCurrentThread(), cpu) != -1);

I love the Win32 API names.
Attachment #8700480 - Flags: review?(nfroyd) → review+
https://hg.mozilla.org/mozilla-central/rev/95cfbabe6fc6
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: