Bug 1533545 - Register thread local arenas in WebRender worker threads. r=jrmuizel
☠☠ backed out by 968d4ed2e984 ☠ ☠
authorNicolas Silva <nsilva@mozilla.com>
Tue, 16 Apr 2019 14:28:05 +0200
changeset 529984 76927efc43f5109d4fae3094e546413c1c929994
parent 529983 a9e8bb1d8a1617763205dc0ef46ec4fd663113cf
child 529985 d0260a2dac6c070d654e858965b82b4eb06b0d76
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1533545
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1533545 - Register thread local arenas in WebRender worker threads. r=jrmuizel Differential Revision: https://phabricator.services.mozilla.com/D27671
gfx/webrender_bindings/WebRenderAPI.cpp
gfx/webrender_bindings/src/bindings.rs
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -1268,9 +1268,13 @@ void wr_transaction_notification_notifie
                                           mozilla::wr::Checkpoint aWhen) {
   auto handler = reinterpret_cast<mozilla::wr::NotificationHandler*>(aHandler);
   handler->Notify(aWhen);
   // TODO: it would be better to get a callback when the object is destroyed on
   // the rust side and delete then.
   delete handler;
 }
 
+void wr_register_thread_local_arena() {
+  jemalloc_thread_local_arena(true);
+}
+
 }  // extern C
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -981,16 +981,17 @@ impl AsyncPropertySampler for SamplerCal
     fn deregister(&self) {
         unsafe { apz_deregister_sampler(self.window_id) }
     }
 }
 
 extern "C" {
     fn gecko_profiler_register_thread(name: *const ::std::os::raw::c_char);
     fn gecko_profiler_unregister_thread();
+    fn wr_register_thread_local_arena();
 }
 
 struct GeckoProfilerThreadListener {}
 
 impl GeckoProfilerThreadListener {
     pub fn new() -> GeckoProfilerThreadListener {
         GeckoProfilerThreadListener{}
     }
@@ -1014,16 +1015,17 @@ impl ThreadListener for GeckoProfilerThr
 
 pub struct WrThreadPool(Arc<rayon::ThreadPool>);
 
 #[no_mangle]
 pub unsafe extern "C" fn wr_thread_pool_new() -> *mut WrThreadPool {
     let worker = rayon::ThreadPoolBuilder::new()
         .thread_name(|idx|{ format!("WRWorker#{}", idx) })
         .start_handler(|idx| {
+            wr_register_thread_local_arena();
             let name = format!("WRWorker#{}", idx);
             register_thread_with_profiler(name.clone());
             gecko_profiler_register_thread(CString::new(name).unwrap().as_ptr());
         })
         .exit_handler(|_idx| {
             gecko_profiler_unregister_thread();
         })
         .build();