linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: compaction: remove duplicate !list_empty(&sublist) check
@ 2021-06-09  9:54 Liu Xiang
  2021-06-09 11:27 ` David Hildenbrand
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Xiang @ 2021-06-09  9:54 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, liuxiang_1999, Liu Xiang

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

Signed-off-by: Liu Xiang <liu.xiang@zlingsmart.com>
---
 mm/compaction.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index 84fde270a..5b1dc832f 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -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);
 	}
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm: compaction: remove duplicate !list_empty(&sublist) check
  2021-06-09  9:54 [PATCH] mm: compaction: remove duplicate !list_empty(&sublist) check Liu Xiang
@ 2021-06-09 11:27 ` David Hildenbrand
  0 siblings, 0 replies; 2+ messages in thread
From: David Hildenbrand @ 2021-06-09 11:27 UTC (permalink / raw)
  To: Liu Xiang, akpm; +Cc: linux-mm, linux-kernel, liuxiang_1999

On 09.06.21 11:54, Liu Xiang wrote:
> The list_splice_tail(&sublist, freelist) also do
> !list_empty(&sublist) check, so remove the duplicate call.
> 
> Signed-off-by: Liu Xiang <liu.xiang@zlingsmart.com>
> ---
>   mm/compaction.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 84fde270a..5b1dc832f 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -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);
>   	}
>   }
>   
> 

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-09 11:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09  9:54 [PATCH] mm: compaction: remove duplicate !list_empty(&sublist) check Liu Xiang
2021-06-09 11:27 ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).