Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Dec 2006 00:03:05 -0800 (PST)
From:      "R. B. Riddick" <arne_woerner@yahoo.com>
To:        Marius Nuennerich <marius.nuennerich@gmx.net>, freebsd-geom@freebsd.org
Subject:   Re: GEOM_AES using malloc with M_WAITOK
Message-ID:  <20061230080305.14317.qmail@web30306.mail.mud.yahoo.com>
In-Reply-To: <20061229233904.1b90ba62@sol.hackerzberg.local>

next in thread | previous in thread | raw e-mail | index | archive | help
--- Marius Nuennerich <marius.nuennerich@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 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061230080305.14317.qmail>