From patchwork Mon Jun 27 02:24:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 12895973 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 2D84CC433EF for ; Mon, 27 Jun 2022 02:25:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E5636B0071; Sun, 26 Jun 2022 22:25:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 895EB6B0072; Sun, 26 Jun 2022 22:25:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75CE28E0001; Sun, 26 Jun 2022 22:25:10 -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 6733D6B0071 for ; Sun, 26 Jun 2022 22:25:10 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3926D32732 for ; Mon, 27 Jun 2022 02:25:10 +0000 (UTC) X-FDA: 79622423580.01.F086D18 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by imf20.hostedemail.com (Postfix) with ESMTP id CFC641C001F for ; Mon, 27 Jun 2022 02:25: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=1656296708; x=1687832708; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xrLa/qvK6z+0n+mfC12qZ9ZlrFmavRnbmmLZYXho3nE=; b=FwOMBQpis0DS6E9AzunYz1hFQKMvOYJ1o3OC2hWU4JRiBWgJxyiIm/o1 1BmH4JEGvOX5UrZPYR8DIs0uju+4wd8pmA3f172kuoO4qi2ad3kM/sHsu 43Mg1FpWjSlE61kPjDyDC2Nam/LCBE4P56P9dQWYKOau1br5dMds7KYLP LFjWjIpj62/pFmEYQdZ1SfQVRyGsdJ/JtBVFrfP7wR5m2wVBt45eBWyVR KSLLkTa/+8Q2C0ILvKA9rjVkczQbgdW8aQjZFeKOkgJiB+r5mBmFx0Tv4 kXMWiya5AUpeTHurca2fa1ik9nKby8jVr36WBz1y+64ymg+zmMLmdJt7R A==; X-IronPort-AV: E=McAfee;i="6400,9594,10390"; a="306809154" X-IronPort-AV: E=Sophos;i="5.92,225,1650956400"; d="scan'208";a="306809154" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2022 19:25:07 -0700 X-IronPort-AV: E=Sophos;i="5.92,225,1650956400"; d="scan'208";a="835992361" Received: from yhuang6-mobl1.sh.intel.com ([10.67.65.240]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2022 19:25:04 -0700 From: Huang Ying To: akpm@linux-foundation.org Cc: baolin.wang@linux.alibaba.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, shy828301@gmail.com, ziy@nvidia.com, Huang Ying Subject: [PATCH 6/7] migrate_pages(): fix failure counting for THP splitting Date: Mon, 27 Jun 2022 10:24:50 +0800 Message-Id: <20220627022450.1067783-1-ying.huang@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220624025309.1033400-1-ying.huang@intel.com> References: <20220624025309.1033400-1-ying.huang@intel.com> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656296709; a=rsa-sha256; cv=none; b=QLeS3bGT7nSz2BOyNChlRn/G31kY9Kj4axGCZRJURUqKakoYA0NJk3pUiPaPPGP7sZR29f L1EU81j0v+7I37NKLB7vnCoa71D6Uak9JjLq/kT5sOcgdOmquDITqhd1ch+8gdDRv3qAig y4ob9IAqDArGettsFrcr5Klg9Vr0oqs= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=FwOMBQpi; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf20.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 192.55.52.88) smtp.mailfrom=ying.huang@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656296709; 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=DAeFb13F5hzT8v1G0xlkz0ujhyPTSjF9it+rZMfPTdY=; b=46ilCa+Rw4lMTWUYBwoaZbL2FnLcrQ0JMZ4a/aaH323ooP7fh1xIa21qtiHU5igRX+A92G XFMc5jj1EF/qH6ltp2m8VJbLA93ajE5qyVTPtNNiyOA7qEzGDGaV1/YrecD2tiEvmmt/MA T7fzdeucLbZOkqQK3+BhNMV6JbA8ixE= X-Rspam-User: X-Stat-Signature: k3hpsfpz9yo387tjmcoynyohyca1gx8m X-Rspamd-Queue-Id: CFC641C001F Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=FwOMBQpi; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf20.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 192.55.52.88) smtp.mailfrom=ying.huang@intel.com X-Rspamd-Server: rspam03 X-HE-Tag: 1656296708-293085 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: If THP is failed to be migrated, it may be split and retry. But after splitting, the head page will be left in "from" list, although THP migration failure has been counted already. If the head page is failed to be migrated too, the failure will be counted twice incorrectly. So this is fixed in this patch via moving the head page of THP after splitting to "thp_split_pages" too. Signed-off-by: "Huang, Ying" Fixes: 5984fabb6e82 ("mm: move_pages: report the number of non-attempted pages") Cc: Baolin Wang Cc: Zi Yan Cc: Yang Shi Reviewed-by: Baolin Wang --- mm/migrate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 9d1883d5927f..70a0e1f34c03 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1305,6 +1305,8 @@ static inline int try_split_thp(struct page *page, struct list_head *split_pages lock_page(page); rc = split_huge_page_to_list(page, split_pages); unlock_page(page); + if (!rc) + list_move_tail(&page->lru, split_pages); return rc; } @@ -1364,7 +1366,6 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, thp_retry = 0; list_for_each_entry_safe(page, page2, from, lru) { -retry: /* * THP statistics is based on the source huge page. * Capture required information that might get lost @@ -1411,7 +1412,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, nr_thp_failed++; if (!try_split_thp(page, &thp_split_pages)) { nr_thp_split++; - goto retry; + break; } /* Hugetlb migration is unsupported */ } else if (!no_subpage_counting) { @@ -1431,7 +1432,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, /* THP NUMA faulting doesn't split THP to retry. */ if (!nosplit && !try_split_thp(page, &thp_split_pages)) { nr_thp_split++; - goto retry; + break; } } else if (!no_subpage_counting) { nr_failed++;