From: Dmitry Osipenko <digetx@gmail.com>
To: Minchan Kim <minchan@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
joaodias@google.com, willy@infradead.org, david@redhat.com,
surenb@google.com, John Hubbard <jhubbard@nvidia.com>,
Nicolas Chauvet <kwizart@gmail.com>,
"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>
Subject: Re: [PATCH v4] mm: cma: support sysfs
Date: Fri, 19 Mar 2021 21:59:08 +0300 [thread overview]
Message-ID: <6bc141d2-ca07-7f03-c306-683f0f630605@gmail.com> (raw)
In-Reply-To: <YFTq/nhQaeNSWPWs@google.com>
19.03.2021 21:18, Minchan Kim пишет:
>>> + if (ZERO_OR_NULL_PTR(cma_kobjs))
>>> + goto out;
>>> +
>>> + do {
>>> + cma = &cma_areas[i];
>>> + cma->kobj = &cma_kobjs[i];
>> Does cma really need are pointer to cma_kobj?
> Do you mean something like this?
>
> struct cma {
> ..
> ..
> struct kobject *kobj;
> };
>
> Then, how could we we make kobject dynamic model?
>
> We need to get struct cma from kboj like below.
>
> static ssize_t alloc_pages_success_show(struct kobject *kobj,
> struct kobj_attribute *attr, char *buf)
> {
> struct cma_kobject *cma_kobj = container_of(kobj,
> struct cma_kobject, kobj);
> struct cma *cma = cma_kobj->cma;
>
> return sysfs_emit(buf, "%llu\n",
> atomic64_read(&cma->nr_pages_succeeded));
> }
>
> So kobj should be not a pointer in the container struct.
> Am I missing your point? Otherwise, it would be great if you suggest
> better idea.
I meant that cma_kobj->cma is okay, but cma->kobj wasn't really used
anywhere since struct cma can't be released. I.e. we could write
kobject_put(&cma->kobj->kobj) as kobject_put(&cma_kobjs[i].kobj);
But since we won't use the array anymore and maybe will get back to use
the cma_stat, then it will be fine to add the pointer.
next prev parent reply other threads:[~2021-03-19 19:00 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
-- strict thread matches above, loose matches on Subject: below --
2021-03-04 16:17 Minchan Kim
2021-03-05 17:34 ` David Hildenbrand
2021-03-05 20:34 ` 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=6bc141d2-ca07-7f03-c306-683f0f630605@gmail.com \
--to=digetx@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=jhubbard@nvidia.com \
--cc=joaodias@google.com \
--cc=kwizart@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-tegra@vger.kernel.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).