Re: bus_dmamem_alloc() can't handle large NOWAIT requests

From: Julian Elischer <julian_at_elischer.org>
Date: Wed, 12 Jan 2005 11:52:20 -0800
John Baldwin wrote:

> Unforunately, "sleep" is a bit of an overloaded term in the kernel.  
> Blocking on a mutex is not considered a "sleep" quite like msleep() or 
> cv_wait() in that a mutex will eventually be released (barring an 
> infinite loop bug) and thus a thread blocked on a lock won't sleep 
> forever.  msleep() and cv_wait() on the other hand do not have the 
> same guarantee.  M_NOWAIT means that msleep() and cv_wait() won't be 
> called; it is ok to block on a mutex with M_NOWAIT however.  I tried 
> to explain this difference in semantics some in the glossary of the 
> SMP chapter in the kernel devbook. 


The problem is that people may think about a call with M_NOWAIT for 
different reasons.
Sometimes it is to ensure that the response time is limitted, even if 
that means that an error
may be returned, while others may call it because they feel it stops the 
possibility of
recursion or some other interference..

The 2nd will not work in the current scheme where a mutex may block the 
thread.
The distinction needs to be drawn between
"don't  go away for a long time"
and
"don't switch to any other thread".
Received on Wed Jan 12 2005 - 18:52:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:26 UTC