From patchwork Mon Jul 11 08:49:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 12913157 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 D623BCCA480 for ; Mon, 11 Jul 2022 08:50:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A6DB6B00A8; Mon, 11 Jul 2022 04:50:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 008CC6B00A9; Mon, 11 Jul 2022 04:50:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D789E6B00AB; Mon, 11 Jul 2022 04:50:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id B93446B00A8 for ; Mon, 11 Jul 2022 04:50:10 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 8D77034916 for ; Mon, 11 Jul 2022 08:50:10 +0000 (UTC) X-FDA: 79674196980.02.D191F4F Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by imf16.hostedemail.com (Postfix) with ESMTP id E7F2C180061 for ; Mon, 11 Jul 2022 08:50:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657529410; x=1689065410; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+5a4TVD9cAS8BYvma0cNTLvM2floEItwSC7MbOeP6I8=; b=mVuvG7lOCHsKBlgNQ9l7uOnhHM9UUdSh2qGbxiCElCztDxV46qN4KCae WKl5XVGPdGHCLJJVYQQqhBVSPZ2IunixPyJnC5I7+LGjHNnci76L7/J/w ISHFHb0/NWq8a12pUrJ5CtKyTdfw8DOKu5a7AEvRkrJ6erU7wh6ZQW4vH 0S34zFqOrvUvlZ0zca15EsIWo/d7LF33mw1Lqv8SxKxjqwxRPIuiuC2Fq gE4jF05Su05pJwWV5kx+5sCCnEM3/U+NybKLgBSuhV+5sdK0Y1vh7axl4 cuQUjI/m4OZi0U1DEE+U5D+zkcowyJBeKghbWFg18iCKIpCxMqMMKsfvV A==; X-IronPort-AV: E=McAfee;i="6400,9594,10404"; a="346296572" X-IronPort-AV: E=Sophos;i="5.92,262,1650956400"; d="scan'208";a="346296572" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2022 01:50:10 -0700 X-IronPort-AV: E=Sophos;i="5.92,262,1650956400"; d="scan'208";a="652374135" Received: from yhuang6-mobl1.sh.intel.com ([10.238.5.168]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2022 01:50:07 -0700 From: Huang Ying To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Baolin Wang , Zi Yan , Yang Shi Subject: [PATCH -V2 3/7] migrate_pages(): fix THP failure counting for -ENOMEM Date: Mon, 11 Jul 2022 16:49:44 +0800 Message-Id: <20220711084948.274787-4-ying.huang@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220711084948.274787-1-ying.huang@intel.com> References: <20220711084948.274787-1-ying.huang@intel.com> MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=mVuvG7lO; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf16.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 134.134.136.31) smtp.mailfrom=ying.huang@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657529410; 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=MYmXTDDSAKaMZ0moFrCqojrhvfKgUJoKAZAj0wawY/w=; b=6xXB8KPZK/LVXnS3EhqhhTkuAfH+Z4syRs73+Jr9+F7eRPRX23rOwYEmn7thwx8ztcQ4gx s+3MOl6BxIxJWNZNdL/0v/3xvIagyoBx3o9nspctWboxwaVGap7dRl4VwkNN6TiPX9WrRZ 0auMKWbPCwu4DvNvqwXaHg/2fFLGhwQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657529410; a=rsa-sha256; cv=none; b=DOq7Hx9EJZeeCl+MQc3SAijUkzDJNu9tnSh7ztxUyNpJPhwpcYDVpzYB12FMg3y7+7uJFq uLiGE1dp79y20f1kfptQOkncs1UnOXJjYFMaqUIRpW7NqI8+6LeIjQoIOuyC8R/rBeczJ/ FSRV2aeT6PqzU6cUkq5R081rtNq/XqM= Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=mVuvG7lO; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf16.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 134.134.136.31) smtp.mailfrom=ying.huang@intel.com X-Rspamd-Server: rspam06 X-Rspam-User: X-Stat-Signature: rsg9qg8ruo61yr1w9ehujarjsby3eqcm X-Rspamd-Queue-Id: E7F2C180061 X-HE-Tag: 1657529409-47668 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: In unmap_and_move(), if the new THP cannot be allocated, -ENOMEM will be returned, and migrate_pages() will try to split the THP unless "reason" is MR_NUMA_MISPLACED (that is, nosplit == true). But when nosplit == true, the THP migration failure will not be counted. This is incorrect. So in this patch, the THP migration failure will be counted for -ENOMEM regardless of nosplit is true or false. The nr_failed counting isn't fixed because it's not used. Added some comments for it per Baolin's suggestion. Signed-off-by: "Huang, Ying" Fixes: 5984fabb6e82 ("mm: move_pages: report the number of non-attempted pages") Reviewed-by: Baolin Wang Cc: Zi Yan Cc: Yang Shi Reviewed-by: Oscar Salvador --- mm/migrate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 794312072eb3..38e2c789a9c3 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1426,11 +1426,11 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, /* * When memory is low, don't bother to try to migrate * other pages, just exit. - * THP NUMA faulting doesn't split THP to retry. */ - if (is_thp && !nosplit) { + if (is_thp) { nr_thp_failed++; - if (!try_split_thp(page, &thp_split_pages)) { + /* THP NUMA faulting doesn't split THP to retry. */ + if (!nosplit && !try_split_thp(page, &thp_split_pages)) { nr_thp_split++; goto retry; } @@ -1446,6 +1446,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, * the caller otherwise the page refcnt will be leaked. */ list_splice_init(&thp_split_pages, from); + /* nr_failed isn't updated for not used */ nr_thp_failed += thp_retry; goto out; case -EAGAIN: