diff mbox series

mm,hugetlb: Remove unneded initialization

Message ID 20201119112141.6452-1-osalvador@suse.de (mailing list archive)
State New, archived
Headers show
Series mm,hugetlb: Remove unneded initialization | expand

Commit Message

Oscar Salvador Nov. 19, 2020, 11:21 a.m. UTC
hugetlb_add_hstate initializes nr_huge_pages and free_huge_pages to 0,
but since hstates[] is a global variable, all its fields are defined to
0 already.

Signed-off-by: Oscar Salvador <osalvador@suse.de>
---
 mm/hugetlb.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Mike Kravetz Nov. 19, 2020, 6:28 p.m. UTC | #1
On 11/19/20 3:21 AM, Oscar Salvador wrote:
> hugetlb_add_hstate initializes nr_huge_pages and free_huge_pages to 0,
> but since hstates[] is a global variable, all its fields are defined to
> 0 already.
> 
> Signed-off-by: Oscar Salvador <osalvador@suse.de>
> ---
>  mm/hugetlb.c | 2 --
>  1 file changed, 2 deletions(-)

Thanks,

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
David Hildenbrand Nov. 20, 2020, 9:28 a.m. UTC | #2
On 19.11.20 12:21, Oscar Salvador wrote:
> hugetlb_add_hstate initializes nr_huge_pages and free_huge_pages to 0,
> but since hstates[] is a global variable, all its fields are defined to
> 0 already.
> 
> Signed-off-by: Oscar Salvador <osalvador@suse.de>
> ---
>   mm/hugetlb.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 37f15c3c24dc..1c69e9044887 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -3197,8 +3197,6 @@ void __init hugetlb_add_hstate(unsigned int order)
>   	h = &hstates[hugetlb_max_hstate++];
>   	h->order = order;
>   	h->mask = ~((1ULL << (order + PAGE_SHIFT)) - 1);
> -	h->nr_huge_pages = 0;
> -	h->free_huge_pages = 0;
>   	for (i = 0; i < MAX_NUMNODES; ++i)
>   		INIT_LIST_HEAD(&h->hugepage_freelists[i]);
>   	INIT_LIST_HEAD(&h->hugepage_activelist);
> 

Reviewed-by: David Hildenbrand <david@redhat.com>
diff mbox series

Patch

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 37f15c3c24dc..1c69e9044887 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3197,8 +3197,6 @@  void __init hugetlb_add_hstate(unsigned int order)
 	h = &hstates[hugetlb_max_hstate++];
 	h->order = order;
 	h->mask = ~((1ULL << (order + PAGE_SHIFT)) - 1);
-	h->nr_huge_pages = 0;
-	h->free_huge_pages = 0;
 	for (i = 0; i < MAX_NUMNODES; ++i)
 		INIT_LIST_HEAD(&h->hugepage_freelists[i]);
 	INIT_LIST_HEAD(&h->hugepage_activelist);