New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 650546 link

Starred by 1 user

Issue metadata

Status: Started
Owner:
Last visit > 30 days ago
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Change threadlocal_heap_ from initial-exec to local-exec in static build

Project Member Reported by chihchung@chromium.org, Sep 27 2016

Issue description

While looking at issue chrome-os-partner:56243 (ChromeOS/ARM slowness), I found sometimes malloc is a hotspot, and there is a toolchain bug for handling TLS variable threadlocal_heap_ used in tcmalloc making the performance worse. That bug is filed in chromium:650137. 

I also found an additional optimization opportunity: changing the TLS model for that variable from initial-exec to local-exec if the code is in the executable, not in a shared library. Below is the code of reading the TLS variable on ARM:

(initial-exec)
  36:   4bc3            ldr     r3, [pc, #780]  ; (344 <_ZN12_GLOBAL__N_19do_mallocEj+0x344>)
  38:   ee1d 2f70       mrc     15, 0, r2, cr13, cr0, {3}
  3c:   447b            add     r3, pc
  3e:   681b            ldr     r3, [r3, #0]
  40:   58d6            ldr     r6, [r2, r3]

(local-exec)

  36:   ee1d 3f70       mrc     15, 0, r3, cr13, cr0, {3}
  3a:   4ac1            ldr     r2, [pc, #772]  ; (340 <_ZN12_GLOBAL__N_19do_mallocEj+0x340>)
  3c:   589e            ldr     r6, [r3, r2]

Changing it from initial-exec to local-exec may also sidestep the toolchain bug (not sure as it hasn't been root-caused).


 
You started fixing this bug over two years ago. Are you still working on it? 

Sign in to add a comment