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: 13235301 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 38E75C77B7F for ; Tue, 9 May 2023 02:20:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 37B97280006; Mon, 8 May 2023 22:20:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 32B3B280001; Mon, 8 May 2023 22:20:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F2D2280006; Mon, 8 May 2023 22:20:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 0C98C280001 for ; Mon, 8 May 2023 22:20:28 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D047D1C6DDD for ; Tue, 9 May 2023 02:20:27 +0000 (UTC) X-FDA: 80769112494.01.4B1F353 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by imf12.hostedemail.com (Postfix) with ESMTP id 630A440009 for ; Tue, 9 May 2023 02:20:25 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=VhXG5HYY; spf=pass (imf12.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.151 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=1683598826; 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:references:dkim-signature; bh=+WdzJwxvekpZiCdmFrPivA731vNoIk8+hwlrPBM62LA=; b=rC2a8JnVvzycQBhyLJ0zoUvqUx0Mjizzn4zflrSdlRZA4kTM1w0r5gHZRhPz94Tcu6fu9Z 9LcBlV0O9CnemMPkF12jbYluWW6PjnXBUVvRi77VwD9jRsrgYpxwbj7nqIweddAYKLcBc/ elaoyAyUwR0CSarlr4p1VXxc42vM7wM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683598826; a=rsa-sha256; cv=none; b=2GLJAEXNWzoo435l6NkaqaoGtyX2oDvcSFwS5RftKXzQY+ewdZpdJVMypd4ctHk2pjdyjb w7t86QvZVh367Oe/lT7PTJszFHrpj7E6oS0wmrBNt4YXtdJcNAzxFcBJ//Xr0a4mc1k+tU DX+siirpBBEH/gEOS0NC+AOb2hYBU2g= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=VhXG5HYY; spf=pass (imf12.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.151 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com 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:mime-version: content-transfer-encoding; bh=Nmn1IPrYCW89+aGyZUryWtE01T7K4enWfajjIDcQAnk=; b=VhXG5HYYWdTaBzJdsFLrFRMyqj95IMjlxPFEtceJIwfao8h8ovLv4/D6 KrqQQ9JEPIzYMm7k7ozOOqdEanV7bWnat3JUksjUskKjEN5cKKMePg4wX s4v6X3+fqW/GWROmHJvHgqGyp8Gi0Nx7/gpfKrQM0F+rTm9XRwy5hRZAo ZPxfTq2sg89LSfXHvkWaah8+ux/CxjOMKEBX5UfK8MDWr+ZaE6CH5Y0fc 8LcBhw7smPTKey6srRTcOE+uekwtjzJWvZEXk6Q2gRZTXm4WpQHHy/Kqa sbNKFK1PF0CzYbnMFnQwEQp1wM/uALckg7Bdx5q/PTRJVD4ShM90HucSU w==; X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="330155068" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="330155068" 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-Rspamd-Queue-Id: 630A440009 X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: sajt97w1zi8zewzecgukarae4n6tpntf X-HE-Tag: 1683598825-930386 X-HE-Meta: U2FsdGVkX18XTftj29UdyoslTJ8SXyrCe8IoghGlchO/0Y7d2qTgEFG7Iwh8Un9gpHXAMg5myIKkMdugnf6zKJaEBon5XKDsFTjFEe8/eMKJ77SMWlMssxzrz6v4xvgC0MnPK8ck1s9NpKZJK2Azo6zbUH471oOdpV6PA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RjNSRWb9v3srnqvFl3KIs+Vr3uSKQ== 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: 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: 13235302 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 96A62C7EE25 for ; Tue, 9 May 2023 02:20:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E50C9280007; Mon, 8 May 2023 22:20:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E0187280001; Mon, 8 May 2023 22:20:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2C85280007; Mon, 8 May 2023 22:20:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id AC11E280001 for ; Mon, 8 May 2023 22:20:29 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 7C3E714034D for ; Tue, 9 May 2023 02:20:29 +0000 (UTC) X-FDA: 80769112578.19.E979858 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by imf20.hostedemail.com (Postfix) with ESMTP id 774881C000A for ; Tue, 9 May 2023 02:20:27 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=IeFqNrOX; spf=pass (imf20.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.151 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=1683598827; 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=NZsjKvq/oEZwGKiUkWDbW0O1PTl5KHPWQkK+rF33UGg=; b=BYDjuKRc39uPoKl2Gx5Xs8YTngQVA2yR2spCVp8cPzhDd/WImVP3X1quVLG/Xkgx5lfwgw daOEy/2CgpjfahEvepcsb8HDw4BgVXOL2vDyGd641DJzq1iqube5VT5YVgYtI5zAkk0lt3 41kWJ381tDnfyA2fQMSI4OclQMK2Zgg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683598827; a=rsa-sha256; cv=none; b=qbtjPCEulKPXEkUKFomoJTv1+uijTAGJzprlBTDiS/x6i5oke0Rf/e41/SGVWvTfEn+0s6 n0JaNeVj2t/o54xlkmVIcV4EfkLp8p/dAm7QiUxRI/5hzspSTGk7YXR1MiWhKLAt9KWpKb WXDI6nEUlco8RmmS6/doUmll1C8hSwc= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=IeFqNrOX; spf=pass (imf20.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.151 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683598827; x=1715134827; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jhv+F2tb9b4VuUgfQs8d2vVC/9qfFsg1b8FLFSc2Iok=; b=IeFqNrOX7Q1Umiwl0IbVWXmawWqSFk0Echlh4/ML9p7CHuql0EeWDdQ8 Yp2+J5V2Wrp29JkZfpmyu4VCodXc+xYuppphP8/yj96Iucvt4E697Zq1S mS+jdziGIx2tTKa99OvxE9KTk6lghCpU7LtbMnQacUqQ8sQ/UUobN1HQx 55oOVCAXAVv0f64+5oLqJPQUjUroGOZOfcSSn7WoDMy4doEyizMTX/YPM iO6mBrqLR0rDK33VCtjRwiAmljQwBnZZGUZVRsd4E/j7mSaEXEqyt9pg4 aVy8vEGUIdMYRjYvKt2nfNP4pndsfP4H4qjS7LBR6iWkvAbWnuDFD+wmx w==; X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="330155079" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="330155079" 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-Rspamd-Queue-Id: 774881C000A X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: nqx4jnu5kb3mjdye9kuaaqt55jmhuoqj X-HE-Tag: 1683598827-113539 X-HE-Meta: U2FsdGVkX19PvyPl+RE9xhd02/2UA2QlRs0221MzIrF7RPsVOGvnzBMCIg41VmlQ//R1ullAQMD4sr/l2p0vjcVnJzdRsVWkeK6+ohY27V/NMxSEMIVn4oz1EOQJoN9rZn4/wzmRF3Bc465R+bn+c8CI4pCgA7hXW7l5jNf3PgCGOX0pKpJ59d9g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zZQ== 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: 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) {