From: John Hubbard <jhubbard@nvidia.com>
To: Pintu Agarwal <pintu.ping@gmail.com>, Minchan Kim <minchan@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
John Dias <joaodias@google.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>
Subject: Re: [PATCH] mm: cma: support sysfs
Date: Mon, 8 Feb 2021 00:39:47 -0800 [thread overview]
Message-ID: <06f8d7c5-ba77-363e-344a-8816c5017d3f@nvidia.com> (raw)
In-Reply-To: <CAOuPNLj9kKFFOS_56KkJ4w3jD51WOZ+d=nubcQQeihpk4B_-Ng@mail.gmail.com>
On 2/6/21 9:08 AM, Pintu Agarwal wrote:
...
>> # cat meminfo | grep -i cma
>> CmaTotal: 1048576 kB
>> CmaFree: 1046872 kB
>
> This CMA info was added by me way back in 2014.
> At that time I even thought about adding this cma alloc/fail counter in vmstat.
> That time I also had an internal patch about it but later dropped
> (never released to mainline).
> If required I can re-work again on this part.
>
> And I have few more points to add here.
> 1) In the past I have faced this cma allocation failure (which could
> be common in small embedded devices).
> Earlier it was even difficult to figure if cma failure actually happened.
> Thus I added this simple patch:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.11-rc6&id=5984af1082f3b115082178ed88c47033d43b924d
>
> 2) IMO just reporting CMA alloc/fail may not be enough (at times). The
> main point is for which client/dev is this failure happening ?
> Sometimes just tuning the size or fixing the alignment can resolve the
> failure if we know the client. For global CMA it will be just NULL
> (dev).
>
> 3) IMO having 2 options SYSFS and DEBUGFS may confuse the
> developer/user (personal experience). So are we going to remove the
> DEBUGFS or merge it ?
>
It is confusing to have a whole bunch of different places to find data
about a system. Here, I think the key is to add to the Documentation/
directory. So far, the documentation I see is:
admin-guide/mm/cma_debugfs.rst: only covers debugfs
admin-guide/kernel-parameters.txt:602: for CMA kernel parameters
If we add sysfs items then we will want a new .rst document that covers
that, and lists all the places to look.
So anyway, the underlying guidelines for which fs to user are approximately:
* sysfs: used for monitoring. One value per item, stable ABI, production.
* debugfs: *theoretically* not a stable ABI (we hope no one locks us in
by doing obnoxious things that break userspace if the debugfs APIs change).
The intention is that developers can put *anything* in there.
debugfs has a firm place in debugging, and is probably a keeper here.
I originally thought we should combine CMA's sysfs and debugfs items,
but Minchan listed an example that seems to show a pretty clear need
for monitoring of CMA areas, in production systems, and that's what
sysfs is for.
So it looks like we want both debugfs and sysfs for CMA, plus a new
overall CMA documentation that points to everything.
> 4) Sometimes CMA (or DMA) allocation failure can happen even very
> early in boot time itself. At that time these are anyways not useful.
> Some system may not proceed if CMA/DMA allocation is failing (again
> personal experience).
> ==> Anyways this is altogether is different case...
>
> 5) The default max CMA areas are defined to be 7 but user can
> configure it to any number, may be 20 or 50 (???)
>
> 6) Thus I would like to propose another thing here.
> Just like we have /proc/vmallocinfo, /proc/slabinfo, etc., we can also
> have: /proc/cmainfo
> Here in /proc/cmaminfo we can capute more detailed information:
> Global CMA Data: Alloc/Free
> Client specific data: name, size, success, fail, flags, align, etc
> (just a random example).
> ==> This can dynamically grow as large as possible
> ==> It can also be enabled/disabled based on CMA config itself (no
> additional config required)
>
> Any feedback on point (6) specifically ?
>
Well, /proc these days is for process-specific items. And CMA areas are
system-wide. So that's an argument against it. However...if there is any
process-specific CMA allocation info to report, then /proc is just the
right place for it.
thanks,
--
John Hubbard
NVIDIA
next prev parent reply other threads:[~2021-02-08 8:39 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-03 15:50 Minchan Kim
2021-02-04 8:50 ` John Hubbard
2021-02-04 20:07 ` Minchan Kim
2021-02-04 23:14 ` John Hubbard
2021-02-04 23:43 ` Suren Baghdasaryan
2021-02-04 23:45 ` Suren Baghdasaryan
2021-02-05 0:25 ` John Hubbard
2021-02-05 0:34 ` John Hubbard
2021-02-05 1:44 ` Suren Baghdasaryan
2021-02-05 0:12 ` Minchan Kim
2021-02-05 0:24 ` John Hubbard
2021-02-05 1:44 ` Minchan Kim
2021-02-05 2:39 ` Suren Baghdasaryan
2021-02-05 2:52 ` John Hubbard
2021-02-05 5:17 ` Minchan Kim
2021-02-05 5:49 ` John Hubbard
2021-02-05 6:24 ` Minchan Kim
2021-02-05 6:41 ` John Hubbard
2021-02-05 16:15 ` Minchan Kim
2021-02-05 20:25 ` John Hubbard
2021-02-05 21:28 ` Minchan Kim
2021-02-05 21:52 ` Suren Baghdasaryan
2021-02-05 21:58 ` John Hubbard
2021-02-05 22:47 ` Minchan Kim
2021-02-06 17:08 ` Pintu Agarwal
2021-02-08 8:39 ` John Hubbard [this message]
2021-02-05 21:57 ` John Hubbard
2021-02-05 2:55 ` Matthew Wilcox
2021-02-05 5:22 ` Minchan Kim
2021-02-05 12:12 ` Matthew Wilcox
2021-02-05 16:16 ` Minchan Kim
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=06f8d7c5-ba77-363e-344a-8816c5017d3f@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=joaodias@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=pintu.ping@gmail.com \
--cc=surenb@google.com \
/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