Re: [patch 6/6] mm: memcg: print statistics from live counters

From: Andrew Morton
Date: Wed May 16 2012 - 19:01:46 EST


On Mon, 14 May 2012 20:00:51 +0200
Johannes Weiner <hannes@xxxxxxxxxxx> wrote:

> Directly print statistics and event counters instead of going through
> an intermediate accumulation stage into a separate array, which used
> to require defining statistic items in more than one place.
>
> ...
>
> -static const char *memcg_stat_strings[NR_MCS_STAT] = {
> - "cache",
> - "rss",
> - "mapped_file",

Bah humbug, who went and called this mapped_file?

This stat is derived from MEM_CGROUP_STAT_FILE_MAPPED. But if we
rename MEM_CGROUP_STAT_FILE_MAPPED to MEM_CGROUP_STAT_MAPPED_FILE then
we also need to rename the non-memcg NR_FILE_MAPPED. And we can't
change the text to "file_mapped" because it's ABI.

> - "mlock",
> - "swap",

And "swap" is derived from MEM_CGROUP_STAT_SWAPOUT. We could rename
that to MEM_CGROUP_STAT_SWAP without trouble.

But both are poor names. There are two concepts here: a) swapout
events (ie: swap writeout initiation) and b) swapspace usage. Type a)
only ever counts up, whereas type b) counts up and down.

MEM_CGROUP_STAT_SWAPOUT is actually of type b), but "swapout" is a
misleading term, because it refers to type a) events.

And the human-displayed "swap" is useless because it can refer to
either type a) or type b) events. These should be called "swapped" and
MEM_CGROUP_STAT_SWAPPED. But we can't change the userspace interface.

argh, I hate you all!

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/