1 |
\chapter{SMP issues} |
\chapter{SMP issues} \label{smp:all} \index{smp\_processor\_id} |
2 |
\section{SMP issues related to process scheduling} |
\section{SMP related macros} |
3 |
|
In a SMP configured kernel, basic boot actions are performed by single CPU. Then, this cpu just wakes up other cpus. The complete kernel code is written SMP transparent by making use of macros for SMP and non-SMP mode. An example of system generic smp code is given below. |
4 |
|
\begin{verbatim} |
5 |
|
|
6 |
|
#ifdef CONFIG_SMP |
7 |
|
extern int smp_call_function (void (*func) (void *info), void *info, |
8 |
|
int retry, int wait); |
9 |
|
#define smp_processor_id() (current_thread_info()->cpu) |
10 |
|
|
11 |
|
#else |
12 |
|
|
13 |
|
#define smp_call_function(func,info,retry,wait) ({ 0; }) |
14 |
|
#define smp_processor_id() 0 |
15 |
|
|
16 |
|
#endif |
17 |
|
\end{verbatim} |
18 |
|
|
19 |
|
Thus, for a SMP kernel, the funtions/macros access the appropriate structure from the cpu subsytem while for a non-SMP kernel, the macros default to the single cpu counterpart actions. |
20 |
|
\section{Boot in SMP mode} \label{smp:boot} |
21 |
|
\subsection{Function smp\_init code} |
22 |
|
\subsection{Function smp\_boot\_cpus code} \index{smp\_boot\_cpus} |
23 |
|
\section{SMP issues related to process Management} |
24 |
|
\subsection{Function smp\_tune\_scheduling code} |