]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
nvmap: combine two methods of requesting zeroed memory
authorColin Cross <ccross@android.com>
Mon, 11 Aug 2014 21:25:20 +0000 (14:25 -0700)
committerWinnie Hsu <whsu@nvidia.com>
Tue, 12 May 2015 20:27:58 +0000 (13:27 -0700)
Combine CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES and the zero_memory
modparam into a single option by forcing zero_memory=1 when
CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES is set, and always using
zero_memory to decided whether to zero or not.

Change-Id: I9ce0106cfaea950bd9494b697916fbc2a03329ea
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/664672
GVS: Gerrit_Virtual_Submit
Reviewed-on: http://git-master/r/736426
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Tested-by: Alex Waterman <alexw@nvidia.com>
drivers/video/tegra/nvmap/nvmap_handle.c
drivers/video/tegra/nvmap/nvmap_priv.h

index 3dd2c3c4f44f72d5cbf088c0bd08ffa12450c505..59bb6db2b835c85e63e307b0bb232993f06876ba 100644 (file)
 #include "nvmap_priv.h"
 #include "nvmap_ioctl.h"
 
+#ifdef CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES
+bool zero_memory = true;
+#define ZERO_MEMORY_PERMS 0444
+#else
 bool zero_memory;
+#define ZERO_MEMORY_PERMS 0644
+#endif
 
 static int zero_memory_set(const char *arg, const struct kernel_param *kp)
 {
@@ -54,7 +60,7 @@ static struct kernel_param_ops zero_memory_ops = {
        .set = zero_memory_set,
 };
 
-module_param_cb(zero_memory, &zero_memory_ops, &zero_memory, 0644);
+module_param_cb(zero_memory, &zero_memory_ops, &zero_memory, ZERO_MEMORY_PERMS);
 
 u32 nvmap_max_handle_count;
 
index f6060e86e28102640f598843b31a6876dffe79bd..27cb3290a599d215b75a4e3d12e5452d3d13386e 100644 (file)
 #define __GFP_NVMAP     (GFP_KERNEL | __GFP_HIGHMEM)
 #endif
 
-#ifdef CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES
-#define NVMAP_ZEROED_PAGES     __GFP_ZERO
-#else
-#define NVMAP_ZEROED_PAGES     0
-#endif
-
-#define GFP_NVMAP              (__GFP_NVMAP | __GFP_NOWARN | NVMAP_ZEROED_PAGES)
-
-extern bool zero_memory;
+#define GFP_NVMAP       (__GFP_NVMAP | __GFP_NOWARN)
 
 #ifdef CONFIG_64BIT
 #define NVMAP_LAZY_VFREE