Changeset 8ad7dd1 in mainline


Ignore:
Timestamp:
2016-05-26T09:55:54Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7f0580d
Parents:
84b8936d
Message:

When readying a migrated thread, make sure it runs on the current CPU

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/thread.c

    r84b8936d r8ad7dd1  
    290290            ++thread->priority : thread->priority;
    291291
    292         /* Check that thread->cpu is set whenever it needs to be. */
    293         ASSERT(thread->cpu != NULL ||
    294                 (!thread->wired && !thread->nomigrate && !thread->fpu_context_engaged));
    295 
    296         /*
    297          * Prefer to run on the same cpu as the last time. Used by wired
    298          * threads as well as threads with disabled migration.
    299          */
    300         cpu_t *cpu = thread->cpu;
    301         if (cpu == NULL)
     292        cpu_t *cpu;
     293        if (thread->wired || thread->nomigrate || thread->fpu_context_engaged) {
     294                /* Cannot ready to another CPU */
     295                ASSERT(thread->cpu != NULL);
     296                cpu = thread->cpu;
     297        } else if (thread->stolen) {
     298                /* Ready to the stealing CPU */
    302299                cpu = CPU;
     300        } else if (thread->cpu) {
     301                /* Prefer the CPU on which the thread ran last */
     302                ASSERT(thread->cpu != NULL);
     303                cpu = thread->cpu;
     304        } else {
     305                cpu = CPU;
     306        }
    303307       
    304308        thread->state = Ready;
     
    316320       
    317321        atomic_inc(&nrdy);
    318         // FIXME: Why is the avg value not used
    319         // avg = atomic_get(&nrdy) / config.cpu_active;
    320322        atomic_inc(&cpu->nrdy);
    321323}
Note: See TracChangeset for help on using the changeset viewer.