Changeset 32fffef0 in mainline for kernel/generic/src/proc/scheduler.c


Ignore:
Timestamp:
2006-08-29T11:06:57Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0fa6044
Parents:
c8ea4a8b
Message:

Define architecture-specific thread sub-constructors and sub-destructors on all architectures.
Define the THREAD_FLAG_USPACE which means that the thread runs in user space.
The forementioned changes allow for allocating of user window buffer on sparc64
threads that execute in userspace.

A lot of formatting and indentation fixes.

File:
1 edited

Legend:

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

    rc8ea4a8b r32fffef0  
    142142                        spinlock_unlock(&THREAD->lock);
    143143                        spinlock_unlock(&CPU->lock);
    144                         THREAD->saved_fpu_context = slab_alloc(fpu_context_slab,
    145                                                                0);
     144                        THREAD->saved_fpu_context = slab_alloc(fpu_context_slab, 0);
    146145                        /* We may have switched CPUs during slab_alloc */
    147146                        goto restart;
     
    236235
    237236                /*
    238                  * Clear the X_STOLEN flag so that t can be migrated when load balancing needs emerge.
     237                 * Clear the THREAD_FLAG_STOLEN flag so that t can be migrated
     238                 * when load balancing needs emerge.
    239239                 */
    240                 t->flags &= ~X_STOLEN;
     240                t->flags &= ~THREAD_FLAG_STOLEN;
    241241                spinlock_unlock(&t->lock);
    242242
     
    350350         */
    351351        context_save(&CPU->saved_context);
    352         context_set(&CPU->saved_context, FADDR(scheduler_separated_stack), (uintptr_t) CPU->stack, CPU_STACK_SIZE);
     352        context_set(&CPU->saved_context, FADDR(scheduler_separated_stack),
     353                (uintptr_t) CPU->stack, CPU_STACK_SIZE);
    353354        context_restore(&CPU->saved_context);
    354355        /* not reached */
     
    484485
    485486#ifdef SCHEDULER_VERBOSE
    486         printf("cpu%d: tid %d (priority=%d,ticks=%lld,nrdy=%ld)\n", CPU->id, THREAD->tid, THREAD->priority, THREAD->ticks, atomic_get(&CPU->nrdy));
     487        printf("cpu%d: tid %d (priority=%d,ticks=%lld,nrdy=%ld)\n",
     488                CPU->id, THREAD->tid, THREAD->priority, THREAD->ticks, atomic_get(&CPU->nrdy));
    487489#endif 
    488490
     
    557559                        /*
    558560                         * Not interested in ourselves.
    559                          * Doesn't require interrupt disabling for kcpulb is X_WIRED.
     561                         * Doesn't require interrupt disabling for kcpulb has THREAD_FLAG_WIRED.
    560562                         */
    561563                        if (CPU == cpu)
     
    578580                                t = list_get_instance(l, thread_t, rq_link);
    579581                                /*
    580                                  * We don't want to steal CPU-wired threads neither threads already stolen.
    581                                  * The latter prevents threads from migrating between CPU's without ever being run.
    582                                  * We don't want to steal threads whose FPU context is still in CPU.
     582                                 * We don't want to steal CPU-wired threads neither threads already
     583                                 * stolen. The latter prevents threads from migrating between CPU's
     584                                 * without ever being run. We don't want to steal threads whose FPU
     585                                 * context is still in CPU.
    583586                                 */
    584587                                spinlock_lock(&t->lock);
    585                                 if ( (!(t->flags & (X_WIRED | X_STOLEN))) && (!(t->fpu_context_engaged)) ) {
     588                                if ((!(t->flags & (THREAD_FLAG_WIRED | THREAD_FLAG_STOLEN))) &&
     589                                        (!(t->fpu_context_engaged)) ) {
    586590                                        /*
    587591                                         * Remove t from r.
     
    609613                                spinlock_lock(&t->lock);
    610614#ifdef KCPULB_VERBOSE
    611                                 printf("kcpulb%d: TID %d -> cpu%d, nrdy=%ld, avg=%nd\n", CPU->id, t->tid, CPU->id, atomic_get(&CPU->nrdy), atomic_get(&nrdy) / config.cpu_active);
     615                                printf("kcpulb%d: TID %d -> cpu%d, nrdy=%ld, avg=%nd\n",
     616                                        CPU->id, t->tid, CPU->id, atomic_get(&CPU->nrdy),
     617                                        atomic_get(&nrdy) / config.cpu_active);
    612618#endif
    613                                 t->flags |= X_STOLEN;
     619                                t->flags |= THREAD_FLAG_STOLEN;
    614620                                t->state = Entering;
    615621                                spinlock_unlock(&t->lock);
Note: See TracChangeset for help on using the changeset viewer.