Ignore:
Timestamp:
Mar 15, 2014, 5:44:51 PM (11 years ago)
Author:
[email protected]
Message:

It should be possible to adjust DFG and FTL compiler thread priorities
https://bugs.webkit.org/show_bug.cgi?id=130288

Reviewed by Filip Pizlo.

Added ability to change thread priorities relative to its current priority.
Created options to adjust the priority of the DFG and FTL compilation work thread
pools. For two core systems, there might be three runnable threads, the main thread,
the DFG compilation thread and the FTL compilation thread. With the same priority,
the scheduler is free to schedule whatever thread it wants. By lowering the
compilation threads, the main thread can run. Further tests may suggest better values
for the new options, priorityDeltaOfDFGCompilerThreads and priorityDeltaOfFTLCompilerThreads.

For a two-core device, this change has a net positive improvement of 1-3% across
SunSpider, Octane, Kraken and AsmBench.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/wtf/ThreadingPthreads.cpp

    r165676 r165687  
    204204    ThreadIdentifierData::initialize(id);
    205205}
    206 
     206   
     207void changeThreadPriority(ThreadIdentifier threadID, int delta)
     208{
     209    pthread_t pthreadHandle;
     210    ASSERT(threadID);
     211
     212    {
     213        // We don't want to lock across the call to join, since that can block our thread and cause deadlock.
     214        MutexLocker locker(threadMapMutex());
     215        pthreadHandle = pthreadHandleForIdentifierWithLockAlreadyHeld(threadID);
     216        ASSERT(pthreadHandle);
     217    }
     218
     219    int policy;
     220    struct sched_param param;
     221
     222    if (pthread_getschedparam(pthread_self(), &policy, &param))
     223        return;
     224
     225    param.sched_priority += delta;
     226
     227    pthread_setschedparam(pthread_self(), policy, &param);
     228}
     229   
    207230int waitForThreadCompletion(ThreadIdentifier threadID)
    208231{
Note: See TracChangeset for help on using the changeset viewer.