Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

mutex_enter and kmem_alloc

0 views
Skip to first unread message

mujoo

unread,
Sep 16, 2008, 1:50:48 PM9/16/08
to
In the opensolaris code I see a lot of places where kmem_alloc(..,
KM_SLEEP) is being used in between calls to mutex_enter() and
mutex_exit(). Man page of mutex_enter() says that once mutex_enter()
is called calls to kmem_alloc() with KM_SLEEP should not be done.
Does this contradiction make sense?

Andrew Gabriel

unread,
Sep 30, 2008, 4:43:53 PM9/30/08
to
In article <1fed0b4c-b1c3-4e58...@k37g2000hsf.googlegroups.com>,

It's a guideline. There are cases where it's OK, but you have
to understand in detail how the kernel works to be sure you're
safe doing so. A common case where you'd need to do it is where
you need to avoid two or more threads simultaneously allocating
a single shared data structure which is done on the first pass
through a code path.

If you cite an example that concerns you, someone might comment
on it.

--
Andrew Gabriel
[email address is not usable -- followup in the newsgroup]

0 new messages