From mboxrd@z Thu Jan 1 00:00:00 1970 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 CBB75C25B08 for ; Wed, 17 Aug 2022 08:14:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6A13A8D0005; Wed, 17 Aug 2022 04:14:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 650318D0001; Wed, 17 Aug 2022 04:14:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 518B88D0005; Wed, 17 Aug 2022 04:14:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 43A9B8D0001 for ; Wed, 17 Aug 2022 04:14:28 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2093B1606A7 for ; Wed, 17 Aug 2022 08:14:28 +0000 (UTC) X-FDA: 79808372616.20.B70E723 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf01.hostedemail.com (Postfix) with ESMTP id 6FAAE40061 for ; Wed, 17 Aug 2022 08:14:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660724067; x=1692260067; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AkZ/4tTRl3ObNiVYse3xCB7TE9jVqTapi3ezPGjzMTg=; b=H0YGdnMr8kKbHL9AbgN+bD8FN2k9DLLECZDVzL0r4seigiTow9be5TkT U62UM7LVDuTFP20RzzYGJaDa8XFK87DFqQ2t4F17NB+K15NJ9yERN/V/M phzIKvXbEhGCME4e3P7+HD8DKzvgKgLOlQfYHHSnQfF6wvfy8xumJJhOt eTOKRUUT+LJBDm3pz/1SPyOFpat0NqRmCE+W4lmVakPNXL5+crZjshuUe ty0JiNSQKvzAQn4PMp92VvHEO/M9LAjgrIs22gIIDGfftq5vg6feUfTpJ RE0mPQakRZZvU7GkVTeEkr4AKijU7fSfMVIM7tHpSvSu7JLUG1FrqVr97 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10441"; a="293710782" X-IronPort-AV: E=Sophos;i="5.93,242,1654585200"; d="scan'208";a="293710782" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2022 01:14:25 -0700 X-IronPort-AV: E=Sophos;i="5.93,242,1654585200"; d="scan'208";a="583668087" Received: from yhuang6-mobl1.sh.intel.com ([10.238.6.172]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2022 01:14:23 -0700 From: Huang Ying To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Baolin Wang , Oscar Salvador , Zi Yan , Yang Shi Subject: [PATCH -V3 2/8] migrate_pages(): remove unnecessary list_safe_reset_next() Date: Wed, 17 Aug 2022 16:14:02 +0800 Message-Id: <20220817081408.513338-3-ying.huang@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220817081408.513338-1-ying.huang@intel.com> References: <20220817081408.513338-1-ying.huang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660724067; a=rsa-sha256; cv=none; b=yVMDy/lR5kS4vbpd00VpfdZCs1Jf+pnr0u4hWPoc2ajqBeq8A7aC4jewqq+g6vlm8KXhM5 XXEqUOXd1CqwSGCODMKNs1v08dDVIXotgsuHFcfDKHR5azbCFJ8eGYoOAei27NVGV9J3aW OV54hKgLAB8hOyqxVZ48wQiHepRN7Tw= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=H0YGdnMr; spf=pass (imf01.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660724067; 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=s3LB+xcdSjYxZiInSPMFO4rGt9qSqxWXamUp2Qs/flo=; b=BWBdjzunanPPoJZ5edpI95ZqVL6RMgYK+4geA3gfSTk02y3ZSylqj/khzkLlETQROQWmWb +oVHkWj9yi6jRKz64lvT6v1fhJOW4asXKJ1y4uxcXznoHFxRmlMXKSEGkEflpJrqwf8/5a sduKsMv91wN8kgbKWJgeoUdukGbE2AA= Authentication-Results: imf01.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=H0YGdnMr; spf=pass (imf01.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspam-User: X-Stat-Signature: 1mwixmrkf3dg6hz46tsy8f63wgyc5sen X-Rspamd-Queue-Id: 6FAAE40061 X-Rspamd-Server: rspam06 X-HE-Tag: 1660724067-66900 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 Reviewed-by: Oscar Salvador Cc: Zi Yan Cc: Yang Shi --- mm/migrate.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 1758fd215c0a..19a9b26af7e2 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1369,16 +1369,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; } @@ -1482,7 +1479,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; } @@ -1501,7 +1498,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; } -- 2.30.2