Mauricio Lin <mauriciolin2000@xxxxxxxxxxxx> writes: > Hi, > > --- borasahin@xxxxxxxxxxx escreveu: > >> On Tuesday 12 September 2006 18:14, Jakko Pastuchio wrote: >> > Hi all, >> > >> > How can I find out (from within a loadable module) how many CPUs >> are there >> > in the system ? > > NR_CPUS macro can help. NR_CPUS is the compile-time macro. Its value is maximum number of CPU on system (0-255). So, if you try it in loadable module, it will means constant value setted while compilation, not dependly from number of CPU on target system. > > You can access each CPU availabe for scheduling using > "for_each_online_cpu(cpu)" macro. Other macros that can help are > for_each_possible_cpu(cpu) and for_each_present_cpu(cpu). > > You can get more info about these macros from > linux/include/linux/cpumask.h. > > BR, > > Mauricio Lin. > >> > >> > Can I know on which CPU I (the current module) am running ? >> >> get_cpu(). >> >> > Can I choose a CPU to run on ? >> >> I think you should look for "CPU affinity" to begin with it. >> >> > thanks...! >> > Jakko >> > >> > -- >> > Kernelnewbies: Help each other learn about the Linux kernel. >> > Archive: http://mail.nl.linux.org/kernelnewbies/ >> > FAQ: http://kernelnewbies.org/faq/ >> >> -- >> Bora SAHIN >> >> -- >> Kernelnewbies: Help each other learn about the Linux kernel. >> Archive: http://mail.nl.linux.org/kernelnewbies/ >> FAQ: http://kernelnewbies.org/faq/ >> >> > > > > > > > _______________________________________________________ > Você quer respostas para suas perguntas? Ou você sabe muito e quer compartilhar seu conhecimento? Experimente o Yahoo! Respostas ! > http://br.answers.yahoo.com/ > > -- > Kernelnewbies: Help each other learn about the Linux kernel. > Archive: http://mail.nl.linux.org/kernelnewbies/ > FAQ: http://kernelnewbies.org/faq/ > > -- Maxim 'Zert' Treskin Email: zerthurd(at)gmail.com XMPP : zert(at)jabber.ru Linux Developer Eltex, Novosibirsk, Russia eltex.nsk.ru -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/