eal: fix '--huge-unlink' option

Message ID 1537530998-109749-1-git-send-email-pawelx.wodkowski@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series eal: fix '--huge-unlink' option |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Wodkowski, PawelX Sept. 21, 2018, 11:56 a.m. UTC
  The final_va field is set during remap_segment() but this information is
not propagated to temporal copy of huge page memory configuration so the
unlink_hugepage_files() function wrongly assume that there is nothing to
unlink. Fix this issue by checking orig_va instead of final_va.

Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")
To: Anatoly Burakov <anatoly.burakov@intel.com>

Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Stojaczyk, Dariusz Sept. 21, 2018, 8:31 a.m. UTC | #1
I'd like to point out that the comments inside eal_memory.c are outdated (e.g. the one from line #249). It makes it difficult to review this patch.

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pawel Wodkowski
> Sent: Friday, September 21, 2018 1:57 PM
> To: dev@dpdk.org
> Cc: Wodkowski, PawelX <pawelx.wodkowski@intel.com>
> Subject: [dpdk-dev] [PATCH] eal: fix '--huge-unlink' option
> 
> The final_va field is set during remap_segment() but this information is not
> propagated to temporal copy of huge page memory configuration so the
> unlink_hugepage_files() function wrongly assume that there is nothing to
> unlink. Fix this issue by checking orig_va instead of final_va.
> 
> Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")
> To: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
  
Wodkowski, PawelX Sept. 26, 2018, 6:12 p.m. UTC | #2
Hi Anatoly,

Can you take a look at this small fix.

Thank you
Paweł

> -----Original Message-----
> From: Wodkowski, PawelX
> Sent: Friday, September 21, 2018 1:57 PM
> To: dev@dpdk.org
> Cc: Wodkowski, PawelX <pawelx.wodkowski@intel.com>
> Subject: [PATCH] eal: fix '--huge-unlink' option
> 
> The final_va field is set during remap_segment() but this information is
> not propagated to temporal copy of huge page memory configuration so the
> unlink_hugepage_files() function wrongly assume that there is nothing to
> unlink. Fix this issue by checking orig_va instead of final_va.
> 
> Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")
> To: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
> ---
>  lib/librte_eal/linuxapp/eal/eal_memory.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c
> b/lib/librte_eal/linuxapp/eal/eal_memory.c
> index e3ac2481572d..b4a2b2b9e405 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_memory.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
> @@ -585,7 +585,7 @@ unlink_hugepage_files(struct hugepage_file
> *hugepg_tbl,
>  	for (page = 0; page < nrpages; page++) {
>  		struct hugepage_file *hp = &hugepg_tbl[page];
> 
> -		if (hp->final_va != NULL && unlink(hp->filepath)) {
> +		if (hp->orig_va != NULL && unlink(hp->filepath)) {
>  			RTE_LOG(WARNING, EAL, "%s(): Removing %s failed:
> %s\n",
>  				__func__, hp->filepath, strerror(errno));
>  		}
> --
> 2.7.4
  
Anatoly Burakov Oct. 5, 2018, 8:13 a.m. UTC | #3
On 21-Sep-18 12:56 PM, Pawel Wodkowski wrote:
> The final_va field is set during remap_segment() but this information is
> not propagated to temporal copy of huge page memory configuration so the
> unlink_hugepage_files() function wrongly assume that there is nothing to
> unlink. Fix this issue by checking orig_va instead of final_va.
> 
> Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")
> To: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
  
Thomas Monjalon Oct. 11, 2018, 9:40 a.m. UTC | #4
05/10/2018 10:13, Burakov, Anatoly:
> On 21-Sep-18 12:56 PM, Pawel Wodkowski wrote:
> > The final_va field is set during remap_segment() but this information is
> > not propagated to temporal copy of huge page memory configuration so the
> > unlink_hugepage_files() function wrongly assume that there is nothing to
> > unlink. Fix this issue by checking orig_va instead of final_va.
> > 
> > Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")
> > To: Anatoly Burakov <anatoly.burakov@intel.com>
> > 
> > Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
> 
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index e3ac2481572d..b4a2b2b9e405 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -585,7 +585,7 @@  unlink_hugepage_files(struct hugepage_file *hugepg_tbl,
 	for (page = 0; page < nrpages; page++) {
 		struct hugepage_file *hp = &hugepg_tbl[page];
 
-		if (hp->final_va != NULL && unlink(hp->filepath)) {
+		if (hp->orig_va != NULL && unlink(hp->filepath)) {
 			RTE_LOG(WARNING, EAL, "%s(): Removing %s failed: %s\n",
 				__func__, hp->filepath, strerror(errno));
 		}