Re: Locks vs. Semaphores

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

 





Can Sar wrote:
Please ignore the below, figured it out.


Please enlighten the list too :)

--Swapnil


Can

On Mar 12, 2005, at 4:22 AM, Can Sar wrote:

Hi,

I have a module that copies things to userspace from a log using copy_to_user. I initially wrote the code using semaphores. However, the code is called from places where sleeping is not allowed so I am switching it to spinlocks. Before running into any issues with kmalloc returning NULL (because it now uses GFP_ATOMIC rather than GFP_KERNEL), copy_to_user automatically returns an error, when called under spinlock. I call spin_lock and spin_unlock (no interrupts are off) and have no clue what is causing this. Any advice? I feel like I need to pin pages in memory first or something, but shouldn't that not be a problem until much later?

Thank you very much for your help,
Can Sar


-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/




-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: 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