Re: smp/non-smp kernel

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

 





On 3/9/07, Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote:
On Fri, 2007-03-09 at 06:20 +0000, my linux wrote:
>
> On 3/8/07, Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote:
>         On Tue, 2007-03-06 at 11:25 +0000, my linux wrote:
>         > Hi,
>         >
>         > How can I know  whether my machine booted with SMP and
>         non-SMP
>         > kernel ?   ( from kernel space)
>
>         that sounds like a weird thing to care about; drivers or
>         anything but
>         deep architecture code really shouldn't have this knowledge!
>
>         (for example preempt kernels basically make you have the same
>         rules as
>         smp anyway)
>
>
> #ifdef CONFIG_SMP
>         lock_kernel();
> #endif
>
> #ifdef CONFIG_PREEMPT
>         preempt_disable();
> #endif
>
> Is equivalant to
>
>         lock_kernel();
>         preempt_disable();
>
> in UP/SMP and preempt/non-preempt configuration ?

no, in fact your ifdefs are really incorrect.
the kernel makes those things no-ops IF THEY ARE. But your lock_kernel()
ifdef for example is really wrong if preempt is enabled!

CMIIW, when preempt is enabled  , lock_kernel() will disable preempt.

(also, don't use lock_kernel() in new code anyway)

Ok Sir.

Also could you please  elaborate little more on  what is  "wrong" with the ifdefs. Since I started working on linux few weeks back. :(

-mln

[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