From patchwork Sun Apr 16 23:59:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 83942 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1800820vqo; Sun, 16 Apr 2023 17:25:22 -0700 (PDT) X-Google-Smtp-Source: AKy350Y2aUBVMnLgcyLq6Q6t4lJwBWpK9yN9tEih3SiKgy+EPuzKN+UY3wQAxoLfLamlsaoNYRy/ X-Received: by 2002:a17:90a:7f92:b0:246:aeee:e61c with SMTP id m18-20020a17090a7f9200b00246aeeee61cmr14792797pjl.11.1681691122202; Sun, 16 Apr 2023 17:25:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681691122; cv=none; d=google.com; s=arc-20160816; b=TfZaNzHvGA5CxXpMlN/jOYzb9Yebb8cjy8sJflobg9UdrqGL8jRjYtxB09Gbaykcbi NAqKeLU3mKQLKetW28mB0qoQYwwUETnbx1nUW6Ueh8HYnEE22WoYd1jzrKhoD9PKIXoz kUuCeKsmwMDfWgCca/8iIdyQbr7S75QYaEVCtpudFX8Z6gcwLurGzcttSaQi4jiyNCe9 il/uEUXamTg0TyxLhqRUw84927NyWmTzKIQ4H8c2ebsiIStO4twZa1iUJ64j4yCi0x91 iIYtZUAXptyX4Ds2SGyCPmmcnh6WWx/Q2uOrufuVtNLoqMc0s4EDvCcUnm7Xx/U6EOeM pqbg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=98A0saAs6Kor8WbOsslrPvJhdmBqYfAT52kGk6ro9cw=; b=WTA0fpysrVW8/RkR3a0oUEcgZXzWIbc5+TyvPiedWQOOOmWqm8Lf+AUYp4XifY/yjM /dK4LVEjNTOTwa0hRUYfuRVF7zy2Xl+/amrmQGXLYz4LXJyCfZvhj2kQ9jbxe6doM3i0 P072gAgFQ/VjoKQ8PPs7D/QcP9fXxU9uznOyWHZwNDAllCniLwpg1DF1DCYBfz1fShTk wUFpCMVAZ47iUuNSjwbdkYV9Y/pUARDGRWtxm/GDvxl+3oeIVRISrfp1e/ovC/IUj3O6 zfSYX5u63yC13avkHIm6kp+2RAv6ywBsRwI+uH4KqSKuap//D9U9UA9ErnRa1DXT2/f3 aGLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FJHrZk1+; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i20-20020a17090acf9400b0023418ec51f8si12889667pju.136.2023.04.16.17.25.10; Sun, 16 Apr 2023 17:25:22 -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=FJHrZk1+; 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 S229667AbjDPX7n (ORCPT + 99 others); Sun, 16 Apr 2023 19:59:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjDPX7m (ORCPT ); Sun, 16 Apr 2023 19:59:42 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA38E1FE0 for ; Sun, 16 Apr 2023 16:59:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681689581; x=1713225581; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=8ItCe/3pGalePCdA1Zg7PlF+EcL1t8Mnxe0wX8c5at0=; b=FJHrZk1+pJLhN96Tp0356GkgkkcubTkgneOGRELzxdOIximK6DKnqL5k PWQz8/l0iyFdPykXM/QFNhUkxvoiwS0TXF4E1XGImcbDDzwcNBSZW4oAk +5OQ1xu2BLqRXR3g2qpVeutlafq6rZqRSdCpYI8SOwMtdBwL2+8OqqjPK QUA+gtlloiGym2dbxr5XA/iIoCNMkqNusHOAojZDZtNcLRAyzCU37gG6V uyeaQw9pdal6Yl6GMTVbr/sjDYAWg69MIPIvJkkPU0fhyEcBV8PZWLV/h oxh3dBIWDgCqBkOH9IP1Scos1YxRM3ZB4+zjLRMWhG6VwX8/HTlKgTdhE A==; X-IronPort-AV: E=McAfee;i="6600,9927,10682"; a="328931875" X-IronPort-AV: E=Sophos;i="5.99,203,1677571200"; d="scan'208";a="328931875" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2023 16:59:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10682"; a="720933757" X-IronPort-AV: E=Sophos;i="5.99,203,1677571200"; d="scan'208";a="720933757" Received: from haowang7-mobl1.ccr.corp.intel.com (HELO yhuang6-mobl2.ccr.corp.intel.com) ([10.255.28.119]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2023 16:59:38 -0700 From: Huang Ying To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Baolin Wang , Alistair Popple , David Hildenbrand , Yang Shi , Zi Yan Subject: [PATCH] migrate_pages_batch: fix statistics for longterm pin retry Date: Mon, 17 Apr 2023 07:59:29 +0800 Message-Id: <20230416235929.1040194-1-ying.huang@intel.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763380950176986230?= X-GMAIL-MSGID: =?utf-8?q?1763380950176986230?= In commit fd4a7ac32918 ("mm: migrate: try again if THP split is failed due to page refcnt"), if the THP splitting fails due to page reference count, we will retry to improve migration successful rate. But the failed splitting is counted as migration failure and migration retry, which will cause duplicated failure counting. So, in this patch, this is fixed via undoing the failure counting if we decide to retry. The patch is tested via failure injection. Fixes: fd4a7ac32918 ("mm: migrate: try again if THP split is failed due to page refcnt") Signed-off-by: "Huang, Ying" Cc: Baolin Wang Cc: Alistair Popple Cc: David Hildenbrand Cc: Yang Shi Cc: Zi Yan Reviewed-by: Baolin Wang --- mm/migrate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/migrate.c b/mm/migrate.c index b34a0f383795..47a1e8445f45 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1743,6 +1743,9 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page, large_retry++; thp_retry += is_thp; nr_retry_pages += nr_pages; + /* Undo duplicated failure counting. */ + nr_large_failed--; + stats->nr_thp_failed -= is_thp; break; } }