Allocating memory with spinlock held

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

 



Hello all,

Is the following code valid ???

foo() {
...........
spin_lock(lock);
ptr = kzalloc(size, GFP_KERNEL);
spin_unlock(lock);
.....
}


I guess the answer is no, but would like to confirm. Detailed/all
possible reasons for not doing so are welcome. IIRC, I was getting a
kernel crash with similar code with error message as "spinlock bug :
unlocked on wrong CPU" which looked like it was getting locked on one
cpu and due to memory allocation was getting unlocked from another
cpu.

-- 
Thanks -
Manish
==================================
[$\*.^ -- I miss being one of them
==================================

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