From patchwork Tue Apr 5 23:43:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A. Shutemov" X-Patchwork-Id: 12802169 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 0E518C433F5 for ; Tue, 5 Apr 2022 23:51:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 79CDF8D0003; Tue, 5 Apr 2022 19:49:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 74C388D0001; Tue, 5 Apr 2022 19:49:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5ED0F8D0003; Tue, 5 Apr 2022 19:49:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 501FA8D0001 for ; Tue, 5 Apr 2022 19:49:00 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 2860323FD0 for ; Tue, 5 Apr 2022 23:48:50 +0000 (UTC) X-FDA: 79324468020.18.E949DE2 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by imf09.hostedemail.com (Postfix) with ESMTP id 4B38F14003B for ; Tue, 5 Apr 2022 23:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649202529; x=1680738529; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RyShgqLY7MIPXh/I0xSRyqWdn3IGjezVnvsj+/bA36c=; b=RCObTXmMqU9CRDNPW0FIIGbR3ZgIiS/hgSLFwj7E04HRuZJR1BPdbzdk Z2JpOgSSMPseb7AoIsysQEML48qp9gUI3TvR14MmbTn79eSDmOrPXgea1 PB5KaKRyxp83KxiEEuXMTTgUYgweIlk4XmW07q3imMFyKe3LrDNl5dZXJ Mgvm9xX4vWsPRnC3iXqigVHnOI4A9CF/8ZVW6OrK96yFDxdbWE9Ix2bFy hs/vTFNKrsYyFDKaDKSOGYG7MW3B2X9iFGwedxGcLshXa35aLBW4pXboc 8YPMAaw7J6WPlXyddzy3dYpvyL66wf7uK2RsC4CwffmdENSIDAtUjQDGU A==; X-IronPort-AV: E=McAfee;i="6200,9189,10308"; a="259725635" X-IronPort-AV: E=Sophos;i="5.90,238,1643702400"; d="scan'208";a="259725635" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2022 16:48:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,238,1643702400"; d="scan'208";a="641817585" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 05 Apr 2022 16:48:41 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id E93DB62E; Wed, 6 Apr 2022 02:43:47 +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 , Brijesh Singh , Mike Rapoport , David Hildenbrand , 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: [PATCHv4 8/8] mm/vmstat: Add counter for memory accepting Date: Wed, 6 Apr 2022 02:43:43 +0300 Message-Id: <20220405234343.74045-9-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405234343.74045-1-kirill.shutemov@linux.intel.com> References: <20220405234343.74045-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=RCObTXmM; spf=none (imf09.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 192.55.52.120) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com X-Stat-Signature: b3ksd7osfpm4x41rreeo4jzzstnop7oz X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 4B38F14003B X-HE-Tag: 1649202529-366714 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 2f1c3c0375cd..7cfe0bd8d2be 100644 --- a/arch/x86/mm/unaccepted_memory.c +++ b/arch/x86/mm/unaccepted_memory.c @@ -32,6 +32,7 @@ void accept_memory(phys_addr_t start, phys_addr_t end) else panic("Cannot accept memory"); bitmap_clear(unaccepted_memory, rs, re - rs); + count_vm_events(ACCEPT_MEMORY, PMD_SIZE / PAGE_SIZE); } spin_unlock_irqrestore(&unaccepted_memory_lock, flags); } 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 */