Messages in this thread | | | Date | Tue, 06 Jul 1999 21:48:57 +0100 | From | Jan-Simon Pendry <> | Subject | Re: Knowing which task is current in a CPU [ SMP ] |
| |
i can't imagine what algorithm you're writing but the answer to the question "what is running on cpu X" is inherently out of date unless you hold the run-queue lock.
what are you trying to implement?
jan-simon.
Hugo Varotto wrote: > > Hi, > > I'm currently doing some stuff with SMP kernels, and I'd like to know > which task is currently running in which CPU. I know that the variable > "current" is a pointer to a struct task that is currently running in the > CPU executing that portion of code. However, I'm not completely sure how > to get which task is currently running in the other CPUs. > > In particular, if smp_processor_id() returns me CPU 0, I'd like to know > which task is running in CPU 1 ( or 2 or 3 ). > > The only solution that I found is to go through all the runqueue, and > check the "has_cpu" field and "processor" field ( similar to how the > goodness function work ). However, I think that is very inefficient. > > Does anybody know of other ( more efficient ) way of doing this ? I'm > working with the 2.2.x series > > Thanks in advance, > > Hugo > > -- > Hugo Varotto > Computer Science Dept. > University of Pittsburgh > hvarotto@cs.pitt.edu > http://www.cs.pitt.edu/FORTS > > - > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.rutgers.edu > Please read the FAQ at http://www.tux.org/lkml/
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |