linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Minchan Kim <minchan@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	gregkh@linuxfoundation.org, surenb@google.com,
	joaodias@google.com, jhubbard@nvidia.com, willy@infradead.org
Subject: Re: [PATCH v4] mm: cma: support sysfs
Date: Fri, 5 Mar 2021 18:34:22 +0100	[thread overview]
Message-ID: <98637abc-3b64-5bbc-f270-55619e12dccd@redhat.com> (raw)
In-Reply-To: <20210304161704.3056806-1-minchan@kernel.org>

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



  reply	other threads:[~2021-03-05 17:34 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 16:17 [PATCH v4] mm: cma: support sysfs Minchan Kim
2021-03-05 17:34 ` David Hildenbrand [this message]
2021-03-05 20:34   ` Minchan Kim
2021-03-08 15:26 ` [mm] 9ddc8abf03: BUG:KASAN:null-ptr-deref_in_lockdep_init_map_type kernel test robot
2021-03-08 19:38   ` Minchan Kim
  -- strict thread matches above, loose matches on Subject: below --
2021-03-09  6:23 [PATCH v4] mm: cma: support sysfs Minchan Kim
2021-03-19 12:44 ` Dmitry Osipenko
2021-03-19 13:39   ` Dmitry Osipenko
2021-03-19 13:42     ` Greg Kroah-Hartman
2021-03-19 13:45       ` Dmitry Osipenko
2021-03-19 13:47         ` Greg Kroah-Hartman
2021-03-19 13:51           ` Dmitry Osipenko
2021-03-19 14:19             ` Dmitry Osipenko
2021-03-19 14:27               ` Greg Kroah-Hartman
2021-03-19 15:38                 ` Dmitry Osipenko
2021-03-19 15:50                   ` Greg Kroah-Hartman
2021-03-19 16:24                     ` Dmitry Osipenko
2021-03-19 16:30                       ` Minchan Kim
2021-03-19 17:29                         ` Dmitry Osipenko
2021-03-19 17:41                           ` Dmitry Osipenko
2021-03-19 17:44                             ` Dmitry Osipenko
2021-03-19 18:07                           ` Matthew Wilcox
2021-03-19 18:18                           ` Minchan Kim
2021-03-19 18:59                             ` Dmitry Osipenko
2021-03-19 19:00                             ` Dmitry Osipenko
2021-03-19 17:56                         ` Dmitry Osipenko
2021-03-19 18:21                           ` Minchan Kim
2021-03-19 18:48                             ` Dmitry Osipenko
2021-03-19 19:03                               ` Minchan Kim
2021-03-19 19:24                                 ` Dmitry Osipenko
2021-03-20  7:52                                   ` Greg Kroah-Hartman
2021-03-22 14:44                                     ` Dmitry Osipenko
2021-03-19 13:45     ` Dmitry Osipenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98637abc-3b64-5bbc-f270-55619e12dccd@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jhubbard@nvidia.com \
    --cc=joaodias@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=surenb@google.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).