lkml.org 
[lkml]   [2021]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4] mm: cma: support sysfs
From
Date
On 04.03.21 17:17, 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 statistics for CMA, in order to provide
> some basic monitoring of the CMA allocator.
>
> * the number of CMA page allocation attempts
> * the number of CMA page allocation failures
>
> These two values allow the user to calcuate the allocation
> failure rate for each CMA area.
>
> e.g.)
> /sys/kernel/mm/cma/WIFI/cma_alloc_pages_[attempts|fails]
> /sys/kernel/mm/cma/SENSOR/cma_alloc_pages_[attempts|fails]
> /sys/kernel/mm/cma/BLUETOOTH/cma_alloc_pages_[attempts|fails]
>
> The cma_stat was intentionally allocated by dynamic allocation
> to harmonize with kobject lifetime management.
> https://lore.kernel.org/linux-mm/YCOAmXqt6dZkCQYs@kroah.com/
>
> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Reviewed-by: John Hubbard <jhubbard@nvidia.com>
> Signed-off-by: Minchan Kim <minchan@kernel.org>
> ---
> From v3 - https://lore.kernel.org/linux-mm/20210303205053.2906924-1-minchan@kernel.org/
> * kmalloc_array - akpm
> * add why cma_stat was implemented by dynamic allocation - akpm
> * use !__GFP_NOWARN facility to print error - akpm
>
> From v2 - https://lore.kernel.org/linux-mm/20210208180142.2765456-1-minchan@kernel.org/
> * sysfs doc and description modification - jhubbard
>
> From v1 - https://lore.kernel.org/linux-mm/20210203155001.4121868-1-minchan@kernel.org/
> * fix sysfs build and refactoring - willy
> * rename and drop some attributes - jhubbard
>
> Documentation/ABI/testing/sysfs-kernel-mm-cma | 25 ++++
> mm/Kconfig | 7 ++
> mm/Makefile | 1 +
> mm/cma.c | 6 +-
> mm/cma.h | 18 +++
> mm/cma_sysfs.c | 110 ++++++++++++++++++
> 6 files changed, 166 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..f518af819cee
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-kernel-mm-cma
> @@ -0,0 +1,25 @@
> +What: /sys/kernel/mm/cma/
> +Date: Feb 2021
> +Contact: Minchan Kim <minchan@kernel.org>
> +Description:
> + /sys/kernel/mm/cma/ contains a subdirectory for each CMA
> + heap name (also sometimes called CMA areas).
> +
> + Each CMA heap subdirectory (that is, each
> + /sys/kernel/mm/cma/<cma-heap-name> directory) contains the
> + following items:
> +
> + cma_alloc_pages_attempts
> + cma_alloc_pages_fails

Nit: why "cma_" again when we are already under "/cma/" ?

I'd simply go with something like

"total_alloc_attempts"
"failed_alloc_attempts"

But maybe this has been discussed already.

> +
> +What: /sys/kernel/mm/cma/<cma-heap-name>/cma_alloc_pages_attempts
> +Date: Feb 2021
> +Contact: Minchan Kim <minchan@kernel.org>
> +Description:
> + the number of pages CMA API tried to allocate
> +
> +What: /sys/kernel/mm/cma/<cma-heap-name>/cma_alloc_pages_fails
> +Date: Feb 2021
> +Contact: Minchan Kim <minchan@kernel.org>
> +Description:
> + the number of pages CMA API failed to allocate

This will be useful.

--
Thanks,

David / dhildenb

\
 
 \ /
  Last update: 2021-03-05 18:35    [W:0.207 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site