Skip to contentSkip to conversation

mm: compaction: remove duplicate !list_empty(&sublist) check

PATCH Applied Liu Xiang 2 participants 2 messages Jun 9, 2021

Subsystems (2)
lore
Share & tools
lore

Liu Xiang

author
#0 lore raw

PATCH 1/1 mm: compaction: remove duplicate !list_empty(&sublist) check

The list_splice_tail(&sublist, freelist) also do !list_empty(&sublist) check, so remove the duplicate call.

---
 mm/compaction.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
mm/compaction.c +2 -4
index 84fde270a..5b1dc832f 100644
@@ -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);
 	}
 }
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines · Liu Xiang

The list_splice_tail(&sublist, freelist) also do !list_empty(&sublist) check, so remove the duplicate call.

---
  mm/compaction.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
mm/compaction.c +1 -2
index 84fde270a..5b1dc832f 100644
@@ -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);
  	}
  }
 

mm/compaction.c move_freelist_tail(struct list_head *freelist, struct page *freepage) · line 1320

Quoted 9 lines
mm/compaction.c +1 -2
@@ -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);
  	}
  }
 
Signature · 3 lines
Thanks,

David / dhildenb