From: Andrew Morton <akpm@linux-foundation.org>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: balbir@linux.vnet.ibm.com, dave@linux.vnet.ibm.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
ebmunson@us.ibm.com, mel@linux.vnet.ibm.com,
cl@linux-foundation.org, stable@kernel.org
Subject: Re: meminfo Committed_AS underflows
Date: Mon, 27 Apr 2009 20:27:07 -0700 [thread overview]
Message-ID: <20090427202707.9d36ce8a.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090428092400.EBB6.A69D9226@jp.fujitsu.com>
On Tue, 28 Apr 2009 12:07:59 +0900 (JST) KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
> > On Wed, 15 Apr 2009 14:17:13 +0530
> > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> >
> > > * KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> [2009-04-15 13:10:06]:
> > >
> > > > > * KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> [2009-04-15 11:04:59]:
> > > > >
> > > > > > committed = atomic_long_read(&vm_committed_space);
> > > > > > + if (committed < 0)
> > > > > > + committed = 0;
> > > > >
> >
> > Is there a reason why we can't use a boring old percpu_counter for
> > vm_committed_space? That way the meminfo code can just use
> > percpu_counter_read_positive().
> >
> > Or perhaps just percpu_counter_read(). The percpu_counter code does a
> > better job of handling large cpu counts than the
> > mysteriously-duplicative open-coded stuff we have there.
>
> At that time, I thought smallest patch is better because it can send -stable
> tree easily.
> but maybe I was wrong. it made bikeshed discussion :(
Yes, I know what you mean. But otoh it's a good idea to keep -stable
in sync with mainline - it means that -stable can merge things which
have had a suitable amount of testing.
> ok, I'm going to right way.
>
>
> =========================================
> Subject: [PATCH] fix Committed_AS underfolow on large NR_CPUS environment
>
> As reported by Dave Hansen, the Committed_AS field can underflow in certain
> situations:
>
> > # while true; do cat /proc/meminfo | grep _AS; sleep 1; done | uniq -c
> > 1 Committed_AS: 18446744073709323392 kB
> > 11 Committed_AS: 18446744073709455488 kB
> > 6 Committed_AS: 35136 kB
> > 5 Committed_AS: 18446744073709454400 kB
> > 7 Committed_AS: 35904 kB
> > 3 Committed_AS: 18446744073709453248 kB
> > 2 Committed_AS: 34752 kB
> > 9 Committed_AS: 18446744073709453248 kB
> > 8 Committed_AS: 34752 kB
> > 3 Committed_AS: 18446744073709320960 kB
> > 7 Committed_AS: 18446744073709454080 kB
> > 3 Committed_AS: 18446744073709320960 kB
> > 5 Committed_AS: 18446744073709454080 kB
> > 6 Committed_AS: 18446744073709320960 kB
>
> Because NR_CPUS can be greater than 1000 and meminfo_proc_show() does not check
> for underflow.
>
> But NR_CPUS proportional isn't good calculation. In general, possibility of
> lock contention is proportional to the number of online cpus, not theorical
> maximum cpus (NR_CPUS).
> the current kernel has generic percpu-counter stuff. using it is right way.
> it makes code simplify and percpu_counter_read_positive() don't make underflow issue.
>
>
> Reported-by: Dave Hansen <dave@linux.vnet.ibm.com>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> Cc: Eric B Munson <ebmunson@us.ibm.com>
> ---
> fs/proc/meminfo.c | 2 +-
> include/linux/mman.h | 9 +++------
> mm/mmap.c | 12 ++++++------
> mm/nommu.c | 13 +++++++------
> mm/swap.c | 46 ----------------------------------------------
> 5 files changed, 17 insertions(+), 65 deletions(-)
Well that was nice.
There's potential here for weird performance regressions, so I think
that if we do this in mainline, we should wait a while (a few weeks?)
before backporting it.
Do we know how long this bug has existed for? Quite a while, I expect?
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: balbir@linux.vnet.ibm.com, dave@linux.vnet.ibm.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
ebmunson@us.ibm.com, mel@linux.vnet.ibm.com,
cl@linux-foundation.org, stable@kernel.org
Subject: Re: meminfo Committed_AS underflows
Date: Mon, 27 Apr 2009 20:27:07 -0700 [thread overview]
Message-ID: <20090427202707.9d36ce8a.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090428092400.EBB6.A69D9226@jp.fujitsu.com>
On Tue, 28 Apr 2009 12:07:59 +0900 (JST) KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
> > On Wed, 15 Apr 2009 14:17:13 +0530
> > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> >
> > > * KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> [2009-04-15 13:10:06]:
> > >
> > > > > * KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> [2009-04-15 11:04:59]:
> > > > >
> > > > > > committed = atomic_long_read(&vm_committed_space);
> > > > > > + if (committed < 0)
> > > > > > + committed = 0;
> > > > >
> >
> > Is there a reason why we can't use a boring old percpu_counter for
> > vm_committed_space? That way the meminfo code can just use
> > percpu_counter_read_positive().
> >
> > Or perhaps just percpu_counter_read(). The percpu_counter code does a
> > better job of handling large cpu counts than the
> > mysteriously-duplicative open-coded stuff we have there.
>
> At that time, I thought smallest patch is better because it can send -stable
> tree easily.
> but maybe I was wrong. it made bikeshed discussion :(
Yes, I know what you mean. But otoh it's a good idea to keep -stable
in sync with mainline - it means that -stable can merge things which
have had a suitable amount of testing.
> ok, I'm going to right way.
>
>
> =========================================
> Subject: [PATCH] fix Committed_AS underfolow on large NR_CPUS environment
>
> As reported by Dave Hansen, the Committed_AS field can underflow in certain
> situations:
>
> > # while true; do cat /proc/meminfo | grep _AS; sleep 1; done | uniq -c
> > 1 Committed_AS: 18446744073709323392 kB
> > 11 Committed_AS: 18446744073709455488 kB
> > 6 Committed_AS: 35136 kB
> > 5 Committed_AS: 18446744073709454400 kB
> > 7 Committed_AS: 35904 kB
> > 3 Committed_AS: 18446744073709453248 kB
> > 2 Committed_AS: 34752 kB
> > 9 Committed_AS: 18446744073709453248 kB
> > 8 Committed_AS: 34752 kB
> > 3 Committed_AS: 18446744073709320960 kB
> > 7 Committed_AS: 18446744073709454080 kB
> > 3 Committed_AS: 18446744073709320960 kB
> > 5 Committed_AS: 18446744073709454080 kB
> > 6 Committed_AS: 18446744073709320960 kB
>
> Because NR_CPUS can be greater than 1000 and meminfo_proc_show() does not check
> for underflow.
>
> But NR_CPUS proportional isn't good calculation. In general, possibility of
> lock contention is proportional to the number of online cpus, not theorical
> maximum cpus (NR_CPUS).
> the current kernel has generic percpu-counter stuff. using it is right way.
> it makes code simplify and percpu_counter_read_positive() don't make underflow issue.
>
>
> Reported-by: Dave Hansen <dave@linux.vnet.ibm.com>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> Cc: Eric B Munson <ebmunson@us.ibm.com>
> ---
> fs/proc/meminfo.c | 2 +-
> include/linux/mman.h | 9 +++------
> mm/mmap.c | 12 ++++++------
> mm/nommu.c | 13 +++++++------
> mm/swap.c | 46 ----------------------------------------------
> 5 files changed, 17 insertions(+), 65 deletions(-)
Well that was nice.
There's potential here for weird performance regressions, so I think
that if we do this in mainline, we should wait a while (a few weeks?)
before backporting it.
Do we know how long this bug has existed for? Quite a while, I expect?
--
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>
next prev parent reply other threads:[~2009-04-28 3:33 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-14 19:33 meminfo Committed_AS underflows Dave Hansen
2009-04-14 19:33 ` Dave Hansen
2009-04-15 2:04 ` KOSAKI Motohiro
2009-04-15 2:04 ` KOSAKI Motohiro
2009-04-15 3:34 ` Balbir Singh
2009-04-15 3:34 ` Balbir Singh
2009-04-15 4:10 ` KOSAKI Motohiro
2009-04-15 4:10 ` KOSAKI Motohiro
2009-04-15 8:47 ` Balbir Singh
2009-04-15 8:47 ` Balbir Singh
2009-04-27 20:27 ` Andrew Morton
2009-04-27 20:27 ` Andrew Morton
2009-04-28 3:07 ` KOSAKI Motohiro
2009-04-28 3:07 ` KOSAKI Motohiro
2009-04-28 3:27 ` Andrew Morton [this message]
2009-04-28 3:27 ` Andrew Morton
2009-04-28 4:25 ` KOSAKI Motohiro
2009-04-28 4:25 ` KOSAKI Motohiro
2009-04-28 8:17 ` Dave Hansen
2009-04-28 8:17 ` Dave Hansen
2009-04-15 4:12 ` KOSAKI Motohiro
2009-04-15 4:12 ` KOSAKI Motohiro
2009-04-15 8:33 ` Alan Cox
2009-04-15 8:33 ` Alan Cox
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=20090427202707.9d36ce8a.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=cl@linux-foundation.org \
--cc=dave@linux.vnet.ibm.com \
--cc=ebmunson@us.ibm.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mel@linux.vnet.ibm.com \
--cc=stable@kernel.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.