mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-01 06:46:35 +01:00
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 <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Baoquan He <[email protected]> Reviewed-by: Mike Kravetz <[email protected]> Cc: Vlastimil Babka <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
a1ddc2e825
commit
d3ec7b6e09
1 file changed
+2
-5
+2
-5
@@ -443,11 +443,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;
|
||||
|
||||
Reference in new issue
Block a user