From owner-freebsd-arch Wed Jan 22 22:48:30 2003 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0EA6737B401; Wed, 22 Jan 2003 22:48:29 -0800 (PST) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id AC73443F1E; Wed, 22 Jan 2003 22:48:28 -0800 (PST) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id 780BAAE2AB; Wed, 22 Jan 2003 22:48:28 -0800 (PST) Date: Wed, 22 Jan 2003 22:48:28 -0800 From: Alfred Perlstein To: "M. Warner Losh" Cc: bmilekic@unixdaemons.com, hsu@FreeBSD.ORG, arch@FreeBSD.ORG Subject: Re: Alfre's malloc changes: the next step Message-ID: <20030123064828.GY42333@elvis.mu.org> References: <20030122162531.B77209@unixdaemons.com> <20030122.215336.55300145.imp@bsdimp.com> <20030123050542.GX42333@elvis.mu.org> <20030122.222440.14643762.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030122.222440.14643762.imp@bsdimp.com> User-Agent: Mutt/1.4i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * M. Warner Losh [030122 21:25] wrote: > In message: <20030123050542.GX42333@elvis.mu.org> > Alfred Perlstein writes: > : Encouraging the user to use M_NOWAIT to get around all these problems > : is not a solution. > > What is the solution then? Waiting? Why not dropping the request? > I'm not necessarily encouraging M_NOWAIT in these cases. I am telling > you that M_NOWAIT is absolutely required for some applications and you > are picking nits with the examples I give. The only place where it really makes any sense is interrupts where pre-alloc is impossible, or code that runs in the low memory deadlock avoidance path. > : Either locks are being held too long, or allocations are being done > : in the wrong places. > > There's lots of code in the tree that's way wrong then. Yup. > : When we have proper priority inheritance and low memory callbacks > : then we will not have to worry about latency. > > I'm interest in this. Do you have references that explain what you'd > have in mind? It would take some work, but the idea being that any lock we have in the kernel needs an "owner" slot so that if a high priority thread blocks on it we loan its prio to the thread that holds the lock. The low memory callback is like what we have with mbufs, such that subsystems can register a callback that will be called when the system is low on resources so that it can toss out data it might not need. > > : M_NOWAIT should be the exception if even allowed at all. > > You have to do it in interrupt context, where if you can't get memory > you drop the request to rate limit things coming in. There are other > applications that need the "allocate and send or drop" semantics. We > have several at work: If you don't do something on time, then you > shouldn't do it at all. Not having the ability to get memory w/o > waiting can be a big problem. Usually we prealloc, but we can't > always prealloc everything since packets can come in any time... Which is one of the few the exceptions. I know that we need M_NOWAIT, but it's should not be considered in the toolbox we use to lock down the kernel. :) -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message