ima: use of radix tree cache indexing == massive waste of memory?

Eric Paris eparis at redhat.com
Mon Oct 18 18:13:16 UTC 2010


On Mon, 2010-10-18 at 10:56 -0700, Linus Torvalds wrote:
> On Mon, Oct 18, 2010 at 9:48 AM, Eric Paris <eparis at redhat.com> wrote:
> >
> > 1) IMA uses radix trees which end up wasting 500 bytes per inode because
> > the key is too sparse.  I've got a patch which uses an rbtree instead
> > I'm testing and will send along shortly.  I found it funny working on
> > the patch to see that Documentation/rbtree.txt says "This differs from
> > radix trees (which are used to efficiently store sparse arrays and thus
> > use long integer indexes to insert/access/delete nodes)"  Which flys in
> > the face of this report.
> 
> Please. Look at the report more carefully.
> 
> The radix tree memory use is disgusting. Yes. But it is absolutely NOT
> sufficient to try to just fix that part. Go back, look at the original
> report email, and this line in particular:
> 
>    2235648 2069791  92%    0.12K  69864       32    279456K iint_cache
> 
> There's 2.2 million iint_cache allocations too, each 128 bytes in
> size. That's still a quarter _gigabyte_ of crap that adds zero value
> at all.

That was #2 in my list of things to fix:
2) IMA creates an entire integrity structure for every inode even when
most or all of this structure will not be needed.

I'm stating with #1 since that was 2G of wasted space (thus far my
switch to rbtree seems to be surviving an xfstest) so I expect to send
the patch this afternoon.  #2 should attack the size of the iint_cache
entries.  #3 should attack the scalability.  I'm certainly hoping I
didn't miss part of the report....

-Eric



More information about the kernel mailing list