Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1521363pxb; Thu, 4 Feb 2021 15:33:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJy2UMgQapuQSEKpAeJ6auBiMlrBdyQJKvUrFFeWtmn0m9n2TLorXd9OAE7aqylZmXTIWh+M X-Received: by 2002:a17:906:af6b:: with SMTP id os11mr1408187ejb.472.1612481635052; Thu, 04 Feb 2021 15:33:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612481635; cv=none; d=google.com; s=arc-20160816; b=YnfnM1E+UG9tjsnFPS7wDIufEg79X/9jX39KN/c+76RRH7JUaSHi0CrJvJXKdnkLcX 2Cg3ppa8YCG0Auqd5Nob8aGOdRtTYlyCDPH5XzSADgflq22J8TjJVXkh8qNXqJg0UQJ6 uhyi8vo82cN8zSNE3OIhpLRwtU2gYUVxcRfo8Z1AvWUFBxFWQMwwPEt7qpmUGQeySnHt K5Iwq0BMTs0HcOwczNtqWqEUtlyFhWIYRTGeHNFHf8C+ACM0Y7Yw0hgQsTHY5rCG9xIf H1ifMfeIlqakxD32GuiDFZJXD0bWB+Y+h0Aoq1OG8hqpS8+X8QsvJX6XsPBHk0VVCTLU +woQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Snwt9NrcbI2KHKMG8oc1z+F40/Bsst2a9cRRDYfL5lM=; b=0DzbePOWBqUzdk9nxxezKvuVqddSULa8pTHD33gaocsDU/3gNFlAfgOMqZRo0C7cTb NWwvicrg59pXcSt/i2p3PSioma6BrGuwJ3wWa7t1jwX7OLiW7uvnjF8mnMJE5eo5THIY vWLWDqyWMCdCaYJdjFslgCyX3fgQ9+uCmCEZ2drCtGBrqr6xlIVQ7a2jGlUzT8bDDXuE yqlJrFUp8aVnO8xr7CgoShDH7laP+YyJkBMe41QG2J8iYBcn8Zx8hOJjX098YgA77ujx uN0+GNxCBIXYBfflkKKn6N5fnGCivvtRMVhineP0HAstNFcZ8ur0I07pN5RQX/LSvCjv op3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=cQZjXp8C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ca23si4472298edb.448.2021.02.04.15.33.31; Thu, 04 Feb 2021 15:33:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=cQZjXp8C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235095AbhBDIvn (ORCPT + 99 others); Thu, 4 Feb 2021 03:51:43 -0500 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:19579 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234966AbhBDIvl (ORCPT ); Thu, 4 Feb 2021 03:51:41 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Thu, 04 Feb 2021 00:50:59 -0800 Received: from [10.2.50.90] (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 4 Feb 2021 08:50:58 +0000 Subject: Re: [PATCH] mm: cma: support sysfs To: Minchan Kim , Andrew Morton CC: , , , LKML , linux-mm References: <20210203155001.4121868-1-minchan@kernel.org> From: John Hubbard Message-ID: <7e7c01a7-27fe-00a3-f67f-8bcf9ef3eae9@nvidia.com> Date: Thu, 4 Feb 2021 00:50:58 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:85.0) Gecko/20100101 Thunderbird/85.0 MIME-Version: 1.0 In-Reply-To: <20210203155001.4121868-1-minchan@kernel.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1612428659; bh=Snwt9NrcbI2KHKMG8oc1z+F40/Bsst2a9cRRDYfL5lM=; h=Subject:To:CC:References:From:Message-ID:Date:User-Agent: MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding:X-Originating-IP:X-ClientProxiedBy; b=cQZjXp8CboxruJI1hhMlYdyq+rfZrhisOx1M5P1pKIhSHL0tAMS+SY60Kcg5M5Q+U 5cBvmBhu5MogZHtOVEKk/X94s2AmRnpgxfNe2S8oitjlrktIy1In1Ye7HrOo2LFpd3 eK1x1NPcDaBShmABV9Pzc+gNbV8/5Te6x9YufPpOx4OgDRE8DDcCSrqvI9+bdbhkpl /tRkR29n4QXoUeMyLFA5HsBRHD56tVn4ys74iRwP2MkkZgzOR8S5i3C1J/FqaS+5Fq kVg7kMpVQo86kIs8FxLlrgKr9rhFTr8nNaGtFS0rHwNawaLq/bFKe/ulpTQi9HYSxR epZ4XSHohq6Jw== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/3/21 7:50 AM, Minchan Kim wrote: > Since CMA is getting used more widely, it's more important to > keep monitoring CMA statistics for system health since it's > directly related to user experience. > > This patch introduces sysfs for the CMA and exposes stats below > to keep monitor for telemetric in the system. > > * the number of CMA allocation attempts > * the number of CMA allocation failures > * the number of CMA page allocation attempts > * the number of CMA page allocation failures The desire to report CMA data is understandable, but there are a few odd things here: 1) First of all, this has significant overlap with /sys/kernel/debug/cma items. I suspect that all of these items could instead go into /sys/kernel/debug/cma, right? 2) The overall CMA allocation attempts/failures (first two items above) seem an odd pair of things to track. Maybe that is what was easy to track, but I'd vote for just omitting them. > > Signed-off-by: Minchan Kim > --- > Documentation/ABI/testing/sysfs-kernel-mm-cma | 39 +++++ > include/linux/cma.h | 1 + > mm/Makefile | 1 + > mm/cma.c | 6 +- > mm/cma.h | 20 +++ > mm/cma_sysfs.c | 143 ++++++++++++++++++ > 6 files changed, 209 insertions(+), 1 deletion(-) > create mode 100644 Documentation/ABI/testing/sysfs-kernel-mm-cma > create mode 100644 mm/cma_sysfs.c > > diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-cma b/Documentation/ABI/testing/sysfs-kernel-mm-cma > new file mode 100644 > index 000000000000..2a43c0aacc39 > --- /dev/null > +++ b/Documentation/ABI/testing/sysfs-kernel-mm-cma > @@ -0,0 +1,39 @@ > +What: /sys/kernel/mm/cma/ > +Date: Feb 2021 > +Contact: Minchan Kim > +Description: > + /sys/kernel/mm/cma/ contains a number of subdirectories by > + cma-heap name. The subdirectory contains a number of files > + to represent cma allocation statistics. Somewhere, maybe here, there should be a mention of the closely related /sys/kernel/debug/cma files. > + > + There are number of files under > + /sys/kernel/mm/cma/ directory > + > + - cma_alloc_attempt > + - cma_alloc_fail Are these really useful? They a summary of the alloc_pages items, really. > + - alloc_pages_attempt > + - alloc_pages_fail This should also have "cma" in the name, really: cma_alloc_pages_*. > + > +What: /sys/kernel/mm/cma//cma_alloc_attempt > +Date: Feb 2021 > +Contact: Minchan Kim > +Description: > + the number of cma_alloc API attempted > + > +What: /sys/kernel/mm/cma//cma_alloc_fail > +Date: Feb 2021 > +Contact: Minchan Kim > +Description: > + the number of CMA_alloc API failed > + > +What: /sys/kernel/mm/cma//alloc_pages_attempt > +Date: Feb 2021 > +Contact: Minchan Kim > +Description: > + the number of pages CMA API tried to allocate > + > +What: /sys/kernel/mm/cma//alloc_pages_fail > +Date: Feb 2021 > +Contact: Minchan Kim > +Description: > + the number of pages CMA API failed to allocate > diff --git a/include/linux/cma.h b/include/linux/cma.h > index 217999c8a762..71a28a5bb54e 100644 > --- a/include/linux/cma.h > +++ b/include/linux/cma.h > @@ -49,4 +49,5 @@ extern struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align, > extern bool cma_release(struct cma *cma, const struct page *pages, unsigned int count); > > extern int cma_for_each_area(int (*it)(struct cma *cma, void *data), void *data); > + A single additional blank line seems to be the only change to this file. :) thanks, -- John Hubbard NVIDIA