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/l2p0vjcVnJzdRsV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qEq395rzePO8E5V5WYG0K+Ccik7Nz0ywspi8OETC2ax/kcBuf+6SAIUrFOT/0JgSFRzi10yUGM1AiV052EXqXFAhxJzicurCGzZQ== 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) {