Kconfig specifies that zsmalloc is a tristate but anyone trying to use it as a module will get zsmalloc: module license 'unspecified' taints kernel. and references to GPL-only symbols fail. This comes up in practice because zram selects zsmalloc now so anyone upgrading from a pre-3.4 kernel with zram configured to build as a module and accepting the "make oldconfig" defaults gets CONFIG_ZSMALLOC=m. This patch declares the module's author, license, and module_init/exit functions to avoid surprises. Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx> --- Hi Christian, Christian Ohm wrote[1]: > Trying to modprobe the zram module, the following happens: > > # modprobe zram > ERROR: could not insert 'zram': Unknown symbol in module, or unknown parameter (see dmesg) > > # dmesg > [310034.551024] zsmalloc: module is from the staging directory, the quality is unknown, you have been warned. > [310034.551037] zsmalloc: module license 'unspecified' taints kernel. > [310034.551043] Disabling lock debugging due to kernel taint > [310034.551393] zsmalloc: Unknown symbol alloc_vm_area (err 0) > [310034.551461] zsmalloc: Unknown symbol free_vm_area (err 0) > [310034.551522] zsmalloc: Unknown symbol __supported_pte_mask (err 0) Does this patch help? See [2] for instructions for building a patched kernel. Thanks, Jonathan [1] http://bugs.debian.org/677273 [2] http://kernel-handbook.alioth.debian.org/ch-common-tasks.html#s-common-official drivers/staging/zsmalloc/zsmalloc-main.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c index fb54a9b94c33..4ba1911f97ff 100644 --- a/drivers/staging/zsmalloc/zsmalloc-main.c +++ b/drivers/staging/zsmalloc/zsmalloc-main.c @@ -471,13 +471,7 @@ static struct page *find_get_zspage(struct size_class *class) } -/* - * If this becomes a separate module, register zs_init() with - * module_init(), zs_exit with module_exit(), and remove zs_initialized -*/ -static int zs_initialized; - -static int zs_cpu_notifier(struct notifier_block *nb, unsigned long action, +static int __init zs_cpu_notifier(struct notifier_block *nb, unsigned long action, void *pcpu) { int cpu = (long)pcpu; @@ -508,7 +502,7 @@ static struct notifier_block zs_cpu_nb = { .notifier_call = zs_cpu_notifier }; -static void zs_exit(void) +static void __exit zs_exit(void) { int cpu; @@ -517,7 +511,7 @@ static void zs_exit(void) unregister_cpu_notifier(&zs_cpu_nb); } -static int zs_init(void) +static int __init zs_init(void) { int cpu, ret; @@ -562,17 +556,6 @@ struct zs_pool *zs_create_pool(const char *name, gfp_t flags) } - /* - * If this becomes a separate module, register zs_init with - * module_init, and remove this block - */ - if (!zs_initialized) { - error = zs_init(); - if (error) - goto cleanup; - zs_initialized = 1; - } - pool->flags = flags; pool->name = name; @@ -799,3 +782,9 @@ u64 zs_get_total_size_bytes(struct zs_pool *pool) return npages << PAGE_SHIFT; } EXPORT_SYMBOL_GPL(zs_get_total_size_bytes); + +MODULE_AUTHOR("Nitin Gupta <ngupta@xxxxxxxxxx>"); +MODULE_LICENSE("Dual BSD/GPL"); + +module_init(zs_init); +module_exit(zs_exit); -- 1.7.10.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel