From: Gerald Schaefer <gerald.schaefer@de.ibm.com>
To: util-linux@vger.kernel.org
Cc: wild@linux.vnet.ibm.com, alkl@linux.vnet.ibm.com
Subject: Re: [PATCH] lsmem: fix total online/offline memory calculation
Date: Tue, 20 Mar 2018 18:47:43 +0100 [thread overview]
Message-ID: <20180320184743.09c3375a@thinkpad> (raw)
In-Reply-To: <20180320161738.49439-1-gerald.schaefer@de.ibm.com>
On Tue, 20 Mar 2018 17:17:38 +0100
Gerald Schaefer <gerald.schaefer@de.ibm.com> wrote:
> lsmem currently calculates the total online/offline memory by iterating
> over all lsmem->blocks. Depending on the lsmem options, there may be
> only one lsmem->block, because all sysfs memory blocks could be merged
> into one. In this case, the calculation is wrong, because the individual
> online/offline state of the sysfs memory blocks is not preserved, but
> rather lsmem->blocks[0].state is set to the state of the first sysfs
> memory block, typically MEMORY_STATE_ONLINE (at least on s390).
>
> This means that "Total offline memory" will always be calculated as 0
> in such cases, e.g. when using "lsmem --summary", or any options that
> would merge the table output to one line, like "lsmem -o RANGE":
>
> ~# lsmem --summary
> Memory block size: 1G
> Total online memory: 20G
> Total offline memory: 0B
>
> Adding the "-a" option shows the real summary, since there is no block
> merging going on, and the calculation is therefore correct:
>
> ~# lsmem -a --summary
> Memory block size: 1G
> Total online memory: 16G
> Total offline memory: 4G
>
> Fix this by moving the online/offline calculation into the loop that
> is iterating over all sysfs memory blocks, instead of iterating over
> potentially merged lsmem->blocks.
>
> Reported-by: Andre Wild <wild@linux.vnet.ibm.com>
Sorry, I mixed that up, this bug was
Reported-by: Alexander Klein <alkl@linux.vnet.ibm.com>
next prev parent reply other threads:[~2018-03-20 17:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-20 16:17 [PATCH] lsmem: fix total online/offline memory calculation Gerald Schaefer
2018-03-20 17:47 ` Gerald Schaefer [this message]
2018-03-20 17:57 ` Karel Zak
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=20180320184743.09c3375a@thinkpad \
--to=gerald.schaefer@de.ibm.com \
--cc=alkl@linux.vnet.ibm.com \
--cc=util-linux@vger.kernel.org \
--cc=wild@linux.vnet.ibm.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 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.