From patchwork Fri Jun 24 02:53:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 12893406 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 C3244CCA47C for ; Fri, 24 Jun 2022 02:53:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 550F88E01C1; Thu, 23 Jun 2022 22:53:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 501088E01BF; Thu, 23 Jun 2022 22:53:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 379658E01C1; Thu, 23 Jun 2022 22:53:39 -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 250838E01BF for ; Thu, 23 Jun 2022 22:53:39 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 00BA6357F8 for ; Fri, 24 Jun 2022 02:53:38 +0000 (UTC) X-FDA: 79611608958.23.41F271A Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by imf21.hostedemail.com (Postfix) with ESMTP id 482D71C0009 for ; Fri, 24 Jun 2022 02:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656039218; x=1687575218; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zkfooEuAcL1s/GMfIWYGeryZUxTknJxESw3mSAR4BLA=; b=iV0ATAJh7iTeN4cpzWop1IC2/up34qM7616bvxeLY11rNyqUri21tlv0 Sin/uhIDEmB4IHzVE8+P7romRR3R0YfJvb53F9feiEz+Uje9kJPZMCeJq y5sCP9UHdOkBcK5jFbThTkBZo8/QwKvWy35tpjrMEsKex6nTUQYll6W2r TMoWrRYhlrniT3tRSgSkgQILmUXxFOqEr4epSsFj85cTx0b7xwUwWSpZa 2S+oMCxaIU7Ja3vRCdes6Izcppw3DSBiv5v9DMEzaJlOUuzlwt/qmcuXd zYMsJfmVWN2gnG2rfaQg0A044E+QQdI56PY/MnYwmow/9WgvGCt9A2j4Z Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10387"; a="279672725" X-IronPort-AV: E=Sophos;i="5.92,217,1650956400"; d="scan'208";a="279672725" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2022 19:53:37 -0700 X-IronPort-AV: E=Sophos;i="5.92,217,1650956400"; d="scan'208";a="593018084" Received: from yxia2-mobl1.ccr.corp.intel.com (HELO yhuang6-mobl1.ccr.corp.intel.com) ([10.254.214.143]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2022 19:53:35 -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 3/7] migrate_pages(): fix THP failure counting for -ENOMEM Date: Fri, 24 Jun 2022 10:53:05 +0800 Message-Id: <20220624025309.1033400-4-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=1656039218; a=rsa-sha256; cv=none; b=Q8EpKh9k5uMdwygYqY5I5mIbEjMkY10IOpIVjNwYW0xY8rfuAWTHq5Wb+3wS71CUgUsxMJ nYhZbrpYo2BOZvH85sPFcVHmcqZNL21isRoA+FcSsaKNiA0wvYDYyHVGnSHT606+tFa6a+ aC2dIlqupkiUon68ayT5t5vZRZo+sO8= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=iV0ATAJh; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf21.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 192.55.52.120) smtp.mailfrom=ying.huang@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656039218; 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=pqEwmo4mshIJwpuC5Y/f3sNoNO7z9BHjjHKjvfR56j4=; b=8dSpOciAqHMzm5ZAqMV7hLktRV8RIcnxdqCTfuP3KdetDUyRxuyyAT9naDgLQ1EXdA9A8F +0zJxv3wqJB/oUTl8QNg6k9RHRavqqs5Dkc7WSuN8th7nMir1HtlWn5EJUbo7HnsiaiAtX xYd1qcEL9/39joEU0rcct2kYLaKuPh0= X-Stat-Signature: af7fe71qkfzkeuwwzi8hftzo8mqxtgwx X-Rspamd-Queue-Id: 482D71C0009 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=iV0ATAJh; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf21.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 192.55.52.120) smtp.mailfrom=ying.huang@intel.com X-Rspamd-Server: rspam10 X-Rspam-User: X-HE-Tag: 1656039218-43427 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 is fixed too, although that is not used actually. 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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 82444e7df9f1..542533e4e3cf 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1425,11 +1425,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,8 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, */ list_splice_init(&thp_split_pages, from); nr_thp_failed += thp_retry; + if (!no_subpage_counting) + nr_failed += retry; goto out; case -EAGAIN: if (is_thp)