[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200828033242.8787-4-richard.weiyang@linux.alibaba.com>
Date: Fri, 28 Aug 2020 11:32:38 +0800
From: Wei Yang <richard.weiyang@...ux.alibaba.com>
To: mike.kravetz@...cle.com, akpm@...ux-foundation.org
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org, bhe@...hat.com,
Wei Yang <richard.weiyang@...ux.alibaba.com>
Subject: [Patch v2 3/7] mm/hugetlb: use list_splice to merge two list at once
Instead of add allocated file_region one by one to region_cache, we
could use list_splice to merge two list at once.
Also we know the number of entries in the list, increase the number
directly.
Signed-off-by: Wei Yang <richard.weiyang@...ux.alibaba.com>
Reviewed-by: Baoquan He <bhe@...hat.com>
Reviewed-by: Mike Kravetz <mike.kravetz@...cle.com>
---
mm/hugetlb.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index f325839be617..cbe67428bf99 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -441,11 +441,8 @@ static int allocate_file_region_entries(struct resv_map *resv,
spin_lock(&resv->lock);
- list_for_each_entry_safe(rg, trg, &allocated_regions, link) {
- list_del(&rg->link);
- list_add(&rg->link, &resv->region_cache);
- resv->region_cache_count++;
- }
+ list_splice(&allocated_regions, &resv->region_cache);
+ resv->region_cache_count += to_allocate;
}
return 0;
--
2.20.1 (Apple Git-117)
Powered by blists - more mailing lists