RE: How to find CPU# for a per-cpu variable?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Why do you need this reverse lookup? You should only be accessing the per cpu variable for your current cpu (with preemption disabled) in your code. That’s how they are meant to work.

In any case, you can simply iterate across all the pointers to find out the cpu# (O(n) time). There does not seem to be any back index pointing to the corresponding cpu# in the structure.

A

>-----Original Message-----
>From: kernelnewbies-bounce@xxxxxxxxxxxx [mailto:kernelnewbies-
>bounce@xxxxxxxxxxxx] On Behalf Of Krishna Kumar
>Sent: Thursday, September 04, 2008 1:18 AM
>To: kernelnewbies@xxxxxxxxxxxx
>Cc: krikkku@xxxxxxxxx
>Subject: How to find CPU# for a per-cpu variable?
>
>Hi,
>
>There are macros to get a per-cpu address given a cpu# and a variable
>name. Is there any way the reverse can be done? Eg, the timer->base is
>per cpu. If I have the value of timer->base, can I find out which #cpu
>that address belongs to?
>
>Thanks,
>
>- KK
>
>
>
>      Connect with friends all over the world. Get Yahoo! India
>Messenger at http://in.messenger.yahoo.com/?wm=n/
>
>--
>To unsubscribe from this list: send an email with
>"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
>Please read the FAQ at http://kernelnewbies.org/FAQ

��.n��������+%����w�j)p���{.n����z�ޖw�n'���q���b�������v��m�����Y�����


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux