Re: smp/non-smp kernel

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

 



On Mon, 2007-03-12 at 12:50 +0000, my linux wrote:

>         >
>         >
>         > #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.

but not if you wrap it inside CONFIG_SMP !!! (and CONFIG_SMP is off)


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

they're both ugly and dangerous
ugly because they clutter the code
dangerous because you introduce bugs (see your own examples above)
-- 
if you want to mail me at work (you don't), use arjan (at) linux.intel.com
Test the interaction between Linux and your BIOS via http://www.linuxfirmwarekit.org


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[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