2664 * on the right queue, but since this isn't
2665 * a performance-critical operation it doesn't
2666 * seem worth the extra code and complexity.
2667 *
2668 * If the thread is weakbound to the cpu then it will
2669 * resist the new binding request until the weak
2670 * binding drops. The cpu_surrender or requeueing
2671 * below could be skipped in such cases (since it
2672 * will have no effect), but that would require
2673 * thread_allowmigrate to acquire thread_lock so
2674 * we'll take the very occasional hit here instead.
2675 */
2676 if (tp->t_state == TS_ONPROC) {
2677 cpu_surrender(tp);
2678 } else if (tp->t_state == TS_RUN) {
2679 cpu_t *ocp = tp->t_cpu;
2680
2681 (void) dispdeq(tp);
2682 setbackdq(tp);
2683 /*
2684 * Either on the bound CPU's disp queue now,
2685 * or swapped out or on the swap queue.
2686 */
2687 ASSERT(tp->t_disp_queue == cp->cpu_disp ||
2688 tp->t_weakbound_cpu == ocp ||
2689 (tp->t_schedflag & (TS_LOAD | TS_ON_SWAPQ))
2690 != TS_LOAD);
2691 }
2692 }
2693 }
2694
2695 /*
2696 * Our binding has changed; set TP_CHANGEBIND.
2697 */
2698 tp->t_proc_flag |= TP_CHANGEBIND;
2699 aston(tp);
2700
2701 thread_unlock(tp);
2702
2703 return (0);
2704 }
2705
2706 #if CPUSET_WORDS > 1
2707
2708 /*
2709 * Functions for implementing cpuset operations when a cpuset is more
2710 * than one word. On platforms where a cpuset is a single word these
|
2664 * on the right queue, but since this isn't
2665 * a performance-critical operation it doesn't
2666 * seem worth the extra code and complexity.
2667 *
2668 * If the thread is weakbound to the cpu then it will
2669 * resist the new binding request until the weak
2670 * binding drops. The cpu_surrender or requeueing
2671 * below could be skipped in such cases (since it
2672 * will have no effect), but that would require
2673 * thread_allowmigrate to acquire thread_lock so
2674 * we'll take the very occasional hit here instead.
2675 */
2676 if (tp->t_state == TS_ONPROC) {
2677 cpu_surrender(tp);
2678 } else if (tp->t_state == TS_RUN) {
2679 cpu_t *ocp = tp->t_cpu;
2680
2681 (void) dispdeq(tp);
2682 setbackdq(tp);
2683 /*
2684 * On the bound CPU's disp queue now.
2685 */
2686 ASSERT(tp->t_disp_queue == cp->cpu_disp ||
2687 tp->t_weakbound_cpu == ocp);
2688 }
2689 }
2690 }
2691
2692 /*
2693 * Our binding has changed; set TP_CHANGEBIND.
2694 */
2695 tp->t_proc_flag |= TP_CHANGEBIND;
2696 aston(tp);
2697
2698 thread_unlock(tp);
2699
2700 return (0);
2701 }
2702
2703 #if CPUSET_WORDS > 1
2704
2705 /*
2706 * Functions for implementing cpuset operations when a cpuset is more
2707 * than one word. On platforms where a cpuset is a single word these
|