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


Ignore:
Timestamp:
2011-07-08T17:01:01Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cc1a727
Parents:
4e36219 (diff), 026793d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

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

    r4e36219 rc028b22  
    237237                 * Take the first thread from the queue.
    238238                 */
    239                 thread_t *thread =
    240                     list_get_instance(CPU->rq[i].rq_head.next, thread_t, rq_link);
     239                thread_t *thread = list_get_instance(
     240                    list_first(&CPU->rq[i].rq), thread_t, rq_link);
    241241                list_remove(&thread->rq_link);
    242242               
     
    273273static void relink_rq(int start)
    274274{
    275         link_t head;
    276        
    277         list_initialize(&head);
     275        list_t list;
     276       
     277        list_initialize(&list);
    278278        irq_spinlock_lock(&CPU->lock, false);
    279279       
     
    284284                       
    285285                        irq_spinlock_lock(&CPU->rq[i + 1].lock, false);
    286                         list_concat(&head, &CPU->rq[i + 1].rq_head);
     286                        list_concat(&list, &CPU->rq[i + 1].rq);
    287287                        size_t n = CPU->rq[i + 1].n;
    288288                        CPU->rq[i + 1].n = 0;
     
    292292                       
    293293                        irq_spinlock_lock(&CPU->rq[i].lock, false);
    294                         list_concat(&CPU->rq[i].rq_head, &head);
     294                        list_concat(&CPU->rq[i].rq, &list);
    295295                        CPU->rq[i].n += n;
    296296                        irq_spinlock_unlock(&CPU->rq[i].lock, false);
     
    586586         * Searching least priority queues on all CPU's first and most priority
    587587         * queues on all CPU's last.
    588          *
    589588         */
    590589        size_t acpu;
     
    617616                       
    618617                        /* Search rq from the back */
    619                         link_t *link = cpu->rq[rq].rq_head.prev;
    620                        
    621                         while (link != &(cpu->rq[rq].rq_head)) {
    622                                 thread = (thread_t *) list_get_instance(link, thread_t, rq_link);
     618                        link_t *link = cpu->rq[rq].rq.head.prev;
     619                       
     620                        while (link != &(cpu->rq[rq].rq.head)) {
     621                                thread = (thread_t *) list_get_instance(link,
     622                                    thread_t, rq_link);
    623623                               
    624624                                /*
    625                                  * We don't want to steal CPU-wired threads
    626                                  * neither threads already stolen. The latter
    627                                  * prevents threads from migrating between CPU's
    628                                  * without ever being run. We don't want to
    629                                  * steal threads whose FPU context is still in
    630                                  * CPU.
    631                                  *
     625                                 * Do not steal CPU-wired threads, threads
     626                                 * already stolen, threads for which migration
     627                                 * was temporarily disabled or threads whose
     628                                 * FPU context is still in the CPU.
    632629                                 */
    633630                                irq_spinlock_lock(&thread->lock, false);
    634631                               
    635                                 if ((!(thread->flags & (THREAD_FLAG_WIRED | THREAD_FLAG_STOLEN)))
    636                                     && (!(thread->fpu_context_engaged))) {
     632                                if (!(thread->flags & THREAD_FLAG_WIRED) &&
     633                                    !(thread->flags & THREAD_FLAG_STOLEN) &&
     634                                    !thread->nomigrate &&
     635                                    !thread->fpu_context_engaged) {
    637636                                        /*
    638637                                         * Remove thread from ready queue.
    639638                                         */
    640                                         irq_spinlock_unlock(&thread->lock, false);
     639                                        irq_spinlock_unlock(&thread->lock,
     640                                            false);
    641641                                       
    642642                                        atomic_dec(&cpu->nrdy);
     
    660660                                 */
    661661                               
    662                                 irq_spinlock_pass(&(cpu->rq[rq].lock), &thread->lock);
     662                                irq_spinlock_pass(&(cpu->rq[rq].lock),
     663                                    &thread->lock);
    663664                               
    664665#ifdef KCPULB_VERBOSE
     
    739740                       
    740741                        printf("\trq[%u]: ", i);
    741                         link_t *cur;
    742                         for (cur = cpus[cpu].rq[i].rq_head.next;
    743                             cur != &(cpus[cpu].rq[i].rq_head);
    744                             cur = cur->next) {
    745                                 thread_t *thread = list_get_instance(cur, thread_t, rq_link);
     742                        list_foreach(cpus[cpu].rq[i].rq, cur) {
     743                                thread_t *thread = list_get_instance(cur,
     744                                    thread_t, rq_link);
    746745                                printf("%" PRIu64 "(%s) ", thread->tid,
    747746                                    thread_states[thread->state]);
Note: See TracChangeset for help on using the changeset viewer.