GEOM_AES using malloc with M_WAITOK

R. B. Riddick arne_woerner at yahoo.com
Sat Dec 30 00:03:06 PST 2006


--- Marius Nuennerich <marius.nuennerich at gmx.net> wrote:

> I'm new to geom and thought I'd take an easy class to learn. So I read
> geom_aes.c and noticed that it uses the M_WAITOK flag with g_malloc. In
> another place I read, that it is not OK to sleep in the g_up and g_down
> threads. Isn't this g_malloc called in one of these threads?
>
In both threads geom_aes calls g_malloc with M_WAITOK.
Both threads set the TDP_NOSLEEPING flag before they call the class' function.
On the other hand side it is allowed to use mtx_lock() in those threads,
although it can cause delays, too (maybe those delays are different from
sleep?).

In the ..._start() function it would be easy to push back the request for later
processing with g_io_deliver(...,ENOMEM).

In the ..._done() function it would be not so easy, so that this memory, that
is needed for each and every read request, should be allocated somewhere else
and should have a pointer stored in softc (e. g. in ..._create()).

-Arne

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the freebsd-geom mailing list