From patchwork Mon Jul 11 08:49:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 12913156 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 83FE7C433EF for ; Mon, 11 Jul 2022 08:50:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC8E26B00A7; Mon, 11 Jul 2022 04:50:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D29046B00A8; Mon, 11 Jul 2022 04:50:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7AD76B00A9; Mon, 11 Jul 2022 04:50:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 97D5B6B00A7 for ; Mon, 11 Jul 2022 04:50:09 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6B6472059B for ; Mon, 11 Jul 2022 08:50:09 +0000 (UTC) X-FDA: 79674196938.26.638ABE4 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by imf16.hostedemail.com (Postfix) with ESMTP id 9A906180052 for ; Mon, 11 Jul 2022 08:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657529409; x=1689065409; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vvKkq5Wh9qU1+bVN3sbnuKnqAwdqqSdZhV8kZWnGHQU=; b=kb2jPwWAq+sg13mys8kle8CJrB0o0hxhqx2skQgmFXKI0Y7UeAaIt7c1 FWY1DRcCY7YXH8pP1D4jOoF5bh65d58eoDUVE+dL+YzZhLAD0180l9OkS j2z5RMmBHh0RT2UTErsy3nsmf6guC7jSB0efcBODsFD7rn66mTDywreu9 E6PHUJeQEH+0u/eCiCob8uzb8XNitwMrv8MOEjWGNPDM6TElh7EDQ4h/7 ik0wqesb78GvpuG5fupvGu2I0ti+v5N2AScYyNT591xXK/Csh0geiArju 9GZLxCXL32B3EHQz0HDCVI6saNwh+Nfo4SnPQc0mA0SfMDWl6OLaIFNhN w==; X-IronPort-AV: E=McAfee;i="6400,9594,10404"; a="346296563" X-IronPort-AV: E=Sophos;i="5.92,262,1650956400"; d="scan'208";a="346296563" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2022 01:50:08 -0700 X-IronPort-AV: E=Sophos;i="5.92,262,1650956400"; d="scan'208";a="652374122" Received: from yhuang6-mobl1.sh.intel.com ([10.238.5.168]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2022 01:50:05 -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 -V2 2/7] migrate_pages(): remove unnecessary list_safe_reset_next() Date: Mon, 11 Jul 2022 16:49:43 +0800 Message-Id: <20220711084948.274787-3-ying.huang@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220711084948.274787-1-ying.huang@intel.com> References: <20220711084948.274787-1-ying.huang@intel.com> MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=kb2jPwWA; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf16.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 134.134.136.31) smtp.mailfrom=ying.huang@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657529409; 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=pI1RtOKJCRJm9FFT4rgbcvkDoy2Sw79LerayXescY/E=; b=p0ZPrfsjekCpbybRZ3PcdsmN/MTzsrZKau6oGbT9t4Ph9QWwa+pfSY/rKq7kiFsS+rWjEv MSUDIfDFxFSD/XVuG+csZcOqmC1YpzsbvANTiN5udOtvZ3GqxbNrK1YdHxuYGP7jou4rqK wscWoMO5HcKctXEiViW3AJBNYZiV9o8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657529409; a=rsa-sha256; cv=none; b=Yv8doAtf+Gtyy5CmTfIIpsIArTEqjqZvJOMfMTQkhHkezbjkGB9EpJqiDIzsTk19NIPtLQ 1Esr+0uoOkbfV5dNPe7zZbzhEnJ7lNYAvLMHcG+CT+WhkN0y6g0qMhut38zuxRq927hIYF G20cbqbz0Xi546+jeFrDpDAkRSo7t6E= Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=kb2jPwWA; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf16.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 134.134.136.31) smtp.mailfrom=ying.huang@intel.com X-Rspamd-Server: rspam06 X-Rspam-User: X-Stat-Signature: hurni4iq6as9bcy578o1gfhorjs4y13m X-Rspamd-Queue-Id: 9A906180052 X-HE-Tag: 1657529408-481467 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" Reviewed-by: Baolin Wang Cc: Zi Yan Cc: Yang Shi Reviewed-by: Oscar Salvador --- mm/migrate.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 472335f0aaa3..794312072eb3 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1301,16 +1301,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; } @@ -1414,7 +1411,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; } @@ -1433,7 +1430,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; }