[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200805161009.12142.rusty@rustcorp.com.au>
Date: Fri, 16 May 2008 10:09:11 +1000
From: Rusty Russell <rusty@...tcorp.com.au>
To: Eric Dumazet <dada1@...mosbay.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux kernel <linux-kernel@...r.kernel.org>,
Mike Travis <travis@....com>
Subject: Re: [PATCH] modules: Use a better scheme for refcounting
On Friday 16 May 2008 06:40:37 Eric Dumazet wrote:
> Current refcounting for modules (done if CONFIG_MODULE_UNLOAD=y)
> is using a lot of memory.
Hi Eric,
I like this patch! The plan was always to create a proper dynamic per-cpu
allocator which used the normal per-cpu offsets, but I think module refcounts
are worthwhile as a special case.
Any chance I can ask you look at the issue of full dynamic per-cpu
allocation? The problem of allocating memory which is laid out precisely
as the original per-cpu alloc is vexing on NUMA, and probably requires
reserving virtual address space and remapping into it, but the rewards
would be maximally-efficient per-cpu accessors, and getting rid of that
boutique allocator in module.c.
Only minor commentry on the patch itself:
> +#ifdef CONFIG_SMP
> + char *refptr;
> +#else
void * would seem more natural here (love those gcc'isms)
> +#if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP)
> + void *refptr = NULL;
> +#endif
Looks like you can skip this if you assign to mod->refptr directly below:
> +#if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP)
> + refptr = percpu_modalloc(sizeof(local_t), sizeof(local_t), mod->name);
> + if (!refptr)
> + goto free_mod;
> + mod->refptr = refptr;
> +#endif
And finally:
> +#if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP)
> + if (refptr)
> + percpu_modfree(refptr);
> +#endif
This if (refptr) seems redundant.
Thanks!
Rusty.
--
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