All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	gregkh@linuxfoundation.org, surenb@google.com,
	joaodias@google.com, jhubbard@nvidia.com, digetx@gmail.com
Subject: Re: [PATCH v5] mm: cma: support sysfs
Date: Tue, 23 Mar 2021 20:31:31 -0700	[thread overview]
Message-ID: <YFqyk0/yXs2kMP76@google.com> (raw)
In-Reply-To: <20210324030224.GO1719932@casper.infradead.org>

On Wed, Mar 24, 2021 at 03:02:24AM +0000, Matthew Wilcox wrote:
> On Tue, Mar 23, 2021 at 12:50:50PM -0700, Minchan Kim wrote:
> > +	/* the number of CMA page successful allocations */
> > +	atomic64_t nr_pages_succeeded;
> 
> > +void cma_sysfs_alloc_pages_count(struct cma *cma, size_t count)
> > +{
> > +	atomic64_add(count, &cma->nr_pages_succeeded);
> > +}
> 
> I don't understand.  A size_t is a byte count.  But the variable is called
> 'nr_pages'.  So which is it, a byte count or a page count?

It's page count. I followed the cma_alloc interface since it has
size_t count variable for nr_pages.

Let's go with unsigned long nr_pages:
void cma_sysfs_alloc_pages_count(struct cma *cma, unsigned long
nr_pages)

> 
> > +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));
> 
> ... if it's in bytes, it should probably be reported in kilobytes
> and be suffixed with a 'K' like many other stats.
> 

  reply	other threads:[~2021-03-24  3:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 19:50 [PATCH v5] mm: cma: support sysfs Minchan Kim
2021-03-23 21:19 ` Dmitry Osipenko
2021-03-23 21:29   ` Dmitry Osipenko
2021-03-23 21:44 ` Dmitry Osipenko
2021-03-24  0:54   ` Minchan Kim
2021-03-24  3:02 ` Matthew Wilcox
2021-03-24  3:31   ` Minchan Kim [this message]
2021-03-24  4:34     ` Matthew Wilcox
2021-03-24  5:45       ` 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=YFqyk0/yXs2kMP76@google.com \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=digetx@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jhubbard@nvidia.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.