[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1296058216.7567.21.camel@nimitz>
Date: Wed, 26 Jan 2011 08:10:16 -0800
From: Dave Hansen <dave@...ux.vnet.ibm.com>
To: Steffen Klassert <steffen.klassert@...unet.com>
Cc: Eric Paris <eparis@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-security-module@...r.kernel.org
Subject: Re: flex_array related problems on selinux policy loading
On Wed, 2011-01-26 at 11:23 +0100, Steffen Klassert wrote:
> Yes, I thought a moment on allocating the basic struct flex_array
> in any case. But I immediately stopped thinking about this when I saw that
> I would allocate a whole page that I don't need afterwards. For the moment
> I don't see any sane way to allocate just the metadata as long as the
> struct flex_array has a fixed size.
>
> Btw. why the struct flex_array needs to have page size?
It was designed as an alternative to _large_ allocations and we didn't
expect people to want to use it for small things. But, it doesn't
_need_ to stay that way, we just did it like that for simplicity.
> If we would make
> flex_array of dynamic size, say metadata plus the maximum size of the array
> in the case that the metadata and the array fit into a single page, and
> metadata plus space for all the base pointers we need to dereference the
> parts, if the metadata and array is beyond page size. With this, the struct
> flex_array would have a reasonable size in any case, even if the array to
> store is small or of zero size.
Sounds like a good idea to me. Done right, it should only really affect
the allocation path since we use kmalloc() already, and we can still
plain kfree() it.
-- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists