lkml.org 
[lkml]   [1999]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectKnowing which task is current in a CPU [ SMP ]

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/

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.043 / U:0.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site