From patchwork Tue May 17 15:34:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "kirill.shutemov@linux.intel.com" X-Patchwork-Id: 12852702 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 D60D3C433FE for ; Tue, 17 May 2022 15:35:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 31A538D0006; Tue, 17 May 2022 11:35:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C8848D0005; Tue, 17 May 2022 11:35:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 143368D0006; Tue, 17 May 2022 11:35:14 -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 0121F8D0005 for ; Tue, 17 May 2022 11:35:13 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D449A20C96 for ; Tue, 17 May 2022 15:35:13 +0000 (UTC) X-FDA: 79475633706.22.F33E45A Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by imf07.hostedemail.com (Postfix) with ESMTP id C4FDB400C4 for ; Tue, 17 May 2022 15:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652801713; x=1684337713; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OKRcLw6QsuGpSKY4/BO13xavP65NgCLYIODNZJ7MeM4=; b=PZTtsn6fwlSD41mfM2kLouOl4tv6LzNx8MWP2d5UOgS5CbBlj9IBHr3r YayQdgDTtZbM2TAChnkXTLg/tmLZRgoIPW/C081rzqMtrIPSM+WBm8LtE QWJxsJm3TcVG63TceORBxIyfelDGIof/3fnGq3xe8axzFjhSO3Y4BN0Yu ysKXNLSaSOqdKqfRyjxjbT38UPYaaH0S7yuPMnyszmSZZs0QKUjWq3G0y zoQzi4+J9hGCjjjfOudxvf8OcF8f+aiLW0XMEcOBY29RLsTZgyq0cYhGu kV3ZjBayChJaApc/GDPqLRbvpikk26+kBj9HzoFsauYiNPIv6glM/LYuu g==; X-IronPort-AV: E=McAfee;i="6400,9594,10350"; a="258783203" X-IronPort-AV: E=Sophos;i="5.91,233,1647327600"; d="scan'208";a="258783203" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2022 08:35:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,233,1647327600"; d="scan'208";a="672905613" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 17 May 2022 08:35:05 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 03686EAF; Tue, 17 May 2022 18:34:50 +0300 (EEST) From: "Kirill A. Shutemov" To: Borislav Petkov , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel Cc: Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Varad Gautam , Dario Faggioli , Dave Hansen , Mike Rapoport , David Hildenbrand , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCHv6 15/15] mm/vmstat: Add counter for memory accepting Date: Tue, 17 May 2022 18:34:44 +0300 Message-Id: <20220517153444.11195-16-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220517153444.11195-1-kirill.shutemov@linux.intel.com> References: <20220517153444.11195-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: C4FDB400C4 X-Stat-Signature: zxdbbntk3tikyn69jewrfqhjuawajygr Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=PZTtsn6f; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf07.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.20) smtp.mailfrom=kirill.shutemov@linux.intel.com X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1652801704-179206 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: The counter increased every time kernel accepts a memory region. The counter allows to see if memory acceptation is still ongoing and contributes to memory allocation latency. Signed-off-by: Kirill A. Shutemov --- arch/x86/mm/unaccepted_memory.c | 1 + include/linux/vm_event_item.h | 3 +++ mm/vmstat.c | 3 +++ 3 files changed, 7 insertions(+) diff --git a/arch/x86/mm/unaccepted_memory.c b/arch/x86/mm/unaccepted_memory.c index 6ecd79101922..fe1dabfae326 100644 --- a/arch/x86/mm/unaccepted_memory.c +++ b/arch/x86/mm/unaccepted_memory.c @@ -74,6 +74,7 @@ void accept_memory(phys_addr_t start, phys_addr_t end) } bitmap_clear(bitmap, range_start, len); + count_vm_events(ACCEPT_MEMORY, len * PMD_SIZE / PAGE_SIZE); /* In early boot nr_unaccepted is not yet initialized */ if (nr_unaccepted) { diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h index 16a0a4fd000b..6a468164a2f9 100644 --- a/include/linux/vm_event_item.h +++ b/include/linux/vm_event_item.h @@ -136,6 +136,9 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, #ifdef CONFIG_X86 DIRECT_MAP_LEVEL2_SPLIT, DIRECT_MAP_LEVEL3_SPLIT, +#endif +#ifdef CONFIG_UNACCEPTED_MEMORY + ACCEPT_MEMORY, #endif NR_VM_EVENT_ITEMS }; diff --git a/mm/vmstat.c b/mm/vmstat.c index b75b1a64b54c..4c9197f32406 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1397,6 +1397,9 @@ const char * const vmstat_text[] = { "direct_map_level2_splits", "direct_map_level3_splits", #endif +#ifdef CONFIG_UNACCEPTED_MEMORY + "accept_memory", +#endif #endif /* CONFIG_VM_EVENT_COUNTERS || CONFIG_MEMCG */ }; #endif /* CONFIG_PROC_FS || CONFIG_SYSFS || CONFIG_NUMA || CONFIG_MEMCG */