Thread (3 messages) 3 messages, 2 authors, 2011-11-13

why does the kernel use mutex to protect the address_space structure

From: Zheng Da <hidden>
Date: 2011-11-13 20:08:33

On Fri, Nov 4, 2011 at 12:44 AM, Jimmy Pan [off-list ref] wrote:
quoted
I try to understand why the kernel uses mutex to protect the
address_space structure. I checked the critical areas protected by
i_mmap_mutex, and didn't see these areas use IO. I don't see why we
can't use spin locks. Do I miss something? It seems most of critical
areas provided by i_mmap_mutex aren't very large.
In my knowledge, when you use mutex, you can go to sleep, if you use spin lock,
the thread has to busy wait, spin lock causes cpu waste, while mutex
cannot be used
under interrupt context.
Right. The problem is that the critical areas protected by the mutex
are pretty small. There is no reason to switch context, which just
causes more overhead, unless I miss something.

Thanks,
Da
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help