]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mm: compaction: remove duplicate !list_empty(&sublist) check
authorLiu Xiang <liu.xiang@zlingsmart.com>
Thu, 1 Jul 2021 01:50:51 +0000 (18:50 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 1 Jul 2021 03:47:29 +0000 (20:47 -0700)
The list_splice_tail(&sublist, freelist) also do !list_empty(&sublist)
check, so remove the duplicate call.

Link: https://lkml.kernel.org/r/20210609095409.19920-1-liu.xiang@zlingsmart.com
Signed-off-by: Liu Xiang <liu.xiang@zlingsmart.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/compaction.c

index b7fb991dee1bc7b41ec2e27dba7c2cdcabbf4de4..f27ea22f297a8b9dd75e2c47c1e9c2b8c7868016 100644 (file)
@@ -1297,8 +1297,7 @@ move_freelist_head(struct list_head *freelist, struct page *freepage)
 
        if (!list_is_last(freelist, &freepage->lru)) {
                list_cut_before(&sublist, freelist, &freepage->lru);
-               if (!list_empty(&sublist))
-                       list_splice_tail(&sublist, freelist);
+               list_splice_tail(&sublist, freelist);
        }
 }
 
@@ -1315,8 +1314,7 @@ move_freelist_tail(struct list_head *freelist, struct page *freepage)
 
        if (!list_is_first(freelist, &freepage->lru)) {
                list_cut_position(&sublist, freelist, &freepage->lru);
-               if (!list_empty(&sublist))
-                       list_splice_tail(&sublist, freelist);
+               list_splice_tail(&sublist, freelist);
        }
 }