From: Dan Magenheimer Subject: RE: big local array in routine in hypervisor Date: Tue, 27 Jan 2009 14:47:18 +0000 (GMT) Message-ID: <4393ab77-8a16-4675-bb9a-1432b399f3a7@default> References: Mime-Version: 1.0 Content-Type: text/plain; charset=Windows-1252 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser , "Xen-Devel (E-mail)" , George Dunlap List-Id: xen-devel@lists.xenproject.org > Does it *really* have to be multi-page contiguous? You=20 > couldn't for example > build your workspace out of a radix tree with page-sized leaves? > Or are you saying that maybe you can't allocate even a single=20 > page, or a > sub-page? In that case it would seem memory is so tight you=20 > have little > choice but to pre-reserve. I'm trying to use the lzo compression code now in Linux (as of 2.6.27 I think) in linux/lib/lzo. It uses a large static work area... which now that I look more carefully is actually 128kB!... apparently ffs2 (its sole user in Linux as of now) doesn't care about SMP? > So you want us to wastefully pre-reserve some space for you,=20 > but call it the > 'stack' to assuage your guilt? ;-) Point taken ;-) But the stack can be used by others and my pre-reserved space could not. > It's common practice not to have very > large stacks in kernels, since pre-reservation is wateful,=20 > dynamic growth is not necessarily feasible to implement, > and kernel code doesn't tend to need lots of local storage > or recursion. In Linux you'd be limited to 4kB, and > there's a lot more code there living under that stricter regime. True, but the history of most kernels goes back a bit farther than Xen's, back when memory density and cost was a factor of 1000x different. So... 4kb * 1000 is 4M ;-) > It's a slippery slope though, determining how much stack is=20 > enough and how > big a local array is too big. I generally end up having to=20 > check and fix big > stack frames from time to time, and I'm not sure that even=20 > doubling the > stack a few times would avoid that job! Agreed. It will never be enough. I'll live with the private static array for now. Dan