Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4555074rwb; Wed, 17 Aug 2022 01:54:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR6dkKkP5oUuXEmRrHL2z8FgEABzWl+Aztu4pFe5xmU4sQz7+I2jhRT8FXz31PhHSBVQXWQi X-Received: by 2002:a05:6402:28c3:b0:43a:6d78:1b64 with SMTP id ef3-20020a05640228c300b0043a6d781b64mr22593655edb.93.1660726467974; Wed, 17 Aug 2022 01:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660726467; cv=none; d=google.com; s=arc-20160816; b=y3oBM3rxu05l6foAqNI2PUlAmwgF35Usj/aqIGVJwiGnFWxfYiazKDNl9BdqVmzQom 03ZgdA6cN+aqxh7gU39omdVR7MqBXLpfLrvuQ5i5098JqhH4tuqt80+smhM5fJVtz+Lo j7kpp0kkepEirVMOafoZkUs1L9UDWYg+pquUnweTPEpgKtgtd8GHdivF6U+j/bldxVBS YmW1niuKw04ZWdOEji9o+vgsiiPo0zT8mFl9tMXEnCBzR0zFNh52I1o8bElhDtR+Mbs8 TM429onLLOMeQGKtsSmZI9I0CBueb2/UjaY11EieWweI1f9QPZuuDzDPjG8H0/DSscnG FiQw== 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=3rgRyEL+fj98TS9NcA+HYi+3Duv9VVgqi06kn1oee5E=; b=L1yjDa/PA8+jZ8pR9VBDJySejHeGAQPm0PaAU3PiHe5LXC+WMG1KVlk6FR6Mv1ARYG IkRlrBix4CO3ZMH+zXytNRgzyM7Y5YtbwbL26K5pDrBwwhvX3CK/TZGGR1bdVmsqsRsS xqDAa1UJ5kD+2UIYmClFTDRwwdPd9mFFBCEZR6lUXbDu8+0eRTsFf6EkqWRafk3o/bZJ u33CZFhfOFXkelZ6LKPFDHRohOFAporlFt5mkUlro7q4W1zFgMa2HsOdZEWdBZtTmcZF As+j2chEfHVoPUH/aT4uhXOas0Ud4ME0i1xtQHU6jlPRWGaSiuCrrDAkCyvUmPaqtWV1 /Geg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hOJLViGJ; 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 gn16-20020a1709070d1000b00738483e3d66si8246026ejc.266.2022.08.17.01.54.02; Wed, 17 Aug 2022 01:54:27 -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=hOJLViGJ; 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 S235035AbiHQIO7 (ORCPT + 99 others); Wed, 17 Aug 2022 04:14:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234589AbiHQIOj (ORCPT ); Wed, 17 Aug 2022 04:14:39 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC9F74D4F5 for ; Wed, 17 Aug 2022 01:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660724068; x=1692260068; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DKaFW9nCQZCfgbnugNhK3BHbzcTIAzrfbLSevgdOECU=; b=hOJLViGJDeG0qBsrnrzllQvV86KvQYgUKIdQaTeYo1JOKXpXCHlZgvBf d1JpoC0HHwa/4cSm4shQEdMH3dyPHzhXp1XALW9uYHHfJWnLUNmwy3dOa BX7urKtZJ6WEiCi/6UQcbHQBIKCNnaP+Wt83G+ao6ZirdmctS0BAOONR4 zq6tMZe2F2b73evJWWnCagyVQBQY84a9PQR81QSgNmn+sROXGqEC1J/k4 TT0jM0VXHDkNTqKJTEbb9I+nMDakm94eqQF7lnjRPC2L7X52Nmievp9fh T77Nh/VKjup1uhrWxX+ssy6cSC3TPx1aMz9qn+3a1sUhpQAbDM2UZT4Zl Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10441"; a="293228809" X-IronPort-AV: E=Sophos;i="5.93,242,1654585200"; d="scan'208";a="293228809" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2022 01:14:27 -0700 X-IronPort-AV: E=Sophos;i="5.93,242,1654585200"; d="scan'208";a="583668098" Received: from yhuang6-mobl1.sh.intel.com ([10.238.6.172]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2022 01:14:25 -0700 From: Huang Ying To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Baolin Wang , Oscar Salvador , Zi Yan , Yang Shi Subject: [PATCH -V3 3/8] migrate_pages(): fix THP failure counting for -ENOMEM Date: Wed, 17 Aug 2022 16:14:03 +0800 Message-Id: <20220817081408.513338-4-ying.huang@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220817081408.513338-1-ying.huang@intel.com> References: <20220817081408.513338-1-ying.huang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Reviewed-by: Oscar Salvador 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 19a9b26af7e2..ae55f08e72ce 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1494,11 +1494,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; } @@ -1514,6 +1514,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