2013-09-12 13:24:23

by Geert Uytterhoeven

[permalink] [raw]
Subject: Kernel size increase of +256 KiB (was: Re: RPCSEC_GSS: Share all credential caches on a per-transport basis)

On Mon, Sep 9, 2013 at 6:57 PM, Linux Kernel Mailing List
<[email protected]> 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...

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?

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


2013-09-12 14:13:51

by Myklebust, Trond

[permalink] [raw]
Subject: Re: Kernel size increase of +256 KiB (was: Re: RPCSEC_GSS: Share all credential caches on a per-transport basis)

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
> <[email protected]> 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
[email protected]
http://www.netapp.com
????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2013-09-12 19:20:19

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: Kernel size increase of +256 KiB (was: Re: RPCSEC_GSS: Share all credential caches on a per-transport basis)

On Thu, Sep 12, 2013 at 4:13 PM, Myklebust, Trond
<[email protected]> wrote:
>> > --- 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,

Only for the modular case. What about builtin, e.g. for nfsroot?

Or is it better to not build in NFS_V4 support in that case?

config NFS_V4
If unsure, say Y.

config NFSD_V4
If unsure, say N.

So that's why my defconfig has NFS_V4 but not NFSD_V4.

> however I'll send in a patch to change the above to the intended:
>
> DEFINE_HASHTABLE(gss_auth_hash_table, 4);

Thanks, that's better! Booting again ;-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2013-09-12 20:17:32

by Myklebust, Trond

[permalink] [raw]
Subject: Re: Kernel size increase of +256 KiB (was: Re: RPCSEC_GSS: Share all credential caches on a per-transport basis)

On Thu, 2013-09-12 at 21:20 +0200, Geert Uytterhoeven wrote:
> On Thu, Sep 12, 2013 at 4:13 PM, Myklebust, Trond
> <[email protected]> wrote:
> >> > --- 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,
>
> Only for the modular case. What about builtin, e.g. for nfsroot?
>
> Or is it better to not build in NFS_V4 support in that case?
>
> config NFS_V4
> If unsure, say Y.
>
> config NFSD_V4
> If unsure, say N.
>
> So that's why my defconfig has NFS_V4 but not NFSD_V4.

It should be possible now to compile in NFSv3 support (and/or NFSv2),
while keeping NFSv4 a module. That will usually result in
CONFIG_SUNRPC_GSS=m...

Of course, if your defconfig doesn't have module support then, yes, your
only option to avoid compiling in rpcsec_gss is to not select NFSv4 at
all.

--
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
http://www.netapp.com
????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2013-09-13 06:23:59

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: Kernel size increase of +256 KiB (was: Re: RPCSEC_GSS: Share all credential caches on a per-transport basis)

On Thu, Sep 12, 2013 at 10:17 PM, Myklebust, Trond
<[email protected]> wrote:
>> Only for the modular case. What about builtin, e.g. for nfsroot?
>>
>> Or is it better to not build in NFS_V4 support in that case?
>>
>> config NFS_V4
>> If unsure, say Y.
>>
>> config NFSD_V4
>> If unsure, say N.
>>
>> So that's why my defconfig has NFS_V4 but not NFSD_V4.
>
> It should be possible now to compile in NFSv3 support (and/or NFSv2),
> while keeping NFSv4 a module. That will usually result in
> CONFIG_SUNRPC_GSS=m...

Indeed. Making NFS_V4 modular saves 102 KiB, i.e. 2.5% of a typical
almost-4-MiB kernel image!

> Of course, if your defconfig doesn't have module support then, yes, your
> only option to avoid compiling in rpcsec_gss is to not select NFSv4 at
> all.

It has. But it needs everything to boot (block, net, nfs) as built-in.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds