[LITMUS^RT] A global variable definition

Hang Su hangsu.cs at gmail.com
Fri Feb 17 20:12:17 CET 2012


Hi Glenn:

I just checked the book and browse some on-line documents. The first three
lines in scheduler_tick(void) are :

*    int cpu = smp_processor_id();
    struct rq *rq = cpu_rq(cpu);
    struct task_struct *curr = rq->curr;*

Here, curr points to currently running task of this running queue and
struct rq is also per-cpu variable. In original linux 2.6.32, it has two
queues, cfs queue and rt queue. After applying LITMUS patch, we have
another litmus_rq in struct rq. Anyway, only one process is currently
running for this per-cpu running queue. And it is may be from any of the
above three queues or idle task. So, what is the difference between curr
and current ? If they were the same, why do not use curr instead we have to
spend some time on deriving current.

Thanks.



On Fri, Feb 17, 2012 at 10:00 AM, Hang Su <hangsu.cs at gmail.com> wrote:

> Thanks for your tips. I will check that book.
>
>
> On Fri, Feb 17, 2012 at 9:50 AM, Glenn Elliott <gelliott at cs.unc.edu>wrote:
>
>> Hi Hang Su,
>>
>> "current" is a Linux thing.  "current" is a per-processor global variable
>> (it may actually be a macro, but it functions as a global variable) that
>> points the current process (aka task_struct) that is scheduled on the
>> processor that is executing the given code path.
>>
>> If you are going to be doing a lot of Linux kernel development, I highly
>> recommend that you get a copy of "Understanding the Linux Kernel" by Bovet
>> & Cesati (published by O'Reilly).  It has all this sort of information and
>> is a great reference.
>>
>> -Glenn
>>
>>
>> On Feb 17, 2012, at 10:39 AM, Hang Su wrote:
>>
>> Hi All:
>>
>> I am finding the definition of a global variable* current* used inside
>> scheduler_tick() under /kernel/sched.c. But I did not get where it is.
>>
>> Thanks.
>> _______________________________________________
>> litmus-dev mailing list
>> litmus-dev at lists.litmus-rt.org
>> https://lists.litmus-rt.org/listinfo/litmus-dev
>>
>>
>>
>> _______________________________________________
>> litmus-dev mailing list
>> litmus-dev at lists.litmus-rt.org
>> https://lists.litmus-rt.org/listinfo/litmus-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.litmus-rt.org/pipermail/litmus-dev/attachments/20120217/29a2e808/attachment.html>


More information about the litmus-dev mailing list