Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3119603imw; Mon, 11 Jul 2022 02:09:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uPZBsTDSitHixxQ8ReSRiQJlXAOQWNvuXf58zRoBNjrohauj7DGpSOnUqVuJ0ujE9GuTEy X-Received: by 2002:a17:907:9627:b0:72b:6d22:4334 with SMTP id gb39-20020a170907962700b0072b6d224334mr317929ejc.506.1657530566340; Mon, 11 Jul 2022 02:09:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657530566; cv=none; d=google.com; s=arc-20160816; b=uM+Sd5z3505n8qH5Vibpm3LcQI+O5SJ4yjpsMxCpby+osPHLTNms6pZ8zZLFo6EPgB sy2kRV/dMGuAdkRjkkjUBABcpHS8kfvAQXNytM26lJjpsNYNTrRPFyZLGNFSM8QMSePK oqNPR4OmLEodpeGIrwXmc8dBqdXIfuy5V3Afzrxt+LfDg5dIW+8asD83tfsB+C5TkmPl fQNPmCFm+ATIUyepmVS967KfVmteSQ6DRqW0M2OCpPq9mPuWIcjsG8Ka757zKCKPdOpR FQRNRyImIriorZ+JEleKKtPYIAqSY9PRxSV3EtxgRki2ZPuRjxCQPnpDOXGleLhw74+7 4BsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MYmXTDDSAKaMZ0moFrCqojrhvfKgUJoKAZAj0wawY/w=; b=D3vyAZTLkrn/YTlcJ94HVlHmkqA9Lr5TOn9ZKbseWF9TT9Z7jyEAJ94AZZm1I/xHnG 5g9bhy8QYbOo55vk+NI/7I3N8C6j3iMTU/N+lf/7BZ+frjVZTdJncPPeZ5VYyrJpqSvQ rPjnUPpuvpkRJmeiOJn/rAlMkj58oqhQ50c8wTE/rFtd6akvXMBH9nL5Gwu2GCm73y+r IEmioqTDemZNCspLPaqi+wJz3mFZjmLLN/AGFA7m3YISoAwGE2tG7LhGtaxsPBVfsEMZ 6HL5pMHX5GSN0F0ergTV3F1mG6lIJiXN+NCG7uLS8rWc4J1jjNAVTq3XSqxo22+2kF7f X4WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dZnP6vXu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d15-20020a056402400f00b004376b600290si9740891eda.350.2022.07.11.02.09.00; Mon, 11 Jul 2022 02:09:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dZnP6vXu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230456AbiGKIub (ORCPT + 99 others); Mon, 11 Jul 2022 04:50:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230199AbiGKIuL (ORCPT ); Mon, 11 Jul 2022 04:50:11 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B92392EA for ; Mon, 11 Jul 2022 01:50:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657529409; x=1689065409; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+5a4TVD9cAS8BYvma0cNTLvM2floEItwSC7MbOeP6I8=; b=dZnP6vXuswWp7hTLELKRIIZlsyhXg2IMLkgUTzmNn8zMr6Audri6h7D0 xp61GjpcP4470mtejiwyaLccou9ivnsDLHfoPunqLFfh6aa1lZ5Bytmux QoodWC1FKzP4aPZAOG75IvML/qhcAi1JDJ0X0ei60jkoVIj19rVU/NIda hca7r4CMVoNdYQDrDmjrvcYxspmt5pmeTQ8/44FCz0/UO4YJRFNlSwPx3 vrwD4wJpgsPfLyML7nWyeIQSKJJcwzTPypUDq8erFxTL54ORvOPCYIW61 U/FB5K9HwCztXtG3dJoSO9j66NWZSgqYBkLdczgVomUqCJGU6Z5g99+hn Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10404"; a="284637842" X-IronPort-AV: E=Sophos;i="5.92,262,1650956400"; d="scan'208";a="284637842" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2022 01:50:09 -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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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: -- 2.30.2