[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <482C9FC5.2070508@cosmosbay.com>
Date: Thu, 15 May 2008 22:40:37 +0200
From: Eric Dumazet <dada1@...mosbay.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Rusty Russell <rusty@...tcorp.com.au>,
linux kernel <linux-kernel@...r.kernel.org>,
Mike Travis <travis@....com>
Subject: [PATCH] modules: Use a better scheme for refcounting
Current refcounting for modules (done if CONFIG_MODULE_UNLOAD=y)
is using a lot of memory.
Each 'struct module' contains an [NR_CPUS] array of full cache lines.
This patch uses existing infrastructure (percpu_modalloc() &
percpu_modfree())
to allocate percpu space for the refcount storage.
Instead of wasting NR_CPUS*128 bytes (on i386), we now use
num_possible_cpus*sizeof(local_t) bytes.
On a typical distro, where NR_CPUS=8, shiping 2000 modules, we reduce
size of module files by about 2 Mbytes. (1Kb per module)
Instead of having all refcounters in the same memory node - with TLB misses
because of vmalloc() - this new implementation permits to have better
NUMA properties, since each CPU will use storage on its preferred node,
thanks to percpu storage.
Signed-off-by: Eric Dumazet <dada1@...mosbay.com>
---
include/linux/module.h | 25 ++++++++++++++++---------
kernel/module.c | 37 +++++++++++++++++++++++++++----------
2 files changed, 43 insertions(+), 19 deletions(-)
View attachment "module.patch" of type "text/plain" (4857 bytes)
Powered by blists - more mailing lists