linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Minchan Kim <minchan@kernel.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: Wed, 24 Mar 2021 03:02:24 +0000	[thread overview]
Message-ID: <20210324030224.GO1719932@casper.infradead.org> (raw)
In-Reply-To: <20210323195050.2577017-1-minchan@kernel.org>

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?

> +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.



  parent reply	other threads:[~2021-03-24  3:03 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 [this message]
2021-03-24  3:31   ` Minchan Kim
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=20210324030224.GO1719932@casper.infradead.org \
    --to=willy@infradead.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=minchan@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).