Re: lock_kernel: why it is empty?

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

 



Le Wed, 26 Dec 2007 11:11:02 +0300,
"Dave Milter" <davemilter@xxxxxxxxx> a écrit :

> I wonder, why if I choose PREEMPT_VOLUNTARY "lock_kernel" become
> something like do { } while (0),
> there is no need serialization in this mode?

As explained in the kernel configuration help text for this option,
voluntary preemption consists in adding explicit preemption points in
the kernel. No kernel code will be preempted if it doesn't explicity
calls might_sleep() (see http://lwn.net/Articles/93604/). So, it's up
to you to not call might_sleep() when you're accessing shared data
structures. That's why lock_kernel() is empty in voluntary preemption:
it's simply up to you to not call might_sleep() at the wrong places.

However, with full preemption, it is of course different. Preemption
can take place at any time, so it may occur when kernel code is
accessing shared data structures. So with full preemption, some kind of
locking mechanism is used: lock_kernel().

Sincerly,

Thomas
-- 
Thomas Petazzoni, thomas.petazzoni@xxxxxxxx, http://thomas.enix.org
Jabber, thomas.petazzoni@xxxxxxxxx
Toulibre, http://www.toulibre.org - APRIL, http://www.april.org
Fingerprint : 0BE1 4CF3 CEA4 AC9D CC6E  1624 F653 CB30 98D3 F7A7

Attachment: signature.asc
Description: PGP signature


[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