Print this page
patch remove-dont-swap-flag


 206         ASSERT(t->t_sleepq == NULL);
 207         ASSERT(t->t_waitq == NULL);
 208         ASSERT(t->t_link == NULL);
 209 
 210         disp_lock_enter_high(&wq->wq_lock);
 211 
 212         /*
 213          * Can't enqueue anything on a blocked wait queue
 214          */
 215         if (wq->wq_blocked) {
 216                 disp_lock_exit_high(&wq->wq_lock);
 217                 return (0);
 218         }
 219 
 220         /*
 221          * Mark the time when thread is placed on wait queue. The microstate
 222          * accounting code uses this timestamp to determine wait times.
 223          */
 224         t->t_waitrq = gethrtime_unscaled();
 225 
 226         /*
 227          * Mark thread as not swappable.  If necessary, it will get
 228          * swapped out when it returns to the userland.
 229          */
 230         t->t_schedflag |= TS_DONT_SWAP;
 231         DTRACE_SCHED1(cpucaps__sleep, kthread_t *, t);
 232         waitq_link(wq, t);
 233 
 234         THREAD_WAIT(t, &wq->wq_lock);
 235         return (1);
 236 }
 237 
 238 /*
 239  * Change thread's priority while on the wait queue.
 240  * Dequeue and equeue it again so that it gets placed in the right place.
 241  */
 242 void
 243 waitq_change_pri(kthread_t *t, pri_t new_pri)
 244 {
 245         waitq_t *wq = t->t_waitq;
 246 
 247         ASSERT(THREAD_LOCK_HELD(t));
 248         ASSERT(ISWAITING(t));
 249         ASSERT(wq != NULL);
 250 




 206         ASSERT(t->t_sleepq == NULL);
 207         ASSERT(t->t_waitq == NULL);
 208         ASSERT(t->t_link == NULL);
 209 
 210         disp_lock_enter_high(&wq->wq_lock);
 211 
 212         /*
 213          * Can't enqueue anything on a blocked wait queue
 214          */
 215         if (wq->wq_blocked) {
 216                 disp_lock_exit_high(&wq->wq_lock);
 217                 return (0);
 218         }
 219 
 220         /*
 221          * Mark the time when thread is placed on wait queue. The microstate
 222          * accounting code uses this timestamp to determine wait times.
 223          */
 224         t->t_waitrq = gethrtime_unscaled();
 225 





 226         DTRACE_SCHED1(cpucaps__sleep, kthread_t *, t);
 227         waitq_link(wq, t);
 228 
 229         THREAD_WAIT(t, &wq->wq_lock);
 230         return (1);
 231 }
 232 
 233 /*
 234  * Change thread's priority while on the wait queue.
 235  * Dequeue and equeue it again so that it gets placed in the right place.
 236  */
 237 void
 238 waitq_change_pri(kthread_t *t, pri_t new_pri)
 239 {
 240         waitq_t *wq = t->t_waitq;
 241 
 242         ASSERT(THREAD_LOCK_HELD(t));
 243         ASSERT(ISWAITING(t));
 244         ASSERT(wq != NULL);
 245