[RFC PATCHv3 04/11] dm: Use VMALLOC_TOTAL instead of VMALLCO_END - VMALLOC_START

From: Laura Abbott
Date: Thu Jan 02 2014 - 16:55:44 EST


vmalloc already provides a macro to calculat the total vmalloc size,
VMALLOC_TOTAL. Use it.

Signed-off-by: Laura Abbott <lauraa@xxxxxxxxxxxxxx>
---
drivers/md/dm-bufio.c | 4 ++--
drivers/md/dm-stats.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index 54bdd923..cd677f2 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -1736,8 +1736,8 @@ static int __init dm_bufio_init(void)
* Get the size of vmalloc space the same way as VMALLOC_TOTAL
* in fs/proc/internal.h
*/
- if (mem > (VMALLOC_END - VMALLOC_START) * DM_BUFIO_VMALLOC_PERCENT / 100)
- mem = (VMALLOC_END - VMALLOC_START) * DM_BUFIO_VMALLOC_PERCENT / 100;
+ if (mem > VMALLOC_TOTAL * DM_BUFIO_VMALLOC_PERCENT / 100)
+ mem = VMALLOC_TOTAL * DM_BUFIO_VMALLOC_PERCENT / 100;
#endif

dm_bufio_default_cache_size = mem;
diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c
index 28a9012..378ffb6 100644
--- a/drivers/md/dm-stats.c
+++ b/drivers/md/dm-stats.c
@@ -80,7 +80,7 @@ static bool __check_shared_memory(size_t alloc_size)
if (a >> PAGE_SHIFT > totalram_pages / DM_STATS_MEMORY_FACTOR)
return false;
#ifdef CONFIG_MMU
- if (a > (VMALLOC_END - VMALLOC_START) / DM_STATS_VMALLOC_FACTOR)
+ if (a > VMALLOC_TOTAL / DM_STATS_VMALLOC_FACTOR)
return false;
#endif
return true;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/