Print this page
patch remove-dont-swap-flag
patch remove-swapinout-class-ops

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/disp/rt.c
          +++ new/usr/src/uts/common/disp/rt.c
↓ open down ↓ 123 lines elided ↑ open up ↑
 124  124  static int      rt_doprio(kthread_t *, cred_t *, int, int *);
 125  125  static void     rt_exitclass(void *);
 126  126  static int      rt_canexit(kthread_t *, cred_t *);
 127  127  static void     rt_forkret(kthread_t *, kthread_t *);
 128  128  static void     rt_nullsys();
 129  129  static void     rt_parmsget(kthread_t *, void *);
 130  130  static void     rt_preempt(kthread_t *);
 131  131  static void     rt_setrun(kthread_t *);
 132  132  static void     rt_tick(kthread_t *);
 133  133  static void     rt_wakeup(kthread_t *);
 134      -static pri_t    rt_swapin(kthread_t *, int);
 135      -static pri_t    rt_swapout(kthread_t *, int);
 136  134  static pri_t    rt_globpri(kthread_t *);
 137  135  static void     rt_yield(kthread_t *);
 138  136  static int      rt_alloc(void **, int);
 139  137  static void     rt_free(void *);
 140  138  
 141  139  static void     rt_change_priority(kthread_t *, rtproc_t *);
 142  140  
 143  141  static id_t     rt_cid;         /* real-time class ID */
 144  142  static rtproc_t rt_plisthead;   /* dummy rtproc at head of rtproc list */
 145  143  static kmutex_t rt_dptblock;    /* protects realtime dispatch table */
↓ open down ↓ 17 lines elided ↑ open up ↑
 163  161          rt_exitclass,
 164  162          rt_canexit,
 165  163          rt_fork,
 166  164          rt_forkret,
 167  165          rt_parmsget,
 168  166          rt_parmsset,
 169  167          rt_nullsys,     /* stop */
 170  168          rt_nullsys,     /* exit */
 171  169          rt_nullsys,     /* active */
 172  170          rt_nullsys,     /* inactive */
 173      -        rt_swapin,
 174      -        rt_swapout,
 175  171          rt_nullsys,     /* trapret */
 176  172          rt_preempt,
 177  173          rt_setrun,
 178  174          rt_nullsys,     /* sleep */
 179  175          rt_tick,
 180  176          rt_wakeup,
 181  177          rt_donice,
 182  178          rt_globpri,
 183  179          rt_nullsys,     /* set_process_group */
 184  180          rt_yield,
↓ open down ↓ 710 lines elided ↑ open up ↑
 895  891  
 896  892  /*
 897  893   * Arrange for thread to be placed in appropriate location
 898  894   * on dispatcher queue.  Runs at splhi() since the clock
 899  895   * interrupt can cause RTBACKQ to be set.
 900  896   */
 901  897  static void
 902  898  rt_preempt(kthread_t *t)
 903  899  {
 904  900          rtproc_t *rtpp = (rtproc_t *)(t->t_cldata);
 905      -        klwp_t *lwp;
 906  901  
 907  902          ASSERT(THREAD_LOCK_HELD(t));
 908  903  
 909      -        /*
 910      -         * If the state is user I allow swapping because I know I won't
 911      -         * be holding any locks.
 912      -         */
 913      -        if ((lwp = curthread->t_lwp) != NULL && lwp->lwp_state == LWP_USER)
 914      -                t->t_schedflag &= ~TS_DONT_SWAP;
 915  904          if ((rtpp->rt_flags & RTBACKQ) != 0) {
 916  905                  rtpp->rt_timeleft = rtpp->rt_pquantum;
 917  906                  rtpp->rt_flags &= ~RTBACKQ;
 918  907                  setbackdq(t);
 919  908          } else
 920  909                  setfrontdq(t);
 921  910  
 922  911  }
 923  912  
 924  913  /*
↓ open down ↓ 12 lines elided ↑ open up ↑
 937  926          rtproc_t *rtpp = (rtproc_t *)(t->t_cldata);
 938  927  
 939  928          ASSERT(THREAD_LOCK_HELD(t));
 940  929  
 941  930          rtpp->rt_timeleft = rtpp->rt_pquantum;
 942  931          rtpp->rt_flags &= ~RTBACKQ;
 943  932          setbackdq(t);
 944  933  }
 945  934  
 946  935  /*
 947      - * Returns the priority of the thread, -1 if the thread is loaded or ineligible
 948      - * for swapin.
 949      - *
 950      - * FX and RT threads are designed so that they don't swapout; however, it
 951      - * is possible that while the thread is swapped out and in another class, it
 952      - * can be changed to FX or RT.  Since these threads should be swapped in as
 953      - * soon as they're runnable, rt_swapin returns SHRT_MAX, and fx_swapin
 954      - * returns SHRT_MAX - 1, so that it gives deference to any swapped out RT
 955      - * threads.
 956      - */
 957      -/* ARGSUSED */
 958      -static pri_t
 959      -rt_swapin(kthread_t *t, int flags)
 960      -{
 961      -        pri_t   tpri = -1;
 962      -
 963      -        ASSERT(THREAD_LOCK_HELD(t));
 964      -
 965      -        if (t->t_state == TS_RUN && (t->t_schedflag & TS_LOAD) == 0) {
 966      -                tpri = (pri_t)SHRT_MAX;
 967      -        }
 968      -
 969      -        return (tpri);
 970      -}
 971      -
 972      -/*
 973      - * Return an effective priority for swapout.
 974      - */
 975      -/* ARGSUSED */
 976      -static pri_t
 977      -rt_swapout(kthread_t *t, int flags)
 978      -{
 979      -        ASSERT(THREAD_LOCK_HELD(t));
 980      -
 981      -        return (-1);
 982      -}
 983      -
 984      -/*
 985  936   * Check for time slice expiration (unless thread has infinite time
 986  937   * slice).  If time slice has expired arrange for thread to be preempted
 987  938   * and placed on back of queue.
 988  939   */
 989  940  static void
 990  941  rt_tick(kthread_t *t)
 991  942  {
 992  943          rtproc_t *rtpp = (rtproc_t *)(t->t_cldata);
 993  944  
 994  945          ASSERT(MUTEX_HELD(&(ttoproc(t))->p_lock));
↓ open down ↓ 138 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX