Re: Kernel size increase of +256 KiB (was: Re: RPCSEC_GSS: Shareall credential caches on a per-transport basis)

From: Myklebust, Trond
Date: Thu Sep 12 2013 - 10:13:53 EST


On Thu, 2013-09-12 at 15:24 +0200, Geert Uytterhoeven wrote:
> On Mon, Sep 9, 2013 at 6:57 PM, Linux Kernel Mailing List
> <linux-kernel@xxxxxxxxxxxxxxx> wrote:
> > diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
> > index 5ec15bb..dc4b449 100644
> > --- a/net/sunrpc/auth_gss/auth_gss.c
> > +++ b/net/sunrpc/auth_gss/auth_gss.c
> > @@ -51,6 +51,7 @@
> > #include <linux/sunrpc/rpc_pipe_fs.h>
> > #include <linux/sunrpc/gss_api.h>
> > #include <asm/uaccess.h>
> > +#include <linux/hashtable.h>
> >
> > #include "../netns.h"
> >
> > @@ -71,6 +72,9 @@ static unsigned int gss_expired_cred_retry_delay = GSS_RETRY_EXPIRED;
> > * using integrity (two 4-byte integers): */
> > #define GSS_VERF_SLACK 100
> >
> > +static DEFINE_HASHTABLE(gss_auth_hash_table, 16);
> > +static DEFINE_SPINLOCK(gss_auth_hash_lock);
>
> Today's m68k/atari-defconfig kernel no longer boots, as it became larger than
> 4 MiB.
>
> bloat-o-meter tells me:
>
> function old new delta
> gss_auth_hash_table - 262144 +262144
>
> Woops...

Whoops indeed. The above should have declared 16 buckets, and not 1<<16.
I fell for Sasha's subtle trap...

> Are you trying to game Tim's survey? ;-)
> (question 13 at http://www.embeddedlinuxconference.com/cgi-bin/survey.cgi)
>
> Can this memory be allocated dynamically / only when it's used?

:-) It's declared inside a module, so that should already be the case,
however I'll send in a patch to change the above to the intended:

DEFINE_HASHTABLE(gss_auth_hash_table, 4);

Thanks Geert!

--
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@xxxxxxxxxx
www.netapp.com
N‹§²æìr¸›yúèšØb²X¬¶ÇvØ^–)Þ{.nÇ+‰·¥Š{±‘êçzX§¶›¡Ü}©ž²ÆzÚ&j:+v‰¨¾«‘êçzZ+€Ê+zf£¢·hšˆ§~†­†Ûiÿûàz¹®w¥¢¸?™¨è­Ú&¢)ßf”ù^jÇy§m…á@A«a¶Úÿ 0¶ìh®å’i