Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3928182iob; Tue, 17 May 2022 10:03:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVfbe1t3M68vBMSXb3di+JVkkrxMomWUC7KtLWTky5NCq3KvyYRagUFCtWskv/pwRBCGg8 X-Received: by 2002:a17:902:bf09:b0:153:99a6:55b8 with SMTP id bi9-20020a170902bf0900b0015399a655b8mr22848516plb.142.1652807037242; Tue, 17 May 2022 10:03:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652807037; cv=none; d=google.com; s=arc-20160816; b=QaUDR5ZN+e2kjYVhd0OIEazso9MzSsJNOXTO7gPRM2OyNByRYJzuTndplHyEihyCpg kMCoaQ/r4gHWMS2Y/aJq2dg7c3gJIzz85MK1spH0tXCq6f5kjpQ1zq5d6xHC++DY8rFG ST+kiOVcYM2OXcg0wFiYD2QqoiEwk0WIhjdc+3RG1E9zLXdt1xb6xMIuAn82WqrHaSgZ ejpb37/gQM7ZJHhgUkJoNj9TI7XjsEEZ1aVDXMrUcC8f8DTIE6cFO89EbiUfavEkLj+i 0U8whG5L2qhIjMH40lKEXcTP9sR7vztuqjpld/LaJ9ut5BECTu8br9wSpvCEEVSJGYCm FAaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fOL67J46y89BJJi9to+Vnyvzj+OaXnH4F6pYjH/l5KE=; b=s0y5VcYB93KzNmFXPB1zU/Qxo3kZ1JYdO9PyJunfdk4qxIB8kPA89B0u/W442QgPqb I8sO0skw1ZP4QI97zCj9F0SDKqr3RpPBNpI9o1hqRoY8CTElKGPyyFa0GRs8c6H8Da1T GldtdOxjW0urqohtW4c2HeKyLnvi4GjB1fL8YgMibLGB+FwlKW5z3h3Hnu+3UqZMjI5l cQnPC2yvsGLQoJZTbs0aWjAn9Vub+k8CXIcBSQXutltJNFUNNwYYTvvzxTbNQ2v35SSd dgXlRzO4xYigQdMYoUBOdbU1yl6tzsLeuEThOJTd8Gn35tB3ui9CWBC6aF0rKpmPqsMQ Ib6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dbtZI3y2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ot7-20020a17090b3b4700b001c6f8b9aea5si4052960pjb.42.2022.05.17.10.03.39; Tue, 17 May 2022 10:03:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dbtZI3y2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350559AbiEQPgM (ORCPT + 99 others); Tue, 17 May 2022 11:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350219AbiEQPfU (ORCPT ); Tue, 17 May 2022 11:35:20 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CAD65007A; Tue, 17 May 2022 08:35:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652801712; x=1684337712; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OKRcLw6QsuGpSKY4/BO13xavP65NgCLYIODNZJ7MeM4=; b=dbtZI3y2Y3r1LRtyGe7F6r22+6KEO/uVKXb3/58OMsyr+2xKpq2fOt+V 4bZxkLl2gvxvRAw9oozwdrEDziQhlcQlsQyIED95MT4c1zNjeYldPEXxT PZDzBFBt6SI9FNDzM4xfHxmHdMcNPDI3iuCkNC4b78kfLCzWUW/5ptSRJ +CpeB2agYD6t+7LLlSV5jEF5r3VG+MtSfNLsToQFxQhrJ0Ofma0K1W1NU TIB8/SqaKr1TcNCX+eAGxPYuRNXbk3Lf43UEEiVxX+PO8/RqnN5p6m06m ebQbbAg87i+MfsYpYvh6V58k3ub5RqnVy4o2lzCZMgnxXvb4NQ8M73kJG Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10350"; a="270911635" X-IronPort-AV: E=Sophos;i="5.91,233,1647327600"; d="scan'208";a="270911635" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 */ -- 2.35.1