Skip to content

Commit

Permalink
habanalabs: free host huge va_range if not used
Browse files Browse the repository at this point in the history
If huge range is not valid, driver uses the host range also for
huge page allocations, but driver never frees its allocation.
This introduces a memory leak every time a user closes its context.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
  • Loading branch information
Ofir Bitton authored and Oded Gabbay committed Nov 30, 2020
1 parent f099209 commit c8c39fb
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/misc/habanalabs/common/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1626,6 +1626,7 @@ static int vm_ctx_init_with_ranges(struct hl_ctx *ctx,
goto host_hpage_range_err;
}
} else {
kfree(ctx->host_huge_va_range);
ctx->host_huge_va_range = ctx->host_va_range;
}

Expand Down

0 comments on commit c8c39fb

Please sign in to comment.