Signed-off-by: Christophe Milard <christophe.mil...@linaro.org>
---
 platform/linux-generic/_ishm.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c
index 11bb316..0c08998 100644
--- a/platform/linux-generic/_ishm.c
+++ b/platform/linux-generic/_ishm.c
@@ -427,8 +427,12 @@ static int create_file(int block_index, huge_flag_t huge,
 
        fd = open(filename, oflag, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
        if (fd < 0) {
-               ODP_ERR("open failed for %s: %s.\n",
-                       filename, strerror(errno));
+               if (huge == HUGE)
+                       ODP_DBG("open failed for %s: %s.\n",
+                               filename, strerror(errno));
+               else
+                       ODP_ERR("open failed for %s: %s.\n",
+                               filename, strerror(errno));
                return -1;
        }
 
@@ -730,6 +734,7 @@ int _odp_ishm_reserve(const char *name, uint64_t size, int 
fd,
        void *addr = NULL;                    /* mapping address */
        int new_proc_entry;
        struct stat statbuf;
+       static int  huge_error_printed;       /* to avoid millions of error...*/
 
        odp_spinlock_lock(&ishm_tbl->lock);
 
@@ -804,11 +809,16 @@ int _odp_ishm_reserve(const char *name, uint64_t size, 
int fd,
                len = (size + (page_hp_size - 1)) & (-page_hp_size);
                addr = do_map(new_index, len, hp_align, flags, HUGE, &fd);
 
-               if (addr == NULL)
-                       ODP_DBG("No huge pages, fall back to normal pages, "
-                               "check: /proc/sys/vm/nr_hugepages.\n");
-               else
+               if (addr == NULL) {
+                       if (!huge_error_printed) {
+                               ODP_ERR("No huge pages, fall back to normal "
+                                       "pages. "
+                                       "check: /proc/sys/vm/nr_hugepages.\n");
+                               huge_error_printed = 1;
+                       }
+               } else {
                        new_block->huge = HUGE;
+               }
        }
 
        /* Try normal pages if huge pages failed */
-- 
2.7.4

Reply via email to