浏览代码

CRIS: Add configuration possibility for using kmalloc for modules.

Using kmalloc instead of vmalloc solves the stability problems
experienced by some 100 LX products.
Jesper Nilsson 17 年之前
父节点
当前提交
08cfeacb6b
共有 1 个文件被更改,包括 11 次插入3 次删除
  1. 11 3
      arch/cris/kernel/module.c

+ 11 - 3
arch/cris/kernel/module.c

@@ -28,20 +28,28 @@
 #define DEBUGP(fmt , ...)
 #endif
 
+#ifdef CONFIG_ETRAX_KMALLOCED_MODULES
+#define MALLOC_MODULE(size) kmalloc(size, GFP_KERNEL)
+#define FREE_MODULE(region) kfree(region)
+#else
+#define MALLOC_MODULE(size) vmalloc_exec(size)
+#define FREE_MODULE(region) vfree(region)
+#endif
+
 void *module_alloc(unsigned long size)
 {
 	if (size == 0)
 		return NULL;
-	return vmalloc_exec(size);
+	return MALLOC_MODULE(size);
 }
 
 
 /* Free memory returned from module_alloc */
 void module_free(struct module *mod, void *module_region)
 {
-	vfree(module_region);
+	FREE_MODULE(module_region);
 	/* FIXME: If module_region == mod->init_region, trim exception
-           table entries. */
+	   table entries. */
 }
 
 /* We don't need anything special. */