Skip to content

Commit 4c17989

Browse files
Kemeng Shiakpm00
authored andcommitted
mm/compaction: call list_is_{first}/{last} more intuitively in move_freelist_{head}/{tail}
We use move_freelist_head after list_for_each_entry_reverse to skip recent pages. And there is no need to do actual move if all freepages are searched in list_for_each_entry_reverse, e.g. freepage point to first page in freelist. It's more intuitively to call list_is_first with list entry as the first argument and list head as the second argument to check if list entry is the first list entry instead of call list_is_last with list entry and list head passed in reverse. Similarly, call list_is_last in move_freelist_tail is more intuitively. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Kemeng Shi <[email protected]> Reviewed-by: Baolin Wang <[email protected]> Acked-by: Mel Gorman <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent bbefa0f commit 4c17989

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mm/compaction.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ move_freelist_head(struct list_head *freelist, struct page *freepage)
13951395
{
13961396
LIST_HEAD(sublist);
13971397

1398-
if (!list_is_last(freelist, &freepage->buddy_list)) {
1398+
if (!list_is_first(&freepage->buddy_list, freelist)) {
13991399
list_cut_before(&sublist, freelist, &freepage->buddy_list);
14001400
list_splice_tail(&sublist, freelist);
14011401
}
@@ -1412,7 +1412,7 @@ move_freelist_tail(struct list_head *freelist, struct page *freepage)
14121412
{
14131413
LIST_HEAD(sublist);
14141414

1415-
if (!list_is_first(freelist, &freepage->buddy_list)) {
1415+
if (!list_is_last(&freepage->buddy_list, freelist)) {
14161416
list_cut_position(&sublist, freelist, &freepage->buddy_list);
14171417
list_splice_tail(&sublist, freelist);
14181418
}

0 commit comments

Comments
 (0)