From patchwork Tue May 12 04:22:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 11542055 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9550D14C0 for ; Tue, 12 May 2020 04:23:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5C58420675 for ; Tue, 12 May 2020 04:23:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C58420675 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 85423900092; Tue, 12 May 2020 00:23:50 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8051C900036; Tue, 12 May 2020 00:23:50 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 71965900092; Tue, 12 May 2020 00:23:50 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0132.hostedemail.com [216.40.44.132]) by kanga.kvack.org (Postfix) with ESMTP id 57B7A900036 for ; Tue, 12 May 2020 00:23:50 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 02603181AEF1A for ; Tue, 12 May 2020 04:23:50 +0000 (UTC) X-FDA: 76806773820.26.fan94_3e812febe1d34 X-Spam-Summary: 50,3,0,64fbf14741717b4b,d41d8cd98f00b204,anshuman.khandual@arm.com,,RULES_HIT:41:355:379:541:800:960:968:973:988:989:1260:1261:1345:1431:1437:1534:1543:1711:1730:1747:1777:1792:1801:1963:2393:2504:2559:2562:2693:2898:2909:3138:3139:3140:3141:3142:3354:3865:3866:3867:3868:3870:3871:3872:4250:4321:4605:5007:6119:6120:6261:7901:8634:8784:8957:10004:11026:11232:11473:11658:11914:12043:12296:12297:12438:12555:12895:12986:13053:13141:13161:13229:13230:13846:14181:14721:21080:21433:21451:21627:30016:30054:30064:30070,0,RBL:217.140.110.172:@arm.com:.lbl8.mailshell.net-62.14.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:26,LUA_SUMMARY:none X-HE-Tag: fan94_3e812febe1d34 X-Filterd-Recvd-Size: 4517 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Tue, 12 May 2020 04:23:49 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 74F8130E; Mon, 11 May 2020 21:23:48 -0700 (PDT) Received: from p8cg001049571a15.arm.com (unknown [10.163.73.104]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 354403F71E; Mon, 11 May 2020 21:23:43 -0700 (PDT) From: Anshuman Khandual To: linux-mm@kvack.org Cc: Anshuman Khandual , Andrew Morton , "Kirill A. Shutemov" , Zi Yan , linux-kernel@vger.kernel.org Subject: [RFC] mm/vmstat: Add events for THP migration without split Date: Tue, 12 May 2020 09:52:52 +0530 Message-Id: <1589257372-29576-1-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 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: Add the following new trace events which will help in validating migration events involving PMD based THP pages. 1. THP_PMD_MIGRATION_ENTRY_SET 2. THP_PMD_MIGRATION_ENTRY_REMOVE There are no clear method to confirm whether a THP migration happened with out involving it's split. These trace events along with PGMIGRATE_SUCCESS and PGMIGRATE_FAILURE will provide additional insights. After this change, A single 2M THP (2K base page) when migrated 1. Without split ................ pgmigrate_success 1 pgmigrate_fail 0 ................ thp_pmd_migration_entry_set 1 thp_pmd_migration_entry_remove 1 ................ 2. With split ................ pgmigrate_success 512 pgmigrate_fail 0 ................ thp_pmd_migration_entry_set 0 thp_pmd_migration_entry_remove 0 ................ pgmigrate_success as 1 instead of 512, provides a hint for possible THP migration event. But then it gets mixed with normal page migrations over time. These additional trace events provide required co-relation. Cc: Andrew Morton Cc: "Kirill A. Shutemov" Cc: Zi Yan Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- This is an indirect way for counting PMD migrations without split. Is there a better method possible ? Just request for comments at the moment. include/linux/vm_event_item.h | 4 ++++ mm/migrate.c | 1 + mm/rmap.c | 1 + mm/vmstat.c | 4 ++++ 4 files changed, 10 insertions(+) diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h index ffef0f279747..4b25102cf3ad 100644 --- a/include/linux/vm_event_item.h +++ b/include/linux/vm_event_item.h @@ -91,6 +91,10 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, THP_ZERO_PAGE_ALLOC_FAILED, THP_SWPOUT, THP_SWPOUT_FALLBACK, +#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION + THP_PMD_MIGRATION_ENTRY_SET, + THP_PMD_MIGRATION_ENTRY_REMOVE, +#endif #endif #ifdef CONFIG_MEMORY_BALLOON BALLOON_INFLATE, diff --git a/mm/migrate.c b/mm/migrate.c index 7160c1556f79..8d50d55cbe97 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -228,6 +228,7 @@ static bool remove_migration_pte(struct page *page, struct vm_area_struct *vma, if (!pvmw.pte) { VM_BUG_ON_PAGE(PageHuge(page) || !PageTransCompound(page), page); remove_migration_pmd(&pvmw, new); + count_vm_event(THP_PMD_MIGRATION_ENTRY_REMOVE); continue; } #endif diff --git a/mm/rmap.c b/mm/rmap.c index f79a206b271a..3c1fe3f45cb5 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1418,6 +1418,7 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, VM_BUG_ON_PAGE(PageHuge(page) || !PageTransCompound(page), page); set_pmd_migration_entry(&pvmw, page); + count_vm_event(THP_PMD_MIGRATION_ENTRY_SET); continue; } #endif diff --git a/mm/vmstat.c b/mm/vmstat.c index 96d21a792b57..a5254b7ee531 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1274,6 +1274,10 @@ const char * const vmstat_text[] = { "thp_zero_page_alloc_failed", "thp_swpout", "thp_swpout_fallback", +#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION + "thp_pmd_migration_entry_set", + "thp_pmd_migration_entry_remove", +#endif #endif #ifdef CONFIG_MEMORY_BALLOON "balloon_inflate",