From patchwork Tue May 9 02:20:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 91348 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2570248vqo; Mon, 8 May 2023 19:23:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4rUzknFWD8G4gxksbLZAtyLwj67SDjaqIR3zPXqSU05MTq5g3RUiRro2Fb228N0mCb02zA X-Received: by 2002:a17:90a:404b:b0:24e:3b85:a8a with SMTP id k11-20020a17090a404b00b0024e3b850a8amr12595349pjg.8.1683599027286; Mon, 08 May 2023 19:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683599027; cv=none; d=google.com; s=arc-20160816; b=s8j4d1yavZi3Kyx4mYhfzJaY5lziSZa7JbEMtOWjqQvJiT/kvAt0fVmgxxgO2PtYtJ D2ER6cUjthpSJx6nJJTKEFJs7lqy69ijEh2qLrKCyVMAijlh7P/aPt3PDA40aDPR6eql ZjPi8dccZr70fEhtDYfM8WbMmlv3r/gprqqLMDxMqVDJF9GMojEv0u1ANly/WLB6UWw2 ZSAsVsAf/IL1xYlRUotbTYERDOjHIBOmRK94Rl6++qcPksrhVpgoDL7uFji6pl2u1b75 6j+1oQqHR3bA5zKoCBgV1dP63/eo1md73+RC0FgEJ1eUPNaUMU5SX2gj7ilFoNFP7lFM aNDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+WdzJwxvekpZiCdmFrPivA731vNoIk8+hwlrPBM62LA=; b=GxTuFL5UZwEvWD7hCvc5Uy6dPqlJKl983pgm/SzKOiq9LIuZc+X9wWrw84w+rnO0mJ 1Y32rOPwg/odOdBQrvvbOfBs74xyOfAW4wPF32PwwtFu32ETbshuo7XsCJR+aANHg+26 9kRzASOORRDwaadaSFxrCmBuZKhTUwGxZnWZCBo4KOJJu2HgLkHkyE7c+C+DIR693o6n L4GCKl1bWu1fh1p5NoserEjdoyYjpxfJfMEmIimce+8EEMxPZruHOHRro2AOoZNbYBXf XDGOquRyYlbO2dCdZVfUQFkd6+8FyAeY7kQBb9FxdkIB2LfCI22y3RkAT4V46xz5RAZW 7TDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=X71wGZHa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o9-20020a17090a420900b002509aeecdf4si2045876pjg.58.2023.05.08.19.23.31; Mon, 08 May 2023 19:23:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=X71wGZHa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233996AbjEICU0 (ORCPT + 99 others); Mon, 8 May 2023 22:20:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbjEICUY (ORCPT ); Mon, 8 May 2023 22:20:24 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A07D9E60 for ; Mon, 8 May 2023 19:20:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683598823; x=1715134823; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Nmn1IPrYCW89+aGyZUryWtE01T7K4enWfajjIDcQAnk=; b=X71wGZHaWtNxVAwfoGBtocU91ALfwEWXKiH0xlmaffbyprPaFVi3MCGM aTIKG1FyVpfScplDrsHRmJpAD60XN+agWmDHhlTuMDW39jWCIkIfi7fCq UuuZYB7jzMxqjg6b8aaFGWI96asp2P1dYT94l3VGiASmg8M6Mc8kUMZxo ox4h8WlCV0uertwreEy/1YZGGzb+hm6oRZSQY6xrl23diBdcEjExBqHke OWVVvRpXjM+9BwLVv6Q3da6U0GFAup7QeZ6SOSwc4JTD7szve7xr6XXyS DO65dJZnDpgzRRE7Vc35/qzapI4ICHVhyHTfnK+wypLhajLKrkNP4WbHB Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="330155072" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="330155072" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2023 19:20:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="731515706" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="731515706" Received: from jiudongl-mobl1.ccr.corp.intel.com (HELO yhuang6-mobl2.ccr.corp.intel.com) ([10.255.30.15]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2023 19:20:19 -0700 From: Huang Ying To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Xin Hao , Zi Yan , Yang Shi , Baolin Wang , Oscar Salvador , Alistair Popple Subject: [PATCH 1/2] migrate_pages_batch: simplify retrying and failure counting of large folios Date: Tue, 9 May 2023 10:20:13 +0800 Message-Id: <20230509022014.380493-1-ying.huang@intel.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765381533850726154?= X-GMAIL-MSGID: =?utf-8?q?1765381533850726154?= After recent changes to the retrying and failure counting in migrate_pages_batch(), it was found that it's unnecessary to count retrying and failure for normal, large, and THP folios separately. Because we don't use retrying and failure number of large folios directly. So, in this patch, we simplified retrying and failure counting of large folios via counting retrying and failure of normal and large folios together. This results in the reduced line number. This is just code cleanup, no functionality changes are expected. Signed-off-by: "Huang, Ying" Cc: Xin Hao Cc: Zi Yan Cc: Yang Shi Cc: Baolin Wang Cc: Oscar Salvador Cc: Alistair Popple Reviewed-by: Alistair Popple Reviewed-by: Xin Hao --- mm/migrate.c | 103 +++++++++++++++++---------------------------------- 1 file changed, 35 insertions(+), 68 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 01cac26a3127..10709aed76d3 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1614,11 +1614,9 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, int nr_pass) { int retry = 1; - int large_retry = 1; int thp_retry = 1; int nr_failed = 0; int nr_retry_pages = 0; - int nr_large_failed = 0; int pass = 0; bool is_large = false; bool is_thp = false; @@ -1631,9 +1629,8 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, VM_WARN_ON_ONCE(mode != MIGRATE_ASYNC && !list_empty(from) && !list_is_singular(from)); - for (pass = 0; pass < nr_pass && (retry || large_retry); pass++) { + for (pass = 0; pass < nr_pass && retry; pass++) { retry = 0; - large_retry = 0; thp_retry = 0; nr_retry_pages = 0; @@ -1660,7 +1657,7 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, * list is processed. */ if (!thp_migration_supported() && is_thp) { - nr_large_failed++; + nr_failed++; stats->nr_thp_failed++; if (!try_split_folio(folio, split_folios)) { stats->nr_thp_split++; @@ -1688,38 +1685,33 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, * When memory is low, don't bother to try to migrate * other folios, move unmapped folios, then exit. */ - if (is_large) { - nr_large_failed++; - stats->nr_thp_failed += is_thp; - /* Large folio NUMA faulting doesn't split to retry. */ - if (!nosplit) { - int ret = try_split_folio(folio, split_folios); - - if (!ret) { - stats->nr_thp_split += is_thp; - break; - } else if (reason == MR_LONGTERM_PIN && - ret == -EAGAIN) { - /* - * Try again to split large folio to - * mitigate the failure of longterm pinning. - */ - large_retry++; - thp_retry += is_thp; - nr_retry_pages += nr_pages; - /* Undo duplicated failure counting. */ - nr_large_failed--; - stats->nr_thp_failed -= is_thp; - break; - } + nr_failed++; + stats->nr_thp_failed += is_thp; + /* Large folio NUMA faulting doesn't split to retry. */ + if (is_large && !nosplit) { + int ret = try_split_folio(folio, split_folios); + + if (!ret) { + stats->nr_thp_split += is_thp; + break; + } else if (reason == MR_LONGTERM_PIN && + ret == -EAGAIN) { + /* + * Try again to split large folio to + * mitigate the failure of longterm pinning. + */ + retry++; + thp_retry += is_thp; + nr_retry_pages += nr_pages; + /* Undo duplicated failure counting. */ + nr_failed--; + stats->nr_thp_failed -= is_thp; + break; } - } else { - nr_failed++; } stats->nr_failed_pages += nr_pages + nr_retry_pages; /* nr_failed isn't updated for not used */ - nr_large_failed += large_retry; stats->nr_thp_failed += thp_retry; rc_saved = rc; if (list_empty(&unmap_folios)) @@ -1727,12 +1719,8 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, else goto move; case -EAGAIN: - if (is_large) { - large_retry++; - thp_retry += is_thp; - } else { - retry++; - } + retry++; + thp_retry += is_thp; nr_retry_pages += nr_pages; break; case MIGRATEPAGE_SUCCESS: @@ -1750,20 +1738,14 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, * removed from migration folio list and not * retried in the next outer loop. */ - if (is_large) { - nr_large_failed++; - stats->nr_thp_failed += is_thp; - } else { - nr_failed++; - } - + nr_failed++; + stats->nr_thp_failed += is_thp; stats->nr_failed_pages += nr_pages; break; } } } nr_failed += retry; - nr_large_failed += large_retry; stats->nr_thp_failed += thp_retry; stats->nr_failed_pages += nr_retry_pages; move: @@ -1771,17 +1753,15 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, try_to_unmap_flush(); retry = 1; - for (pass = 0; pass < nr_pass && (retry || large_retry); pass++) { + for (pass = 0; pass < nr_pass && retry; pass++) { retry = 0; - large_retry = 0; thp_retry = 0; nr_retry_pages = 0; dst = list_first_entry(&dst_folios, struct folio, lru); dst2 = list_next_entry(dst, lru); list_for_each_entry_safe(folio, folio2, &unmap_folios, lru) { - is_large = folio_test_large(folio); - is_thp = is_large && folio_test_pmd_mappable(folio); + is_thp = folio_test_large(folio) && folio_test_pmd_mappable(folio); nr_pages = folio_nr_pages(folio); cond_resched(); @@ -1797,12 +1777,8 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, */ switch(rc) { case -EAGAIN: - if (is_large) { - large_retry++; - thp_retry += is_thp; - } else { - retry++; - } + retry++; + thp_retry += is_thp; nr_retry_pages += nr_pages; break; case MIGRATEPAGE_SUCCESS: @@ -1810,13 +1786,8 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, stats->nr_thp_succeeded += is_thp; break; default: - if (is_large) { - nr_large_failed++; - stats->nr_thp_failed += is_thp; - } else { - nr_failed++; - } - + nr_failed++; + stats->nr_thp_failed += is_thp; stats->nr_failed_pages += nr_pages; break; } @@ -1825,14 +1796,10 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, } } nr_failed += retry; - nr_large_failed += large_retry; stats->nr_thp_failed += thp_retry; stats->nr_failed_pages += nr_retry_pages; - if (rc_saved) - rc = rc_saved; - else - rc = nr_failed + nr_large_failed; + rc = rc_saved ? : nr_failed; out: /* Cleanup remaining folios */ dst = list_first_entry(&dst_folios, struct folio, lru); From patchwork Tue May 9 02:20:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 91349 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2572861vqo; Mon, 8 May 2023 19:30:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5tE3anVf3vP/1/d24SBwK8YNfrWp47SEg7sk4u19drclk0xDL9hNpsimFjFG98x9M94xkt X-Received: by 2002:a17:902:d38c:b0:1ab:675:3e31 with SMTP id e12-20020a170902d38c00b001ab06753e31mr14377842pld.37.1683599447070; Mon, 08 May 2023 19:30:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683599447; cv=none; d=google.com; s=arc-20160816; b=q02yW621Ec3TO+nMaTsQwVId0eWZbAHGYcUEV+VuKzSLE2cvgojK+YBOL5hs+kcnpE EU+oLJ02h+wQ5xhom9c3twygu4ys/v1vbLQE1ek2Sm0yx0uJF5WGM6N/2cwlZqLrW41s pqx+Hz0jXvZTctB1TXetY3CWqz7ZlscZaQ8YZfWMzGm2KwfwiG6DwcVFJcWsXmtVOHYM 1rsLEHXzHghgclph4wirmm66OaOv1hhkttdvaGrohi39xuBckUv1RqNcCz+0OzSH+JMz D713lm2T7xEYejPTim8avluOfo/JGKTby1oP3Vx9NTztlG2MwEkevcgC7BsO+YwDYQXH XJCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NZsjKvq/oEZwGKiUkWDbW0O1PTl5KHPWQkK+rF33UGg=; b=aDQnYTW6sLZGTLe4oXajJuT5q8G3CRSEdN12Zp+WHsJPZVjx0ugf0JqCahX+wtj2P9 wceQt+pfnu+J9T6LNoK208Ung1n/M1A4njYQLwXxB5/nmOmmoDpjF6sYEcjH3MFDjdzL 6xR7DX5R5/N/uqBueYlRgL0sTSnhjMDmX4SW2ipteQXjo6lHU0qCLAVOtmVCKayogwlM e04i+be+2jIJOReOKKZ6/ljNmFR0Q2vHsU2Eb4zqpwcM5rp8gvbU7fJvokfhy60qfUc5 QzxOmvqCp4V1zwQ3tYhGfMJHLDN1HkcjyitOffOgarBMNqWO7RuBnIegeKGK3XE84dDT VSgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nPQzQgm7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jb4-20020a170903258400b001aad604bb95si413908plb.152.2023.05.08.19.30.34; Mon, 08 May 2023 19:30:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nPQzQgm7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234111AbjEICU3 (ORCPT + 99 others); Mon, 8 May 2023 22:20:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233970AbjEICU0 (ORCPT ); Mon, 8 May 2023 22:20:26 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E906693CD for ; Mon, 8 May 2023 19:20:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683598825; x=1715134825; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jhv+F2tb9b4VuUgfQs8d2vVC/9qfFsg1b8FLFSc2Iok=; b=nPQzQgm7dX/tKdF/YaYQwF+DpVqXCtTawxjKUdgqXhOYf21xo2wEbFGP cLmmbdQPbN6upG/ww4nv7x11A7xtrdbiT1jOYN7ssag8UhJe0XGcewZ/b 4Qzfd11S0KLx//yr7jxcZ3vNpS21Kz/L6oMpSMOeOqqBy+HWWDpc45799 2tlF17SwoX8nj5HfPg8xon6bra85x1W+tcbmkfwVlYeiFlsAUKbtdUcDW jw8O4pxdcdk3j1epy+3VRCfAFwFVs34DXYuSL5QAINKSdCraXDyfBfyC0 De/+/TqOtbuj7M61q0Lj7evh4HRlV8TcfxoFqnihErx7TPPZWgDADftf1 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="330155080" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="330155080" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2023 19:20:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="731515730" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="731515730" Received: from jiudongl-mobl1.ccr.corp.intel.com (HELO yhuang6-mobl2.ccr.corp.intel.com) ([10.255.30.15]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2023 19:20:23 -0700 From: Huang Ying To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Xin Hao , Zi Yan , Yang Shi , Baolin Wang , Oscar Salvador , Alistair Popple Subject: [PATCH 2/2] migrate_pages_batch: code cleanup: remove is_large Date: Tue, 9 May 2023 10:20:14 +0800 Message-Id: <20230509022014.380493-2-ying.huang@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230509022014.380493-1-ying.huang@intel.com> References: <20230509022014.380493-1-ying.huang@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765381974009919421?= X-GMAIL-MSGID: =?utf-8?q?1765381974009919421?= Previously, in migrate_pages_batch we need to track whether the source folio is large/THP before splitting. So is_large is used to cache folio_test_large() result. Now, we don't need that variable any more because we don't count retrying and failure of large folios (only counting that of THP folios). So, in this patch, is_large is removed to simplify the code. This is just code cleanup, no functionality changes are expected. Signed-off-by: "Huang, Ying" Cc: Xin Hao Cc: Zi Yan Cc: Yang Shi Cc: Baolin Wang Cc: Oscar Salvador Cc: Alistair Popple Reviewed-by: Alistair Popple Reviewed-by: Xin Hao --- mm/migrate.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 10709aed76d3..2ac927a82bbc 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1618,7 +1618,6 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, int nr_failed = 0; int nr_retry_pages = 0; int pass = 0; - bool is_large = false; bool is_thp = false; struct folio *folio, *folio2, *dst = NULL, *dst2; int rc, rc_saved = 0, nr_pages; @@ -1635,13 +1634,7 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, nr_retry_pages = 0; list_for_each_entry_safe(folio, folio2, from, lru) { - /* - * Large folio statistics is based on the source large - * folio. Capture required information that might get - * lost during migration. - */ - is_large = folio_test_large(folio); - is_thp = is_large && folio_test_pmd_mappable(folio); + is_thp = folio_test_large(folio) && folio_test_pmd_mappable(folio); nr_pages = folio_nr_pages(folio); cond_resched(); @@ -1688,7 +1681,7 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, nr_failed++; stats->nr_thp_failed += is_thp; /* Large folio NUMA faulting doesn't split to retry. */ - if (is_large && !nosplit) { + if (folio_test_large(folio) && !nosplit) { int ret = try_split_folio(folio, split_folios); if (!ret) {