diff mbox

[API-NEXT,PATCHv9,01/15] linux-gen: _ishm: fix for alignment request matching page size

Message ID 1480004553-46760-2-git-send-email-christophe.milard@linaro.org
State Accepted
Commit dba0f42c9e24d090b29df165f610fc0df051b018
Headers show

Commit Message

Christophe Milard Nov. 24, 2016, 4:22 p.m. UTC
There is no reason to toggle the _ODP_ISHM_SINGLE_VA flag
when the alignment exactly matches the page size.
This just results in wasting the odp-common virtual space

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>

---
 platform/linux-generic/_ishm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.7.4
diff mbox

Patch

diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c
index f4aa6d3..3371d94 100644
--- a/platform/linux-generic/_ishm.c
+++ b/platform/linux-generic/_ishm.c
@@ -756,7 +756,7 @@  int _odp_ishm_reserve(const char *name, uint64_t size, int fd,
 		 * the same address every where, otherwise alignment may be
 		 * be wrong for some process */
 		hp_align = align;
-		if (hp_align < odp_sys_huge_page_size())
+		if (hp_align <= odp_sys_huge_page_size())
 			hp_align = odp_sys_huge_page_size();
 		else
 			flags |= _ODP_ISHM_SINGLE_VA;
@@ -777,7 +777,7 @@  int _odp_ishm_reserve(const char *name, uint64_t size, int fd,
 		 * size then we have to make sure the block will be mapped at
 		 * the same address every where, otherwise alignment may be
 		 * be wrong for some process */
-		if (align < odp_sys_page_size())
+		if (align <= odp_sys_page_size())
 			align = odp_sys_page_size();
 		else
 			flags |= _ODP_ISHM_SINGLE_VA;