From: Minchan Kim <minchan@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
gregkh@linuxfoundation.org, surenb@google.com,
joaodias@google.com, LKML <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>
Subject: Re: [PATCH] mm: cma: support sysfs
Date: Thu, 4 Feb 2021 21:22:18 -0800 [thread overview]
Message-ID: <YBzWCl0MVNWntyUZ@google.com> (raw)
In-Reply-To: <20210205025526.GG308988@casper.infradead.org>
On Fri, Feb 05, 2021 at 02:55:26AM +0000, Matthew Wilcox wrote:
> On Wed, Feb 03, 2021 at 07:50:01AM -0800, Minchan Kim wrote:
> > +++ b/mm/Makefile
> > @@ -106,6 +106,7 @@ obj-$(CONFIG_ZSMALLOC) += zsmalloc.o
> > obj-$(CONFIG_Z3FOLD) += z3fold.o
> > obj-$(CONFIG_GENERIC_EARLY_IOREMAP) += early_ioremap.o
> > obj-$(CONFIG_CMA) += cma.o
> > +obj-$(CONFIG_SYSFS) += cma_sysfs.o
>
> ehh ... if we have a kernel build with CMA=n, SYSFS=y, we'll get
> cma_sysfs built in with no cma to report on.
OMG. Let me fix it.
>
> > +static ssize_t cma_alloc_attempt_show(struct kobject *kobj,
> > + struct kobj_attribute *attr, char *buf)
> > +{
> > + unsigned long val;
> > + struct cma_stat *stat = container_of(kobj, struct cma_stat, kobj);
> > +
> > + val = stat->alloc_attempt;
> > +
> > + return sysfs_emit(buf, "%lu\n", val);
>
> Why not more simply:
>
> {
> struct cma_stat *stat = container_of(kobj, struct cma_stat, kobj);
> return sysfs_emit(buf, "%lu\n", stat->alloc_attempt);
It's a legacy when I used the lock there but removed finally.
Will follow your suggestion.
> }
>
> > + for (i = 0; i < cma_area_count; i++) {
> > + cma = &cma_areas[i];
> > + stat = kzalloc(sizeof(*stat), GFP_KERNEL);
> > + if (!stat)
> > + goto out;
>
> How many cma areas are there going to be? do we really want to allocate
> their stat individually?
I am not sure what could be in the end but at least, I have
5+ candidates (but could be shrink or extend) and yes,
want to keep track them individually.
next prev parent reply other threads:[~2021-02-05 5:23 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-03 15:50 [PATCH] mm: cma: support sysfs 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
2021-02-05 21:57 ` John Hubbard
2021-02-05 2:55 ` Matthew Wilcox
2021-02-05 5:22 ` Minchan Kim [this message]
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=YBzWCl0MVNWntyUZ@google.com \
--to=minchan@kernel.org \
--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=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).