From patchwork Mon Apr 22 07:33:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13637832 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 4B0DCC4345F for ; Mon, 22 Apr 2024 07:33:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 749C06B0087; Mon, 22 Apr 2024 03:33:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F99F6B0088; Mon, 22 Apr 2024 03:33:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E8166B0092; Mon, 22 Apr 2024 03:33:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 4588A6B0087 for ; Mon, 22 Apr 2024 03:33:56 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 9EB85120AAA for ; Mon, 22 Apr 2024 07:33:55 +0000 (UTC) X-FDA: 82036353630.03.670614A Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 20EAE1C000B for ; Mon, 22 Apr 2024 07:33:52 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=QirCeQFD; spf=pass (imf21.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.124 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713771234; 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=Gb6VfdI9ZtJOoS4VLbD0sYNhLEGRO2lSjQ242TZ/9Wc=; b=h433BRhKo8ND7xndlGuQLUGRv78rm/CZKcHijbSSjWri0KlY5ILzlfeDB8omtwIGU8kkUJ kvE7OjfHVD6eY8OVU5BJNsN+PMRkMaIwFLx0nm5UpfophUcjdx+VAaF6qOASs54cAsSqso Z2Blj4h8XtQCwsNt4bboFGzChswCCzg= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=QirCeQFD; spf=pass (imf21.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.124 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713771234; a=rsa-sha256; cv=none; b=fbmE/gZXt/8tFNvPwQi64IXoLefdWBH3diBSDIPDz310AswkOqSyofaG0TrBwgoRkAcH/y tmVnRVL28XHuTbXLhB3jOdMiYO6EaD45l6kVSMJywzLlAcmDJ6D40bAT5j01ts4GYagqNc vr7nQ6sTRSoq6cGcB15cljVi+N12V/U= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1713771229; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=Gb6VfdI9ZtJOoS4VLbD0sYNhLEGRO2lSjQ242TZ/9Wc=; b=QirCeQFDlf9/uN6atLIOIp4+1oeOVuV1AUrMeHTGG3DH0ae8ZA36rfBI0MjyeqS4vCv4As+vlSEqzzGQ+zhrIsmAk45oVleOUxwYwHm1KRTuwUHIjNhWvR3nO5oqPHlc4+PxP37xYXPeaM/aFG/EhSsyanV2CD7qk9wjeUQewr4= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R231e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0W5.Hkrf_1713771228; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W5.Hkrf_1713771228) by smtp.aliyun-inc.com; Mon, 22 Apr 2024 15:33:48 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: david@redhat.com, ioworker0@gmail.com, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] mm: huge_memory: add the missing folio_test_pmd_mappable() for THP split statistics Date: Mon, 22 Apr 2024 15:33:43 +0800 Message-Id: X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-Rspamd-Queue-Id: 20EAE1C000B X-Stat-Signature: xqdsbdk7oskix7ggj5fmtj3z87ndfosm X-Rspam-User: X-Rspamd-Server: rspam07 X-HE-Tag: 1713771232-530775 X-HE-Meta: U2FsdGVkX19vFV771Z2A+yCRcGEz/zZytZAygkmmz/kHDLzDDtrg1GYWw8L7NAwJVsaxlv3yRMb7QN6kYiUQKK9REl0BLrvZ1wihMuc+WgKZLDbeJw/ZVS9qMb6+mxNFkZQhVDUrmFLh/LgpaxEcubmNxUIB6npaUivZUtS4AXnwgKpco0GBNzXG+CLgQ26loeGRMVGF9fh3Kje3rh9LjFUrTVYF2/IG5svNxfAfcLLqTIR/yTxEWdJzqpO4Y3nbfbvkI/7HeuYYCqAxBDCGLKkI7DeqDEdz+mZ2QaplsK7LZRslnAg+EO6eim8/H88x6VIVU1GDMhNvNcCbGt0WeloKru2gCOTtYr/O5C+b9iaqqj/U2xgTtUyuhdiCUVRrXGeChWMFwLSfqynhB39tQDmu46F2fzqGVgoGTBvByLIuuPMA7Oq9IDyI7vcCn6zqLJh0l6fZXGytAiGJ5mAxvugfnQ+pFlBBUpkAinDNOWBmEZgpUQM49vhIKD0aYTc8MQ8tYNY/p/ABF9wdCNAwkhn4IlDS/nOGLq+acTHrihdfNuPRDrhDDl8q0g5aKtj/8I6ygE8hLza9XF3qpI9513sHti4fQnrf0yIo4TBFLKSd0X274mToYVJOEhak/x0IKrnlCq/QOSboRzUsQckiZqXnbav8935dYok5b2Y32MKu7nlCk5lOsCy+yX85fG6S8Ct3+Dk9u6CSCipWLY1sUzoLQvoKscihh2wZsHXl2CacS/MPCfngKuYCEWJZ6NMyzFkujRqyfvGUdFUoaiFwoPGAqQ0H6njcdZ8m0lJmpR8RDeoDaKZIpdemnLO4tJZGbVmyyZtRVvQCl6qF03m/fOJo3Pfo7lk5Ik/wdP2Sf4NjmF1TAOtvb58euwnnBzWuQX6R2fa39qaA1KwHmPQEZAj6lCJ24ncTTPlJ75C5BYJT/KXiCDKviHFx78zoPVq3r7qcEGCHIWFEvdzUIEn w5GXTL34 gAZaReoqoErIe1D8Rx7NbJDmZRrhZIiGnsIil5TSu1C6aNh472Xu+ljfDGbUdunBEhe25r6fA6uKznmZ7tCHck5/3vhe9bztY4tIbobXEt0tKC9Jl5bHgFnKUQrAF5FfLtRIh++zre6PluRHW8s7f1Xs7quPzPvvdHV0oCfcceLi8t/ZxwuNY8pnBbjEQE67tbBLYFv4F0XGyAppZnGpOPQh1joRTQQG0rOjMl25XSNs7Ci81TVCD+kdJo0nfZF4M3jmCnOwB/knet21C4mxWaKTxh1igwKAJabu+w8IYMX8w18NxD8zqvffCRQ== 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: List-Subscribe: List-Unsubscribe: Now the mTHP can also be split or added into the deferred list, so add folio_test_pmd_mappable() validation for PMD mapped THP, to avoid confusion with PMD mapped THP related statistics. Signed-off-by: Baolin Wang Acked-by: David Hildenbrand --- Changes from v1: - Add acked tag from David. - Check the THP earlier in case the folio is split per Lance. --- mm/huge_memory.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 716d29c21b6e..a9789ca823bc 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2994,6 +2994,7 @@ int split_huge_page_to_list_to_order(struct page *page, struct list_head *list, XA_STATE_ORDER(xas, &folio->mapping->i_pages, folio->index, new_order); struct anon_vma *anon_vma = NULL; struct address_space *mapping = NULL; + bool is_thp = folio_test_pmd_mappable(folio); int extra_pins, ret; pgoff_t end; bool is_hzp; @@ -3172,7 +3173,8 @@ int split_huge_page_to_list_to_order(struct page *page, struct list_head *list, i_mmap_unlock_read(mapping); out: xas_destroy(&xas); - count_vm_event(!ret ? THP_SPLIT_PAGE : THP_SPLIT_PAGE_FAILED); + if (is_thp) + count_vm_event(!ret ? THP_SPLIT_PAGE : THP_SPLIT_PAGE_FAILED); return ret; } @@ -3234,7 +3236,8 @@ void deferred_split_folio(struct folio *folio) spin_lock_irqsave(&ds_queue->split_queue_lock, flags); if (list_empty(&folio->_deferred_list)) { - count_vm_event(THP_DEFERRED_SPLIT_PAGE); + if (folio_test_pmd_mappable(folio)) + count_vm_event(THP_DEFERRED_SPLIT_PAGE); list_add_tail(&folio->_deferred_list, &ds_queue->split_queue); ds_queue->split_queue_len++; #ifdef CONFIG_MEMCG