Clneaned up several files
authorAnton Eisenbraun <anton.e@mailbox.tu-berlin.de>
Wed, 9 Apr 2014 15:02:11 +0000 (17:02 +0200)
committerAnton Eisenbraun <anton.e@mailbox.tu-berlin.de>
Wed, 9 Apr 2014 15:02:11 +0000 (17:02 +0200)
18 files changed:
sys/amd64/conf/kernel_x86_64-conf
sys/geom/geom_kern.c
sys/kern/init_main.c
sys/kern/kern_clock.c
sys/kern/kern_cpuset.c
sys/kern/kern_fork.c
sys/kern/kern_idle.c
sys/kern/kern_intr.c
sys/kern/kern_kthread.c
sys/kern/kern_resource.c
sys/kern/kern_switch.c
sys/kern/kern_synch.c
sys/kern/kern_umtx.c
sys/kern/subr_sleepqueue.c
sys/kern/subr_taskqueue.c
sys/kern/subr_trap.c
sys/kern/vfs_subr.c
sys/vm/vm_zeroidle.c

index 5a7b1ee..29d3446 100644 (file)
@@ -22,7 +22,7 @@ cpu           HAMMER
 ident          KBS-Kernel
 
 makeoptions    DEBUG=-g                # Build kernel with gdb(1) debug symbols
-options                VERBOSE_SYSINIT
+#options               VERBOSE_SYSINIT
 #options               DDB
 options        SCHED_ULE               # ULE scheduler
 options        FW_MOD_SCHED            # Modulized scheduler framework
index 4d76d29..1744d17 100644 (file)
@@ -91,13 +91,8 @@ g_up_procbody(void *arg)
 
        mtx_assert(&Giant, MA_NOTOWNED);
        thread_lock(g_up_td);
-//#warning "g_up_procbody lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        sched_prio(g_up_td, PRIBIO);
        thread_unlock(g_up_td);
-//     intr_restore(rflags);
-//     enable_intr();
        for(;;) {
                g_io_schedule_up(g_up_td);
        }
@@ -109,13 +104,8 @@ g_down_procbody(void *arg)
 
        mtx_assert(&Giant, MA_NOTOWNED);
        thread_lock(g_down_td);
-//#warning "g_down_procbody lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        sched_prio(g_down_td, PRIBIO);
        thread_unlock(g_down_td);
-//     intr_restore(rflags);
-//     enable_intr();
        for(;;) {
                g_io_schedule_down(g_down_td);
        }
@@ -127,13 +117,8 @@ g_event_procbody(void *arg)
 
        mtx_assert(&Giant, MA_NOTOWNED);
        thread_lock(g_event_td);
-//#warning "g_event_procbody lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        sched_prio(g_event_td, PRIBIO);
        thread_unlock(g_event_td);
-//     intr_restore(rflags);
-//     enable_intr();
        g_run_events();
        /* NOTREACHED */
 }
index 0283147..824e453 100644 (file)
@@ -809,8 +809,6 @@ create_init(const void *udata __unused)
        struct ucred *newcred, *oldcred;
        int error;
 
-       printf("create init begin.\n");
-
        error = fork1(&thread0, RFFDG | RFPROC | RFSTOPPED, 0, &initproc,
            NULL, 0);
        if (error)
@@ -833,7 +831,6 @@ create_init(const void *udata __unused)
        crfree(oldcred);
        cred_update_thread(FIRST_THREAD_IN_PROC(initproc));
        cpu_set_fork_handler(FIRST_THREAD_IN_PROC(initproc), start_init, NULL);
-       printf("create init done.\n");
 }
 SYSINIT(init, SI_SUB_CREATE_INIT, SI_ORDER_FIRST, create_init, NULL);
 
@@ -847,13 +844,8 @@ kick_init(const void *udata __unused)
 
        td = FIRST_THREAD_IN_PROC(initproc);
        thread_lock(td);
-//#warning "ruxagg lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        TD_SET_CAN_RUN(td);
        sched_add(td, SRQ_BORING);
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
 }
 SYSINIT(kickinit, SI_SUB_KTHREAD_INIT, SI_ORDER_FIRST, kick_init, NULL);
index 2a0841c..23714a6 100644 (file)
@@ -538,14 +538,9 @@ hardclock_cnt(int cnt, int usermode)
                PROC_SUNLOCK(p);
        }
        thread_lock(td);
-//#warning "hardclock_cnt lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        sched_tick(cnt);
        td->td_flags |= flags;
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
 
 #ifdef HWPMC_HOOKS
        if (PMC_CPU_HAS_SAMPLES(PCPU_GET(cpuid)))
@@ -771,14 +766,9 @@ statclock_cnt(int cnt, int usermode)
            "prio:%d", td->td_priority, "stathz:%d", (stathz)?stathz:hz);
        SDT_PROBE2(sched, , , tick, td, td->td_proc);
        thread_lock_flags(td, MTX_QUIET);
-//#warning "statclock_cnt lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        for ( ; cnt > 0; cnt--)
                sched_clock(td);
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
 #ifdef HWPMC_HOOKS
        if (td->td_intr_frame != NULL)
                PMC_SOFT_CALL_TF( , , clock, stat, td->td_intr_frame);
index a770736..cee3e81 100644 (file)
@@ -715,9 +715,6 @@ cpuset_setthread(lwpid_t id, cpuset_t *mask)
                goto out;
        set = NULL;
        thread_lock(td);
-//#warning "cpuset_setthread lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        error = cpuset_shadow(td->td_cpuset, nset, mask);
        if (error == 0) {
                set = td->td_cpuset;
@@ -726,15 +723,12 @@ cpuset_setthread(lwpid_t id, cpuset_t *mask)
                nset = NULL;
        }
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
        PROC_UNLOCK(p);
        if (set)
                cpuset_rel(set);
 out:
        if (nset)
                uma_zfree(cpuset_zone, nset);
-
        return (error);
 }
 
index 084b12c..7a0cece 100644 (file)
@@ -488,13 +488,9 @@ do_fork(struct thread *td, int flags, struct proc *p2, struct thread *td2,
         * Allow the scheduler to initialize the child.
         */
        thread_lock(td);
-//#warning "do_fork lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        sched_fork(td, td2);
-//     intr_restore(rflags);
-//     enable_intr();
        thread_unlock(td);
+
        /*
         * Duplicate sub-structures as needed.
         * Increase reference counts on shared objects.
@@ -723,14 +719,9 @@ do_fork(struct thread *td, int flags, struct proc *p2, struct thread *td2,
                 * add to run queue.
                 */
                thread_lock(td2);
-//#warning "do_fork lock removed"
-//             register_t rflags;
-//             rflags = intr_disable();
                TD_SET_CAN_RUN(td2);
                sched_add(td2, SRQ_BORING);
                thread_unlock(td2);
-//             intr_restore(rflags);
-//             enable_intr();
        }
 
        /*
@@ -923,10 +914,9 @@ fork1(struct thread *td, int flags, int pages, struct proc **procp,
                    lim_cur(p1, RLIMIT_NPROC));
                PROC_UNLOCK(p1);
        }
-//     printf("fork1 abschnitt 4,5.\n");
        if (ok) {
                do_fork(td, flags, newproc, td2, vm2, pdflags);
-//             printf("fork1 abschnitt 4,6.\n");
+
                /*
                 * Return child proc pointer to parent.
                 */
@@ -939,7 +929,6 @@ fork1(struct thread *td, int flags, int pages, struct proc **procp,
                return (0);
        }
 
-//     printf("fork1 abschnitt 5.\n");
        error = EAGAIN;
 fail:
        sx_sunlock(&proctree_lock);
@@ -960,10 +949,9 @@ fail1:
                fdrop(fp_procdesc, td);
 #endif
        pause("fork", hz / 2);
-//     printf("fork1 done..\n");
        return (error);
 }
-int bugChecker = 0;
+
 /*
  * Handle the return of a child process from fork1().  This function
  * is called from the MD fork_trampoline() entry point.
@@ -993,35 +981,16 @@ fork_exit(void (*callout)(void *, struct trapframe *), void *arg,
                PCPU_SET(deadthread, NULL);
                thread_stash(dtd);
        }
-//#warning "fork_exit unlock removed"
        thread_unlock(td);
-//     register_t rflags;
-//     rflags = intr_disable();
-//     intr_restore(rflags);
-//     enable_intr();
-//
-//     printf("fork_exit thread %s (%p)\n", td->td_name, (void*)td);
-//     if (!strcmp(td->td_name, "init")) {
-//             printf("fork_exit start init\n", td->td_name);
-//             bugChecker++;
-//     }
 
        /*
         * cpu_set_fork_handler intercepts this function call to
         * have this call a non-return function to stay in kernel mode.
         * initproc has its own fork handler, but it does return.
         */
-//     if (bugChecker)
-//             printf("fork_exit assert init\n", td->td_name);
        KASSERT(callout != NULL, ("NULL callout in fork_exit"));
-//     if (bugChecker)
-//             printf("fork_exit assert init done\n", td->td_name);
-
        callout(arg, frame);
 
-//     if (bugChecker)
-//             printf("fork_exit callout init done\n", td->td_name);
-
        /*
         * Check if a kernel thread misbehaved and returned from its main
         * function.
@@ -1032,7 +1001,7 @@ fork_exit(void (*callout)(void *, struct trapframe *), void *arg,
                kproc_exit(0);
        }
        mtx_assert(&Giant, MA_NOTOWNED);
-//     printf("fork_exit done.\n");
+
        if (p->p_sysent->sv_schedtail != NULL)
                (p->p_sysent->sv_schedtail)(td);
 }
index 95846c2..f412d17 100644 (file)
@@ -75,19 +75,12 @@ idle_setup(void *dummy)
                        panic("idle_setup: kproc_create error %d\n", error);
 
                thread_lock(td);
-//#warning "idle_setup lock removed"
-//             register_t rflags;
-//             rflags = intr_disable();
                TD_SET_CAN_RUN(td);
                td->td_flags |= TDF_IDLETD | TDF_NOLOAD;
                sched_class(td, PRI_IDLE);
                sched_prio(td, PRI_MAX_IDLE);
                thread_unlock(td);
-//             intr_restore(rflags);
-//             enable_intr();
 #ifdef SMP
        }
 #endif
-
-       printf("idle init done.\n");
 }
index f96a928..c3d8fcb 100644 (file)
@@ -184,13 +184,8 @@ ithread_update(struct intr_thread *ithd)
        sched_clear_tdname(td);
 #endif
        thread_lock(td);
-//#warning "ithread_update lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        sched_prio(td, pri);
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
 }
 
 /*
@@ -462,14 +457,9 @@ ithread_create(const char *name)
        if (error)
                panic("kproc_create() failed with %d", error);
        thread_lock(td);
-//#warning "ithread_create lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        sched_class(td, PRI_ITHD);
        TD_SET_IWAIT(td);
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
        td->td_pflags |= TDP_ITHREAD;
        ithd->it_thread = td;
        CTR2(KTR_INTR, "%s: created %s", __func__, name);
@@ -557,9 +547,8 @@ intr_event_add_handler(struct intr_event *ie, const char *name,
 
        /* Create a thread if we need one. */
        while (ie->ie_thread == NULL && handler != NULL) {
-               if (ie->ie_flags & IE_ADDING_THREAD) {
+               if (ie->ie_flags & IE_ADDING_THREAD)
                        msleep(ie, &ie->ie_lock, 0, "ithread", 0);
-               }
                else {
                        ie->ie_flags |= IE_ADDING_THREAD;
                        mtx_unlock(&ie->ie_lock);
@@ -578,18 +567,18 @@ intr_event_add_handler(struct intr_event *ie, const char *name,
                if (temp_ih->ih_pri > ih->ih_pri)
                        break;
        }
-
        if (temp_ih == NULL)
                TAILQ_INSERT_TAIL(&ie->ie_handlers, ih, ih_next);
        else
                TAILQ_INSERT_BEFORE(temp_ih, ih, ih_next);
        intr_event_update(ie);
+
        CTR3(KTR_INTR, "%s: added %s to %s", __func__, ih->ih_name,
            ie->ie_name);
        mtx_unlock(&ie->ie_lock);
+
        if (cookiep != NULL)
                *cookiep = ih;
-
        return (0);
 }
 #else
@@ -925,9 +914,6 @@ intr_event_schedule_thread(struct intr_event *ie)
         */
        it->it_need = 1;
        thread_lock(td);
-//#warning "intr_event_schedule_thread lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        if (TD_AWAITING_INTR(td)) {
                CTR3(KTR_INTR, "%s: schedule pid %d (%s)", __func__, p->p_pid,
                    td->td_name);
@@ -938,8 +924,6 @@ intr_event_schedule_thread(struct intr_event *ie)
                    __func__, p->p_pid, td->td_name, it->it_need, td->td_state);
        }
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
 
        return (0);
 }
@@ -1146,13 +1130,8 @@ swi_add(struct intr_event **eventp, const char *name, driver_intr_t handler,
        if (pri == SWI_CLOCK) {
                td = ie->ie_thread->it_thread;
                thread_lock(td);
-//#warning "swi_add lock removed"
-//             register_t rflags;
-//             rflags = intr_disable();
                td->td_flags |= TDF_NOLOAD;
                thread_unlock(td);
-//             intr_restore(rflags);
-//             enable_intr();
        }
        return (0);
 }
@@ -1388,10 +1367,6 @@ ithread_loop(void *arg)
                 * set again, so we have to check it again.
                 */
                thread_lock(td);
-//#warning "ithread_loop lock removed"
-//             register_t rflags;
-//             rflags = intr_disable();
-
                if (!ithd->it_need && !(ithd->it_flags & (IT_DEAD | IT_WAIT))) {
                        TD_SET_IWAIT(td);
                        ie->ie_count = 0;
@@ -1402,9 +1377,6 @@ ithread_loop(void *arg)
                        ithd->it_flags &= ~IT_WAIT;
                }
                thread_unlock(td);
-//             intr_restore(rflags);
-//             enable_intr();
-
                if (wake) {
                        wakeup(ithd);
                        wake = 0;
index 8fa2bfe..9dcdeb0 100644 (file)
@@ -121,21 +121,18 @@ kproc_create(void (*func)(void *), void *arg,
 
        /* call the processes' main()... */
        cpu_set_fork_handler(td, func, arg);
+
        /* Avoid inheriting affinity from a random parent. */
        cpuset_setthread(td->td_tid, cpuset_root);
        thread_lock(td);
-//#warning "kproc_create lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        TD_SET_CAN_RUN(td);
        sched_prio(td, PVM);
        sched_user_prio(td, PUSER);
+
        /* Delay putting it on the run queue until now. */
        if (!(flags & RFSTOPPED))
                sched_add(td, SRQ_BORING); 
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
 
        return 0;
 }
@@ -301,15 +298,10 @@ kthread_add(void (*func)(void *), void *arg, struct proc *p,
        newtd->td_sigmask = oldtd->td_sigmask; /* XXX dubious */
        thread_link(newtd, p);
        thread_lock(oldtd);
-//#warning "kthread_add lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        /* let the scheduler know about these things. */
        sched_fork_thread(oldtd, newtd);
        TD_SET_CAN_RUN(newtd);
        thread_unlock(oldtd);
-//     intr_restore(rflags);
-//     enable_intr();
        PROC_UNLOCK(p);
 
        tidhash_add(newtd);
@@ -320,13 +312,8 @@ kthread_add(void (*func)(void *), void *arg, struct proc *p,
        /* Delay putting it on the run queue until now. */
        if (!(flags & RFSTOPPED)) {
                thread_lock(newtd);
-//#warning "kthread_add lock removed"
-//             register_t rflags;
-//             rflags = intr_disable();
                sched_add(newtd, SRQ_BORING); 
                thread_unlock(newtd);
-//             intr_restore(rflags);
-//             enable_intr();
        }
        if (newtdp)
                *newtdp = newtd;
index 4798260..5c88da7 100644 (file)
@@ -1059,9 +1059,6 @@ ruxagg(struct proc *p, struct thread *td)
 {
 
        thread_lock(td);
-//#warning "ruxagg lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        ruxagg_locked(&p->p_rux, td);
        ruxagg_locked(&td->td_rux, td);
        td->td_incruntime = 0;
@@ -1069,8 +1066,6 @@ ruxagg(struct proc *p, struct thread *td)
        td->td_iticks = 0;
        td->td_sticks = 0;
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
 }
 
 /*
index 1841d34..32a0dde 100644 (file)
@@ -203,9 +203,6 @@ critical_exit(void)
                if (td->td_owepreempt && !kdb_active) {
                        td->td_critnest = 1;
                        thread_lock(td);
-//#warning "critical_exit lock removed"
-//                     register_t rflags;
-//                     rflags = intr_disable();
                        td->td_critnest--;
                        flags = SW_INVOL | SW_PREEMPT;
                        if (TD_IS_IDLETHREAD(td))
@@ -214,8 +211,6 @@ critical_exit(void)
                                flags |= SWT_OWEPREEMPT;
                        mi_switch(flags, NULL);
                        thread_unlock(td);
-//                     intr_restore(rflags);
-//                     enable_intr();
                }
        } else
                td->td_critnest--;
index 3406684..e2e4081 100644 (file)
@@ -153,6 +153,7 @@ _sleep(void *ident, struct lock_object *lock, int priority,
        struct lock_class *class;
        int catch, flags, lock_state, pri, rval;
        WITNESS_SAVE_DECL(lock_witness);
+
        td = curthread;
        p = td->td_proc;
 #ifdef KTRACE
@@ -172,6 +173,7 @@ _sleep(void *ident, struct lock_object *lock, int priority,
                class = LOCK_CLASS(lock);
        else
                class = NULL;
+
        if (cold || SCHEDULER_STOPPED()) {
                /*
                 * During autoconfiguration, just return;
@@ -187,6 +189,7 @@ _sleep(void *ident, struct lock_object *lock, int priority,
        }
        catch = priority & PCATCH;
        pri = priority & PRIMASK;
+
        /*
         * If we are already on a sleep queue, then remove us from that
         * sleep queue first.  We have to do this to handle recursive
@@ -194,6 +197,7 @@ _sleep(void *ident, struct lock_object *lock, int priority,
         */
        if (TD_ON_SLEEPQ(td))
                sleepq_remove(td, td->td_wchan);
+
        if (ident == &pause_wchan)
                flags = SLEEPQ_PAUSE;
        else
@@ -202,6 +206,7 @@ _sleep(void *ident, struct lock_object *lock, int priority,
                flags |= SLEEPQ_INTERRUPTIBLE;
        if (priority & PBDRY)
                flags |= SLEEPQ_STOP_ON_BDRY;
+
        sleepq_lock(ident);
        CTR5(KTR_PROC, "sleep: thread %ld (pid %ld, %s) on %s (%p)",
            td->td_tid, p->p_pid, td->td_name, wmesg, ident);
@@ -216,6 +221,7 @@ _sleep(void *ident, struct lock_object *lock, int priority,
        } else
                /* GCC needs to follow the Yellow Brick Road */
                lock_state = -1;
+
        /*
         * We put ourselves on the sleep queue and start our timeout
         * before calling thread_suspend_check, as we could stop there,
@@ -234,26 +240,14 @@ _sleep(void *ident, struct lock_object *lock, int priority,
                lock_state = class->lc_unlock(lock);
                sleepq_lock(ident);
        }
-//     printf("_sleep 1\n");
-       if (timo && catch) {
-//             printf("_sleep 1.1\n");
+       if (timo && catch)
                rval = sleepq_timedwait_sig(ident, pri);
-//             printf("_sleep 1.2\n");
-       }
-       else if (timo) {
-//             printf("_sleep 1.3\n");
+       else if (timo)
                rval = sleepq_timedwait(ident, pri);
-//             printf("_sleep 1.4\n");
-       }
-       else if (catch) {
-//             printf("_sleep 1.5\n");
+       else if (catch)
                rval = sleepq_wait_sig(ident, pri);
-//             printf("_sleep 1.6\n");
-       }
        else {
-//             printf("_sleep 1.7\n");
                sleepq_wait(ident, pri);
-//             printf("_sleep 1.8\n");
                rval = 0;
        }
 #ifdef KTRACE
@@ -265,7 +259,6 @@ _sleep(void *ident, struct lock_object *lock, int priority,
                class->lc_lock(lock, lock_state);
                WITNESS_RESTORE(lock, lock_witness);
        }
-
        return (rval);
 }
 
@@ -604,17 +597,12 @@ kern_yield(int prio)
        td = curthread;
        DROP_GIANT();
        thread_lock(td);
-//#warning "kern_yield lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        if (prio == PRI_USER)
                prio = td->td_user_pri;
        if (prio >= 0)
                sched_prio(td, prio);
        mi_switch(SW_VOL | SWT_RELINQUISH, NULL);
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
        PICKUP_GIANT();
 }
 
index 66515a9..64b6c33 100644 (file)
@@ -3686,11 +3686,6 @@ umtx_thread_cleanup(struct thread *td)
        }
        mtx_unlock_spin(&umtx_lock);
        thread_lock(td);
-//#warning "umtx_thread_cleanup lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        sched_lend_user_prio(td, PRI_MAX);
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
 }
index d4350cb..5c2f86a 100644 (file)
@@ -341,9 +341,6 @@ sleepq_add(void *wchan, struct lock_object *lock, const char *wmesg, int flags,
                MPASS((flags & SLEEPQ_TYPE) == sq->sq_type);
                LIST_INSERT_HEAD(&sq->sq_free, td->td_sleepqueue, sq_hash);
        }
-//#warning "sleepq_add lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        thread_lock(td);
        TAILQ_INSERT_TAIL(&sq->sq_blocked[queue], td, td_slpq);
        sq->sq_blockedcnt[queue]++;
@@ -357,8 +354,6 @@ sleepq_add(void *wchan, struct lock_object *lock, const char *wmesg, int flags,
                if (flags & SLEEPQ_STOP_ON_BDRY)
                        td->td_flags |= TDF_SBDRY;
        }
-//     intr_restore(rflags);
-//     enable_intr();
        thread_unlock(td);
 }
 
@@ -430,11 +425,7 @@ sleepq_catch_signals(void *wchan, int pri)
         * we can switch immediately.  Otherwise do the signal processing
         * directly.
         */
-
        thread_lock(td);
-//#warning "sleepq_catch_signals lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        if ((td->td_flags & (TDF_NEEDSIGCHK | TDF_NEEDSUSPCHK)) == 0) {
                sleepq_switch(wchan, pri);
                return (0);
@@ -469,9 +460,6 @@ sleepq_catch_signals(void *wchan, int pri)
        mtx_lock_spin(&sc->sc_lock);
        PROC_UNLOCK(p);
        thread_lock(td);
-//     intr_restore(rflags);
-//     enable_intr();
-
        PROC_SUNLOCK(p);
        if (ret == 0) {
                sleepq_switch(wchan, pri);
@@ -514,6 +502,7 @@ sleepq_switch(void *wchan, int pri)
        sc = SC_LOOKUP(wchan);
        mtx_assert(&sc->sc_lock, MA_OWNED);
        THREAD_LOCK_ASSERT(td, MA_OWNED);
+
        /* 
         * If we have a sleep queue, then we've already been woken up, so
         * just return.
@@ -522,6 +511,7 @@ sleepq_switch(void *wchan, int pri)
                mtx_unlock_spin(&sc->sc_lock);
                return;
        }
+
        /*
         * If TDF_TIMEOUT is set, then our sleep has been timed out
         * already but we are still on the sleep queue, so dequeue the
@@ -529,11 +519,8 @@ sleepq_switch(void *wchan, int pri)
         */
        if (td->td_flags & TDF_TIMEOUT) {
                MPASS(TD_ON_SLEEPQ(td));
-//             printf("sleepq_switch 1\n");
                sq = sleepq_lookup(wchan);
-//             printf("sleepq_switch 2\n");
                if (sleepq_resume_thread(sq, td, 0)) {
-//                     printf("sleepq_switch 3\n");
 #ifdef INVARIANTS
                        /*
                         * This thread hasn't gone to sleep yet, so it
@@ -542,7 +529,6 @@ sleepq_switch(void *wchan, int pri)
                        panic("not waking up swapper");
 #endif
                }
-//             printf("sleepq_switch 4\n");
                mtx_unlock_spin(&sc->sc_lock);
                return;         
        }
@@ -552,7 +538,6 @@ sleepq_switch(void *wchan, int pri)
 #endif
        MPASS(td->td_sleepqueue == NULL);
        sched_sleep(td, pri);
-//#warning "sleepq_switch lock removed"
        thread_lock_set(td, &sc->sc_lock);
        SDT_PROBE0(sched, , , sleep);
        TD_SET_SLEEPING(td);
@@ -635,13 +620,8 @@ sleepq_wait(void *wchan, int pri)
        td = curthread;
        MPASS(!(td->td_flags & TDF_SINTR));
        thread_lock(td);
-//#warning "sleepq_wait lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        sleepq_switch(wchan, pri);
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
 }
 
 /*
@@ -657,10 +637,6 @@ sleepq_wait_sig(void *wchan, int pri)
        rcatch = sleepq_catch_signals(wchan, pri);
        rval = sleepq_check_signals();
        thread_unlock(curthread);
-//#warning "sleepq_wait_sig unlock removed"
-//     register_t rflags;
-//     intr_restore(rflags);
-//     enable_intr();
        if (rcatch)
                return (rcatch);
        return (rval);
@@ -679,14 +655,9 @@ sleepq_timedwait(void *wchan, int pri)
        td = curthread;
        MPASS(!(td->td_flags & TDF_SINTR));
        thread_lock(td);
-//#warning "sleepq_timedwait lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        sleepq_switch(wchan, pri);
        rval = sleepq_check_timeout();
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
 
        return (rval);
 }
@@ -749,9 +720,9 @@ sleepq_resume_thread(struct sleepqueue *sq, struct thread *td, int pri)
        THREAD_LOCK_ASSERT(td, MA_OWNED);
        sc = SC_LOOKUP(sq->sq_wchan);
        mtx_assert(&sc->sc_lock, MA_OWNED);
-//     printf("sleepq_resume_thread 1\n");
+
        SDT_PROBE2(sched, , , wakeup, td, td->td_proc);
-//     printf("sleepq_resume_thread 2\n");
+
        /* Remove the thread from the queue. */
        sq->sq_blockedcnt[td->td_sqqueue]--;
        TAILQ_REMOVE(&sq->sq_blocked[td->td_sqqueue], td, td_slpq);
@@ -794,7 +765,6 @@ sleepq_resume_thread(struct sleepqueue *sq, struct thread *td, int pri)
         */
        if (TD_IS_SLEEPING(td)) {
                TD_CLR_SLEEPING(td);
-//             printf("sleepq_resume_thread: %p\n", td);
                return (setrunnable(td));
        }
        return (0);
@@ -869,13 +839,8 @@ sleepq_signal(void *wchan, int flags, int pri, int queue)
        }
        MPASS(besttd != NULL);
        thread_lock(besttd);
-//#warning "sleepq_signal lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        wakeup_swapper = sleepq_resume_thread(sq, besttd, pri);
        thread_unlock(besttd);
-//     intr_restore(rflags);
-//     enable_intr();
        return (wakeup_swapper);
 }
 
@@ -902,14 +867,9 @@ sleepq_broadcast(void *wchan, int flags, int pri, int queue)
        wakeup_swapper = 0;
        TAILQ_FOREACH_SAFE(td, &sq->sq_blocked[queue], td_slpq, tdn) {
                thread_lock(td);
-//#warning "sleepq_broadcast lock removed"
-//             register_t rflags;
-//             rflags = intr_disable();
                if (sleepq_resume_thread(sq, td, pri))
                        wakeup_swapper = 1;
                thread_unlock(td);
-//             intr_restore(rflags);
-//             enable_intr();
        }
        return (wakeup_swapper);
 }
@@ -937,9 +897,6 @@ sleepq_timeout(void *arg)
         * it is.
         */
        thread_lock(td);
-//#warning "sleepq_timeout lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        if (TD_IS_SLEEPING(td) && TD_ON_SLEEPQ(td)) {
                wchan = td->td_wchan;
                sc = SC_LOOKUP(wchan);
@@ -949,8 +906,6 @@ sleepq_timeout(void *arg)
                td->td_flags |= TDF_TIMEOUT;
                wakeup_swapper = sleepq_resume_thread(sq, td, 0);
                thread_unlock(td);
-//             intr_restore(rflags);
-//             enable_intr();
                if (wakeup_swapper)
                        kick_proc0();
                return;
@@ -965,8 +920,6 @@ sleepq_timeout(void *arg)
        if (TD_ON_SLEEPQ(td)) {
                td->td_flags |= TDF_TIMEOUT;
                thread_unlock(td);
-//             intr_restore(rflags);
-//             enable_intr();
                return;
        }
 
@@ -987,8 +940,6 @@ sleepq_timeout(void *arg)
        } else
                td->td_flags |= TDF_TIMOFAIL;
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
        if (wakeup_swapper)
                kick_proc0();
 }
@@ -1023,16 +974,10 @@ sleepq_remove(struct thread *td, void *wchan)
        }
        /* Thread is asleep on sleep queue sq, so wake it up. */
        thread_lock(td);
-//#warning "sleepq_remove lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
-
        MPASS(sq != NULL);
        MPASS(td->td_wchan == wchan);
        wakeup_swapper = sleepq_resume_thread(sq, td, 0);
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
        sleepq_release(wchan);
        if (wakeup_swapper)
                kick_proc0();
index f760212..31ea52d 100644 (file)
@@ -477,14 +477,9 @@ taskqueue_start_threads(struct taskqueue **tqp, int count, int pri,
                        continue;
                td = tq->tq_threads[i];
                thread_lock(td);
-//#warning "taskqueue_start_threads lock removed"
-//             register_t rflags;
-//             rflags = intr_disable();
                sched_prio(td, pri);
                sched_add(td, SRQ_BORING);
                thread_unlock(td);
-//             intr_restore(rflags);
-//             enable_intr();
        }
 
        return (0);
index f7cc1cd..e57ab9e 100644 (file)
@@ -184,15 +184,10 @@ ast(struct trapframe *framep)
         * ast() will be called again.
         */
        thread_lock(td);
-//#warning "ast lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
        flags = td->td_flags;
        td->td_flags &= ~(TDF_ASTPENDING | TDF_NEEDSIGCHK | TDF_NEEDSUSPCHK |
            TDF_NEEDRESCHED | TDF_ALRMPEND | TDF_PROFPEND | TDF_MACPEND);
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
        PCPU_INC(cnt.v_trap);
 
        if (td->td_ucred != p->p_ucred) 
@@ -227,14 +222,9 @@ ast(struct trapframe *framep)
                        ktrcsw(1, 1, __func__);
 #endif
                thread_lock(td);
-//#warning "ast lock removed"
-//             register_t rflags;
-//             rflags = intr_disable();
                sched_prio(td, td->td_user_pri);
                mi_switch(SW_INVOL | SWT_NEEDRESCHED, NULL);
                thread_unlock(td);
-//             intr_restore(rflags);
-//             enable_intr();
 #ifdef KTRACE
                if (KTRPOINT(td, KTR_CSW))
                        ktrcsw(0, 1, __func__);
index d29c8bf..43accca 100644 (file)
@@ -1918,13 +1918,8 @@ sched_sync(void)
                if (syncer_state != SYNCER_RUNNING ||
                    time_uptime == starttime) {
                        thread_lock(td);
-//#warning "sched_sync lock removed"
-//                     register_t rflags;
-//                     rflags = intr_disable();
                        sched_prio(td, PPAUSE);
                        thread_unlock(td);
-//                     intr_restore(rflags);
-//                     enable_intr();
                }
                if (syncer_state != SYNCER_RUNNING)
                        cv_timedwait(&sync_wakeup, &sync_mtx,
index 10ee80f..6ba96e1 100644 (file)
@@ -72,6 +72,7 @@ static int zero_state;
 static int
 vm_page_zero_check(void)
 {
+
        if (!idlezero_enable)
                return (0);
        /*
@@ -121,7 +122,6 @@ vm_pagezero(void __unused *arg)
 
        mtx_lock(&vm_page_queue_free_mtx);
        for (;;) {
-//             printf("vm_pagezero begin\n");
                if (vm_page_zero_check()) {
                        vm_page_zero_idle();
 #ifndef PREEMPTION
@@ -133,12 +133,9 @@ vm_pagezero(void __unused *arg)
 #endif
                } else {
                        wakeup_needed = TRUE;
-//                     printf("vm_pagezero msleep enter\n");
                        msleep(&zero_state, &vm_page_queue_free_mtx, 0,
                            "pgzero", hz * 300);
-//                     printf("vm_pagezero msleep leave\n");
                }
-//             printf("vm_pagezero done\n");
        }
 }
 
@@ -153,11 +150,7 @@ pagezero_start(void __unused *arg)
        if (error)
                panic("pagezero_start: error %d\n", error);
        td = FIRST_THREAD_IN_PROC(p);
-
        thread_lock(td);
-//#warning "pagezero_start lock removed"
-//     register_t rflags;
-//     rflags = intr_disable();
 
        /* We're an idle task, don't count us in the load. */
        td->td_flags |= TDF_NOLOAD;
@@ -165,7 +158,5 @@ pagezero_start(void __unused *arg)
        sched_prio(td, PRI_MAX_IDLE);
        sched_add(td, SRQ_BORING);
        thread_unlock(td);
-//     intr_restore(rflags);
-//     enable_intr();
 }
 SYSINIT(pagezero, SI_SUB_KTHREAD_VM, SI_ORDER_ANY, pagezero_start, NULL);