[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Which types of locking should I use?
Hello, Jan.
Thank you for many times.
"Jan Hudec <bulb@xxxxxx>" wrote:
> GFP_NOFS in writeout path (->writepage and below) and GFP_KERNEL in all
Oh, I didn't know GFP_NOFS flag.
I found the description at http://lwn.net/Articles/22909/ and
http://www.win.tue.nl/~aeb/linux/lk/lk-11.html .
> however). Of course, you must move your allocations out of the critical
> section, which you should do anyway.
Does this mean I must not call kmalloc(GFP_KERNEL or GFP_NOFS)
inside critical section locked by a semaphore?
I introduced a new structure (arrays of 'const char *') in my functions.
The arrays are dynamically allocated and expanded as the system runs.
I need to use kmalloc() inside my critical section to append an element.
So I need to use spinlocks or semaphores.
> You should really study the existing locking scheme a bit. You should
> know, what can happen when and what states are considered consistent.
I've read "Unreliable Guide To Locking" for several times,
but I haven't fully understood yet.
I'm sorry I'm really a newbie to kernel programming.
Regards.
--
Tetsuo (a5497108 _at_ anet.ne.jp)
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/