From owner-freebsd-geom@FreeBSD.ORG Sat Dec 30 08:03:06 2006 Return-Path: X-Original-To: freebsd-geom@freebsd.org Delivered-To: freebsd-geom@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 11B8516A47B for ; Sat, 30 Dec 2006 08:03:06 +0000 (UTC) (envelope-from arne_woerner@yahoo.com) Received: from web30306.mail.mud.yahoo.com (web30306.mail.mud.yahoo.com [209.191.69.68]) by mx1.freebsd.org (Postfix) with SMTP id B20A713C471 for ; Sat, 30 Dec 2006 08:03:05 +0000 (UTC) (envelope-from arne_woerner@yahoo.com) Received: (qmail 14319 invoked by uid 60001); 30 Dec 2006 08:03:05 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=QOcYQQ+ZpdLvB+XsTEZkH9Es9a1WbSStKzo872GLJoj5MkmTyEPnalv7gQL3kQen55kAvpXLoW5gj5dJJPny3x8gcTp6CHxnejn6npSyKT1KOEza+4ChOBtUnleR7joWNv1eArCE10iISaFuI/M9Ie63+Dx9uVT/WUudC7u1jq0= ; Message-ID: <20061230080305.14317.qmail@web30306.mail.mud.yahoo.com> X-YMail-OSG: F33IurUVM1mohvzk0Bwta8e7IX0OrbxTxDAL2tJRHabXwMPDpVpmZuFDT8TwDT4jr7JaMCG7eUQ9oXM3.IDSmPkaY7tg0eKC3sQfHsd7Iaso0wu1hjAXckTBR__P5vDlXhVysZkIm8hRXOM- Received: from [85.212.9.158] by web30306.mail.mud.yahoo.com via HTTP; Sat, 30 Dec 2006 00:03:05 PST Date: Sat, 30 Dec 2006 00:03:05 -0800 (PST) From: "R. B. Riddick" To: Marius Nuennerich , freebsd-geom@freebsd.org In-Reply-To: <20061229233904.1b90ba62@sol.hackerzberg.local> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: Subject: Re: GEOM_AES using malloc with M_WAITOK X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Dec 2006 08:03:06 -0000 --- Marius Nuennerich 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