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: 13213100 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 687CFC77B73 for ; Sun, 16 Apr 2023 23:59:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ADA6F8E0002; Sun, 16 Apr 2023 19:59:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A89F08E0001; Sun, 16 Apr 2023 19:59:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 951C88E0002; Sun, 16 Apr 2023 19:59:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 828248E0001 for ; Sun, 16 Apr 2023 19:59:46 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4BF8114040B for ; Sun, 16 Apr 2023 23:59:46 +0000 (UTC) X-FDA: 80688924372.21.24AAC54 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by imf25.hostedemail.com (Postfix) with ESMTP id 1A731A0008 for ; Sun, 16 Apr 2023 23:59:42 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=luPJPzUS; spf=pass (imf25.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681689584; 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:references:dkim-signature; bh=98A0saAs6Kor8WbOsslrPvJhdmBqYfAT52kGk6ro9cw=; b=4dkvaT1FJbcalg3VGmBGut+VFdy/Sj8BWffrbFg9+rbonimL3axKXwOL6eZvP79qDnREBN +tk1aPHgOppw+ep0u6DpEySxmFT4VeDZEThxlwo4vMcB4qK6U3pkUseOb69plL//YRxxDe kkdXCOIpNPP6OKV4/hlf3x3O/Gp1e4E= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=luPJPzUS; spf=pass (imf25.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681689584; a=rsa-sha256; cv=none; b=djd05geM+wNbXER6xjupreRCXAskDOJpw2Z1Lkl5NDsdrVwcsxnxAtZiXOChWqDNvvGbj3 7kh/lFI7xQhkWFt8fdAOpPg/4AXNTuh+pNrwXHcQFUBOFLCXLdn263gdXyXgfKVHmOIkfl kKqw7kJdyno9NY9oAoiwvwv/tYOHysg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681689583; x=1713225583; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=8ItCe/3pGalePCdA1Zg7PlF+EcL1t8Mnxe0wX8c5at0=; b=luPJPzUSMHD9ULZGv+AuiYLdPSNJKzXgs+68gfK/baPl16zzG2+EgbVS iVpdqjL5Wd9Xw9STqAu7/8d1+yc3fiXKvRjduhNphm/99dhQuIRvf687n KvjT0NPkhdYrchljAt2oXLN3T6u6jzf0ZPfzfqwdJd4j6S89zAY/Uwbjw PfPVt74SFIJ8/7wheQGahqjZXwZmUiKlHbdSE/hu+D3Rv9Qw2e9Ve3qa8 gf01gvn//1Sw7A3kt1DDV5jMxVr9BBWsukNxlrH/fLs8hRYqmP7etHKX+ u3IEoOM52xCqs6ABS2zK6BmZBxznFpoXWveceH7UCdr7YYAv/NZ09Qicq Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10682"; a="328931877" X-IronPort-AV: E=Sophos;i="5.99,203,1677571200"; d="scan'208";a="328931877" 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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 1A731A0008 X-Stat-Signature: gkxqccc9he4o85z5r8dahmi67r8pw7co X-HE-Tag: 1681689582-294634 X-HE-Meta: U2FsdGVkX1/Tqiax0hXgb/wChwfh3F9OFBfQb9Fl5mtpy3FBYl48gS2WV6Kwu8KLAtFRG6D2XExyelVVaLOWlw91DRz3LXPk4BJsKlyX2y1LOWhjfOfHRn2kkk7ZvrrfZhv1zwcptAZS6ZyXVM4356IqIchJ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8FmbV44DF/qm+H5G72+c1vrqFbj0dAlAxgvmmtOtPAw6HOqqGFUtT+BmIRG3KOw== 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 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; } }