From patchwork Fri Jun 24 02:53:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 12893405 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26E8EC43334 for ; Fri, 24 Jun 2022 02:53:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 62E5F8E01B9; Thu, 23 Jun 2022 22:53:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F02B8E01C1; Thu, 23 Jun 2022 22:53:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F4048E01B9; Thu, 23 Jun 2022 22:53:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 00C588E01BF for ; Thu, 23 Jun 2022 22:53:36 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id CFE4060582 for ; Fri, 24 Jun 2022 02:53:36 +0000 (UTC) X-FDA: 79611608832.30.DFC1474 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by imf21.hostedemail.com (Postfix) with ESMTP id 13CBD1C0009 for ; Fri, 24 Jun 2022 02:53:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656039216; x=1687575216; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pJRtHCA5XeINaIi9YAR839UhUEC+OvL+5N+hlZMyJMg=; b=Z5I80ni/Lku8aFw6Iflr2McfmcYJ6W72h3KeSNHkGnnolWiZO9R6jyMY azEe+AFEogv9CVs1dWtL5Yjjs1wl4+7VLsQuXOCXhLdPfuCRbPOTzY+CU T50MoAWAbRFYtOwvew0383Si67UIwsYSD1/9hRNWWyicYpbN80UpGPeuX Sp9edVRKQaUj3iUUgBFWIY5F5I4aoSly5VUIC5/T88DJvNtwfGD80fUYS qPeJEG2MO/00+EQYmbL6qIY/Qs+GXSREEUKx9TD0pN9kfB95S15abOasO /CByPm6uD77EMbuPv+pe5ZHfYhgLqb9QHYIM7DcCg+L0pu0fKFkmVRat5 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10387"; a="279672721" X-IronPort-AV: E=Sophos;i="5.92,217,1650956400"; d="scan'208";a="279672721" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2022 19:53:35 -0700 X-IronPort-AV: E=Sophos;i="5.92,217,1650956400"; d="scan'208";a="593018075" Received: from yxia2-mobl1.ccr.corp.intel.com (HELO yhuang6-mobl1.ccr.corp.intel.com) ([10.254.214.143]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2022 19:53:33 -0700 From: Huang Ying To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Baolin Wang , Zi Yan , Yang Shi Subject: [PATCH 2/7] migrate_pages(): remove unnecessary list_safe_reset_next() Date: Fri, 24 Jun 2022 10:53:04 +0800 Message-Id: <20220624025309.1033400-3-ying.huang@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624025309.1033400-1-ying.huang@intel.com> References: <20220624025309.1033400-1-ying.huang@intel.com> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656039216; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=oGOSco5OUDvPDNdnomthw5uZjK0xVj4XPif2nyx0gn8=; b=rMr/36RZ7Sy5brPBrnSJVMRIAeH4DYfD83xKoK6RxJRT7MhCNZWtR6Hplu2NPguh73cAnx zlvjQEZqwEy9L/+eMisvKr/ldNbUwafmT8UTPXIdi8+g2scqRLpaTsPw4nCQxQvsMNzF3T ByMNNVGTePnXdpYBBhlWV1y9tNCAZ2U= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b="Z5I80ni/"; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf21.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 192.55.52.120) smtp.mailfrom=ying.huang@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656039216; a=rsa-sha256; cv=none; b=a5ULezXUmyhcjVnIp5XMaPYLpI/SizHGufItLjp34T/X2z+cnzt71iK2KmE56eFncaR1FE F5p2iOhnXMG9qADgBx973oPD8J5piVm5FANUB2ozqSC6FILMHxGWVnnEumzh8ipVHNFIIO 1B/GSwyJrSBWz3qBi+tlLV0sLUzXrPg= X-Rspamd-Queue-Id: 13CBD1C0009 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b="Z5I80ni/"; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf21.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 192.55.52.120) smtp.mailfrom=ying.huang@intel.com X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: pm1ctaqepox8hthojb3mwffy78z85hzs X-HE-Tag: 1656039215-354085 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Before commit b5bade978e9b ("mm: migrate: fix the return value of migrate_pages()"), the tail pages of THP will be put in the "from" list directly. So one of the loop cursors (page2) needs to be reset, as is done in try_split_thp() via list_safe_reset_next(). But after the commit, the tail pages of THP will be put in a dedicated list (thp_split_pages). That is, the "from" list will not be changed during splitting. So, it's unnecessary to call list_safe_reset_next() anymore. This is a code cleanup, no functionality changes are expected. Signed-off-by: "Huang, Ying" Cc: Baolin Wang Cc: Zi Yan Cc: Yang Shi Reviewed-by: Baolin Wang --- mm/migrate.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index a271554be7a1..82444e7df9f1 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1300,16 +1300,13 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, return rc; } -static inline int try_split_thp(struct page *page, struct page **page2, - struct list_head *from) +static inline int try_split_thp(struct page *page, struct list_head *split_pages) { - int rc = 0; + int rc; lock_page(page); - rc = split_huge_page_to_list(page, from); + rc = split_huge_page_to_list(page, split_pages); unlock_page(page); - if (!rc) - list_safe_reset_next(page, *page2, lru); return rc; } @@ -1413,7 +1410,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, /* THP migration is unsupported */ if (is_thp) { nr_thp_failed++; - if (!try_split_thp(page, &page2, &thp_split_pages)) { + if (!try_split_thp(page, &thp_split_pages)) { nr_thp_split++; goto retry; } @@ -1432,7 +1429,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, */ if (is_thp && !nosplit) { nr_thp_failed++; - if (!try_split_thp(page, &page2, &thp_split_pages)) { + if (!try_split_thp(page, &thp_split_pages)) { nr_thp_split++; goto retry; }