From patchwork Wed Jun 9 09:54:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Xiang X-Patchwork-Id: 12309445 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56A7FC47095 for ; Wed, 9 Jun 2021 09:54:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A2A0A61375 for ; Wed, 9 Jun 2021 09:54:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2A0A61375 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zlingsmart.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F17156B0036; Wed, 9 Jun 2021 05:54:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EC7636B006E; Wed, 9 Jun 2021 05:54:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D67E16B0070; Wed, 9 Jun 2021 05:54:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0039.hostedemail.com [216.40.44.39]) by kanga.kvack.org (Postfix) with ESMTP id A455D6B0036 for ; Wed, 9 Jun 2021 05:54:21 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 23CD912E8 for ; Wed, 9 Jun 2021 09:54:21 +0000 (UTC) X-FDA: 78233725122.02.8DB5D77 Received: from out28-218.mail.aliyun.com (out28-218.mail.aliyun.com [115.124.28.218]) by imf06.hostedemail.com (Postfix) with ESMTP id 6B6F5C001C7C for ; Wed, 9 Jun 2021 09:54:15 +0000 (UTC) X-Alimail-AntiSpam: AC=CONTINUE;BC=0.3055118|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.0374721-0.0102982-0.95223;FP=0|0|0|0|0|-1|-1|-1;HT=ay29a033018047193;MF=liu.xiang@zlingsmart.com;NM=1;PH=DS;RN=5;RT=5;SR=0;TI=SMTPD_---.KPunzqk_1623232454; Received: from localhost(mailfrom:liu.xiang@zlingsmart.com fp:SMTPD_---.KPunzqk_1623232454) by smtp.aliyun-inc.com(10.194.97.171); Wed, 09 Jun 2021 17:54:14 +0800 From: Liu Xiang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, liuxiang_1999@126.com, Liu Xiang Subject: [PATCH] mm: compaction: remove duplicate !list_empty(&sublist) check Date: Wed, 9 Jun 2021 17:54:09 +0800 Message-Id: <20210609095409.19920-1-liu.xiang@zlingsmart.com> X-Mailer: git-send-email 2.17.1 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 6B6F5C001C7C Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf06.hostedemail.com: domain of liu.xiang@zlingsmart.com designates 115.124.28.218 as permitted sender) smtp.mailfrom=liu.xiang@zlingsmart.com X-Stat-Signature: 7r7qn3wcdm55bo7xe9ocmknyytbohuif X-HE-Tag: 1623232455-70291 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000006, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The list_splice_tail(&sublist, freelist) also do !list_empty(&sublist) check, so remove the duplicate call. Signed-off-by: Liu Xiang Reviewed-by: David Hildenbrand --- 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); } }