On Mon, Dec 31, 2007 at 09:02:35AM -0800, micke wrote:
> Hi, if I in kernel-space, modifying the scheduler/dispatcher, in the
> swtch() (in disp.c) function and I want to know if the current thread
> and/or the next thread belongs to the rt class? Is there some built in
> function for this like "is_this_thread_a_rt_thread(thread)" ?
> 
> In Linux, kernel 2.6.23.9, in the main scheduler file, sched.c there is a
> function: task_has_rt_policy(task) that will return 1 or 0 depending on if
> the task have a rt policy(FIFO or RR) or not.
> 
> So my question is, is there a similar function in OpenSolaris that I can use?
> Or do I have to check the threads priority, that is, if the thread have a
> rt priority(100-159) to determine this?

Priority and scheduling class are independent because, using dispadmin,
the default ranges assigned to particular classes can be changed
(see, for example, rt_dptbl(4)).

If you want to know if something is in the RT class from common code,
it would look something like this:

int
is_rt_thread(kthread_t *tp)
{
        id_t cid;

        return (getcidbyname("RT", &cid) == 0 && tp->t_cid == cid);
}

I'm not sure what you're trying to determine this for, but be aware
that Solaris supports a variety of dynamically loadable scheduling
classes, so it may be more appropriate to invent a way for common
code to ask the particular scheduling backend, through its ops vector,
if it has a particular attribute, as opposed to having common code
strcmp against one particular backend and infer its attributes.

-Mike

-- 
Mike Shapiro, Solaris Kernel Development. blogs.sun.com/mws/
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to