diff mbox

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

Message ID 1479975872-4945-2-git-send-email-christophe.milard@linaro.org
State Superseded
Headers show

Commit Message

Christophe Milard Nov. 24, 2016, 8:24 a.m. UTC
There is no reason to toggle the _ODP_ISHM_SINGLE_VA flag
when the alignment exactely 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

Comments

Maxim Uvarov Nov. 24, 2016, 2:29 p.m. UTC | #1
On 11/24/16 11:24, Christophe Milard wrote:
> There is no reason to toggle the _ODP_ISHM_SINGLE_VA flag

> when the alignment exactely


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(-)

>

> 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;
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;