From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Dave Hansen <dave@linux.vnet.ibm.com>
Cc: kosaki.motohiro@jp.fujitsu.com,
Eric B Munson <ebmunson@us.ibm.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
mel@linux.vnet.ibm.com, cl@linux-foundation.org
Subject: Re: [PATCH V3] Fix Committed_AS underflow
Date: Tue, 21 Apr 2009 10:41:20 +0900 (JST) [thread overview]
Message-ID: <20090421102317.F113.A69D9226@jp.fujitsu.com> (raw)
In-Reply-To: <1240256999.32604.330.camel@nimitz>
> void vm_acct_memory(long pages)
> {
> long *local;
> long local_min = -ACCT_THRESHOLD;
> long local_max = ACCT_THRESHOLD;
> long local_goal = 0;
>
> preempt_disable();
> local = &__get_cpu_var(committed_space);
> *local += pages;
> if (*local > local_max || *local < local_min) {
> atomic_long_add(*local - local_goal, &vm_committed_space);
> *local = local_goal;
> }
> preempt_enable();
> }
>
> But now consider if we changed the local_* variables a bit:
>
> long local_min = -(ACCT_THRESHOLD*2);
> long local_max = 0
> long local_goal = -ACCT_THRESHOLD;
>
> We'll get some possibly *large* numbers in meminfo, but it will at least
> never underflow.
if *local == -(ACCT_THRESHOLD*2),
*local - local_goal = -(ACCT_THRESHOLD*2) + ACCT_THRESHOLD = -ACCT_THRESHOLD
Then, we still pass negative value to atomic_long_add().
IOW, vm_committed_space still can be negative value.
Am I missing anything?
--
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-21 1:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-20 9:09 Eric B Munson
2009-04-20 9:18 ` KOSAKI Motohiro
2009-04-20 16:15 ` Dave Hansen
2009-04-20 19:49 ` Dave Hansen
2009-04-21 1:41 ` KOSAKI Motohiro [this message]
2009-04-23 16:31 ` Eric B Munson
2009-04-23 20:38 ` Dave Hansen
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=20090421102317.F113.A69D9226@jp.fujitsu.com \
--to=kosaki.motohiro@jp.fujitsu.com \
--cc=cl@linux-foundation.org \
--cc=dave@linux.vnet.ibm.com \
--cc=ebmunson@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox