Re: [PATCH] module: kzalloc mod->ref

Takashi Iwai
2009-01-14T16:26:27Z

At Wed, 14 Jan 2009 10:58:59 -0500,
Kyle McMartin wrote:
>
> On Wed, Jan 14, 2009 at 10:09:59AM +0100, Takashi Iwai wrote:
> > At Tue, 13 Jan 2009 22:35:33 -0500,
> > Kyle McMartin wrote:
> > >
> > > From: Kyle McMartin <kyle@redhat.com>
> > >
> > > Dynamically allocate mod->ref instead of fixing it in the struct module.
> > > Reduces on disk space wasted in the module .ko, and kills a loop
> > > initializing the local_t it contains since we can just kzalloc it.
> > >
> > > This matters when we're talking about large NR_CPUS.
> > >
> > > Signed-off-by: Kyle McMartin <kyle@redhat.com>
> > > ---
> > > The patch removing cacheline_aligned from struct module_ref should be
> > > applied as well to cut down on the amount of memory we allocate. This
> > > patch makes a nice stopgap until we have per_cpu module references.
> > >
> > > cheers, Kyle
> >
> > Similar patches (including mine) have been already posted, but no
> > proceed until now...
> > http://lkml.org/lkml/2008/11/11/315
>
> Ah, sigh.
>
> It would be nice to get this sorted out, since we're serious wasting
> disk space for no good reason...
>
> Although as Richard points out, dropping the cacheline_aligned might
> drop networking performance (which, sigh, is also stupid) but allocating
> 128b * NR_CPUS is just a ridiculous amount of memory to waste for a
> reference count...

We can use nr_cpu_ids instead of NR_CPUS.
For a machine like 4096 CPUs, such an amount of memory is like a
peanut :)

Takashi