Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1756095rdb; Sun, 19 Nov 2023 08:58:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfqbOuVdAQDaoU29pwZEp31BkXMXTPgD1nzNcc1qxLYph717zMSkhANvBKn1ATVFcGV2++ X-Received: by 2002:a17:903:22d1:b0:1cf:5886:5cef with SMTP id y17-20020a17090322d100b001cf58865cefmr1264242plg.18.1700413096453; Sun, 19 Nov 2023 08:58:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700413096; cv=none; d=google.com; s=arc-20160816; b=VyUbW9ng2si9psgi8j6583zGZTCKljMDpKpY/Q75h7Q/WJqVOe4ia+d3+zJDHE0Fiy J5qKgxuaFnYgORvgoAigUiu7fUO5u6DKerexkWNO3mvuP+aJRIFgeqnM5DtnAy25xN2e aAaXHaTGuAH0LCCaEn4a5JLh7lBZmK0iFocvQcB1JnDwjeZKPWa4I7+uT3ldRRyn7ZY7 e4Hep6R948As6UVM+qVkTWorvhpNFdRSRmq/25dcABCmDU6wgnlRhj8y4hVkZbT0y6Kp E7zq0Pe04ZZFcMxZkcK6b4Y/pysZgfSCIC6aHX3SpjfJfbhj1U0ItSHaPbPzAasZI3OB OZng== 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; bh=Nu1C9ygwwMvVsyLo5ztWMy+fuX9RO6F4Z4TBbVvZd0o=; fh=ON0oQ90Z4xnjbNCGsyMgiRbLR29nyOKvbeaw6TmRihk=; b=IUylsFHAfkp+j/KrgTfN6VqCLx5uIh/q30D90wZZD3S6vWO88IwY4L91vKr/g3STi/ 4YDMofFURxB7jWt7ru91SLPTsrI+g7JH26ToDdmzC+At906Sbh4SzbLpjPwXLgQNaGAI eHoYkiJPsEfCix8yxUs9bV5fwO1gSNwre6Jr70ftL1NMKQNJ1o+GksyiOK4YUpS7f0Em gAioPG1n+XPsL/eV4MMxz2xIf+auCzy6RQMXaQXhawQkmBkfkVZXEUY7MGj3IW7uX4t4 P9Va2l6BD1gjZh1n4aT4N8/jC5+3n1ihH8TYCsoonD+8U3lgg8kilcPWlDqww4luAjFc qnmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id d6-20020a170902cec600b001cf547786efsi3084166plg.102.2023.11.19.08.58.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 08:58:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A8089805A8A1; Sun, 19 Nov 2023 08:58:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231450AbjKSQ6A (ORCPT + 99 others); Sun, 19 Nov 2023 11:58:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231512AbjKSQ57 (ORCPT ); Sun, 19 Nov 2023 11:57:59 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 99B28138; Sun, 19 Nov 2023 08:57:55 -0800 (PST) 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 936051476; Sun, 19 Nov 2023 08:58:41 -0800 (PST) Received: from e121798.cable.virginm.net (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 64E5A3F6C4; Sun, 19 Nov 2023 08:57:50 -0800 (PST) From: Alexandru Elisei To: catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, maz@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, arnd@arndb.de, akpm@linux-foundation.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, mhiramat@kernel.org, rppt@kernel.org, hughd@google.com Cc: pcc@google.com, steven.price@arm.com, anshuman.khandual@arm.com, vincenzo.frascino@arm.com, david@redhat.com, eugenis@google.com, kcc@google.com, hyesoo.yu@samsung.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH RFC v2 03/27] mm: cma: Make CMA_ALLOC_SUCCESS/FAIL count the number of pages Date: Sun, 19 Nov 2023 16:56:57 +0000 Message-Id: <20231119165721.9849-4-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231119165721.9849-1-alexandru.elisei@arm.com> References: <20231119165721.9849-1-alexandru.elisei@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 19 Nov 2023 08:58:14 -0800 (PST) The CMA_ALLOC_SUCCESS, respectively CMA_ALLOC_FAIL, are increased by one after each cma_alloc() function call. This is done even though cma_alloc() can allocate an arbitrary number of CMA pages. When looking at /proc/vmstat, the number of successful (or failed) cma_alloc() calls doesn't tell much with regards to how many CMA pages were allocated via cma_alloc() versus via the page allocator (regular allocation request or PCP lists refill). This can also be rather confusing to a user who isn't familiar with the code, since the unit of measurement for nr_free_cma is the number of pages, but cma_alloc_success and cma_alloc_fail count the number of cma_alloc() function calls. Let's make this consistent, and arguably more useful, by having CMA_ALLOC_SUCCESS count the number of successfully allocated CMA pages, and CMA_ALLOC_FAIL count the number of pages cma_alloc() failed to allocate. For users that wish to track the number of cma_alloc() calls, there are tracepoints for that already implemented. Signed-off-by: Alexandru Elisei --- mm/cma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/cma.c b/mm/cma.c index 2b2494fd6b59..2b74db5116d5 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -517,10 +517,10 @@ struct page *cma_alloc(struct cma *cma, unsigned long count, pr_debug("%s(): returned %p\n", __func__, page); out: if (page) { - count_vm_event(CMA_ALLOC_SUCCESS); + count_vm_events(CMA_ALLOC_SUCCESS, count); cma_sysfs_account_success_pages(cma, count); } else { - count_vm_event(CMA_ALLOC_FAIL); + count_vm_events(CMA_ALLOC_FAIL, count); if (cma) cma_sysfs_account_fail_pages(cma, count); } -- 2.42.1