mem: mark pages as not accessed when freeing memory
authorLi Feng <fengli@smartx.com>
Fri, 24 Apr 2020 10:42:05 +0000 (18:42 +0800)
committerDavid Marchand <david.marchand@redhat.com>
Fri, 24 Apr 2020 17:36:17 +0000 (19:36 +0200)
Commit 8a4baf06c17a ("mem: mark pages as not accessed when reserving VA")
has mapped the initialized memory with PROT_NONE, and when it's unmapped,
eal_memalloc.c should remmap the anonymous memory with PROT_NONE too.

Fixes: 8a4baf06c17a ("mem: mark pages as not accessed when reserving VA")
Cc: stable@dpdk.org
Signed-off-by: Li Feng <fengli@smartx.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
lib/librte_eal/linux/eal_memalloc.c

index af6d0d0..678094a 100644 (file)
@@ -680,7 +680,7 @@ free_seg(struct rte_memseg *ms, struct hugepage_info *hi,
        /* erase page data */
        memset(ms->addr, 0, ms->len);
 
-       if (mmap(ms->addr, ms->len, PROT_READ,
+       if (mmap(ms->addr, ms->len, PROT_NONE,
                        MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0) ==
                                MAP_FAILED) {
                RTE_LOG(DEBUG, EAL, "couldn't unmap page\n");