All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
To: David Rientjes <rientjes@google.com>
Cc: Christoph Lameter <cl@linux.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm/vmstat: retrieve more accurate vmstat value
Date: Thu, 28 Jan 2016 14:08:44 +0900	[thread overview]
Message-ID: <20160128050844.GD14467@js1304-P5Q-DELUXE> (raw)
In-Reply-To: <alpine.DEB.2.10.1601271507510.1248@chino.kir.corp.google.com>

On Wed, Jan 27, 2016 at 03:13:12PM -0800, David Rientjes wrote:
> On Thu, 26 Nov 2015, Joonsoo Kim wrote:
> 
> > I understand design decision, but, it is better to get value as much
> > as accurate if there is no performance problem. My patch would not
> > cause much performance degradation because it is just adding one
> > this_cpu_read().
> > 
> > Consider about following example. Current implementation returns
> > interesting output if someone do following things.
> > 
> > v1 = zone_page_state(XXX);
> > mod_zone_page_state(XXX, 1);
> > v2 = zone_page_state(XXX);
> > 
> > v2 would be same with v1 in most of cases even if we already update
> > it.
> > 
> > This situation could occurs in page allocation path and others. If
> > some task try to allocate many pages, then watermark check returns
> > same values until updating vmstat even if some freepage are allocated.
> > There are some adjustments for this imprecision but why not do it become
> > accurate? I think that this change is reasonable trade-off.
> > 
> 
> I'm not sure that NR_ISOLATED_* should be vmstats in the first place.  The 
> most important callers that depend on its accuracy is 
> zone_reclaimable_pages() and the too_many_isolated() loop in both 
> shrink_inactive_list() and memory compaction.  If zlc's are updated every 
> 1s, the HZ/10 in those loops don't really matter, they may as well be 
> HZ/2.
> 
> I think memory compaction updates the counters in the most appropriate 
> way, by incrementing a counter and then finally doing 
> mod_zone_page_state() for the counter.  The other updaters are thp 
> collapse and page migration.
> 
> I discount user-visible vmstats here because the trade-off has already 
> been made that they may be stale for up to 1s and userspace isn't 
> affected.
> 
> So what happens if we simply convert NR_ISOLATED_* into per-zone 
> atomic64_t?

Just a small uncomfortable thing is that calculation is done
with different kinds of metric. For example, comparing vmstat values
(NR_INACTIVE_*, NR_ACTIVE_*) with per-zone atomic NR_ISOLATED_*
looks ugly and error-prone because their accuracy is different.

Thanks.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
To: David Rientjes <rientjes@google.com>
Cc: Christoph Lameter <cl@linux.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm/vmstat: retrieve more accurate vmstat value
Date: Thu, 28 Jan 2016 14:08:44 +0900	[thread overview]
Message-ID: <20160128050844.GD14467@js1304-P5Q-DELUXE> (raw)
In-Reply-To: <alpine.DEB.2.10.1601271507510.1248@chino.kir.corp.google.com>

On Wed, Jan 27, 2016 at 03:13:12PM -0800, David Rientjes wrote:
> On Thu, 26 Nov 2015, Joonsoo Kim wrote:
> 
> > I understand design decision, but, it is better to get value as much
> > as accurate if there is no performance problem. My patch would not
> > cause much performance degradation because it is just adding one
> > this_cpu_read().
> > 
> > Consider about following example. Current implementation returns
> > interesting output if someone do following things.
> > 
> > v1 = zone_page_state(XXX);
> > mod_zone_page_state(XXX, 1);
> > v2 = zone_page_state(XXX);
> > 
> > v2 would be same with v1 in most of cases even if we already update
> > it.
> > 
> > This situation could occurs in page allocation path and others. If
> > some task try to allocate many pages, then watermark check returns
> > same values until updating vmstat even if some freepage are allocated.
> > There are some adjustments for this imprecision but why not do it become
> > accurate? I think that this change is reasonable trade-off.
> > 
> 
> I'm not sure that NR_ISOLATED_* should be vmstats in the first place.  The 
> most important callers that depend on its accuracy is 
> zone_reclaimable_pages() and the too_many_isolated() loop in both 
> shrink_inactive_list() and memory compaction.  If zlc's are updated every 
> 1s, the HZ/10 in those loops don't really matter, they may as well be 
> HZ/2.
> 
> I think memory compaction updates the counters in the most appropriate 
> way, by incrementing a counter and then finally doing 
> mod_zone_page_state() for the counter.  The other updaters are thp 
> collapse and page migration.
> 
> I discount user-visible vmstats here because the trade-off has already 
> been made that they may be stale for up to 1s and userspace isn't 
> affected.
> 
> So what happens if we simply convert NR_ISOLATED_* into per-zone 
> atomic64_t?

Just a small uncomfortable thing is that calculation is done
with different kinds of metric. For example, comparing vmstat values
(NR_INACTIVE_*, NR_ACTIVE_*) with per-zone atomic NR_ISOLATED_*
looks ugly and error-prone because their accuracy is different.

Thanks.

  reply	other threads:[~2016-01-28  5:08 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-24  6:22 [PATCH] mm/vmstat: retrieve more accurate vmstat value Joonsoo Kim
2015-11-24  6:22 ` Joonsoo Kim
2015-11-24 15:36 ` Christoph Lameter
2015-11-24 15:36   ` Christoph Lameter
2015-11-25  2:57   ` Joonsoo Kim
2015-11-25  2:57     ` Joonsoo Kim
2015-11-25 16:04     ` Christoph Lameter
2015-11-25 16:04       ` Christoph Lameter
2015-11-25 18:03       ` Michal Hocko
2015-11-25 18:03         ` Michal Hocko
2015-11-25 18:26         ` Christoph Lameter
2015-11-25 18:26           ` Christoph Lameter
2015-11-26  1:52       ` Joonsoo Kim
2015-11-26  1:52         ` Joonsoo Kim
2015-12-03  4:14         ` Joonsoo Kim
2015-12-03  4:14           ` Joonsoo Kim
2016-01-27 23:13         ` David Rientjes
2016-01-27 23:13           ` David Rientjes
2016-01-28  5:08           ` Joonsoo Kim [this message]
2016-01-28  5:08             ` Joonsoo Kim
2015-11-25 12:00 ` Michal Hocko
2015-11-25 12:00   ` Michal Hocko
2015-11-25 13:43   ` Vlastimil Babka
2015-11-25 13:43     ` Vlastimil Babka
2015-11-25 13:47     ` Michal Hocko
2015-11-25 13:47       ` Michal Hocko
2015-11-26  1:56   ` Joonsoo Kim
2015-11-26  1:56     ` Joonsoo Kim
2015-11-26  5:03     ` vinayak menon
2015-11-26  5:03       ` vinayak menon
2015-11-26 15:03     ` Michal Hocko
2015-11-26 15:03       ` Michal Hocko

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=20160128050844.GD14467@js1304-P5Q-DELUXE \
    --to=iamjoonsoo.kim@lge.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@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 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.