Commit 34665341 authored by Miaohe Lin's avatar Miaohe Lin Committed by Andrew Morton

hugetlb: use LIST_HEAD() to define a list head

Use LIST_HEAD() directly to define a list head to simplify the code.
No functional change intended.

Link: https://lkml.kernel.org/r/20220901120030.63318-4-linmiaohe@huawei.comSigned-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
Reviewed-by: default avatarMuchun Song <songmuchun@bytedance.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent c2c3a60a
...@@ -456,14 +456,12 @@ static int allocate_file_region_entries(struct resv_map *resv, ...@@ -456,14 +456,12 @@ static int allocate_file_region_entries(struct resv_map *resv,
int regions_needed) int regions_needed)
__must_hold(&resv->lock) __must_hold(&resv->lock)
{ {
struct list_head allocated_regions; LIST_HEAD(allocated_regions);
int to_allocate = 0, i = 0; int to_allocate = 0, i = 0;
struct file_region *trg = NULL, *rg = NULL; struct file_region *trg = NULL, *rg = NULL;
VM_BUG_ON(regions_needed < 0); VM_BUG_ON(regions_needed < 0);
INIT_LIST_HEAD(&allocated_regions);
/* /*
* Check for sufficient descriptors in the cache to accommodate * Check for sufficient descriptors in the cache to accommodate
* the number of in progress add operations plus regions_needed. * the number of in progress add operations plus regions_needed.
...@@ -2336,7 +2334,7 @@ struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma, ...@@ -2336,7 +2334,7 @@ struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma,
static int gather_surplus_pages(struct hstate *h, long delta) static int gather_surplus_pages(struct hstate *h, long delta)
__must_hold(&hugetlb_lock) __must_hold(&hugetlb_lock)
{ {
struct list_head surplus_list; LIST_HEAD(surplus_list);
struct page *page, *tmp; struct page *page, *tmp;
int ret; int ret;
long i; long i;
...@@ -2351,7 +2349,6 @@ static int gather_surplus_pages(struct hstate *h, long delta) ...@@ -2351,7 +2349,6 @@ static int gather_surplus_pages(struct hstate *h, long delta)
} }
allocated = 0; allocated = 0;
INIT_LIST_HEAD(&surplus_list);
ret = -ENOMEM; ret = -ENOMEM;
retry: retry:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment