From: "Coywolf Qi Hunt" <coywolf@sosdg.org>
To: nickpiggin@yahoo.com.au
Cc: kernel@kolivas.org, akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: [patch] zone_watermark_ok() rework
Date: Tue, 4 Oct 2005 01:41:31 +0800 [thread overview]
Message-ID: <20051003174131.GA2865@gmail.com> (raw)
Hello,
In zone_watermark_ok(), the original algorithm seems not logical. This is a
rework. Comments?
Coywolf
Signed-off-by: Coywolf Qi Hunt <coywolf@sosdg.org>
---
page_alloc.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
--- 2.6.14-rc2-mm1/mm/page_alloc.c~orig 2005-09-29 20:37:07.000000000 +0800
+++ 2.6.14-rc2-mm1/mm/page_alloc.c 2005-10-04 01:19:31.000000000 +0800
@@ -772,7 +772,7 @@
int zone_watermark_ok(struct zone *z, int order, unsigned long mark,
int classzone_idx, int can_try_harder, int gfp_high)
{
- /* free_pages my go negative - that's OK */
+ /* free_pages may go negative - that's OK */
long min = mark, free_pages = z->free_pages - (1 << order) + 1;
int o;
@@ -783,17 +783,12 @@
if (free_pages <= min + z->lowmem_reserve[classzone_idx])
return 0;
- for (o = 0; o < order; o++) {
- /* At the next order, this order's pages become unavailable */
- free_pages -= z->free_area[o].nr_free << o;
- /* Require fewer higher order pages to be free */
- min >>= 1;
-
- if (free_pages <= min)
- return 0;
+ for (o = order; o < MAX_ORDER; o++) {
+ if (z->free_area[o].nr_free)
+ return 1;
}
- return 1;
+ return 0;
}
static inline int
next reply other threads:[~2005-10-03 17:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-03 17:41 Coywolf Qi Hunt [this message]
2005-10-04 0:38 ` Nick Piggin
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=20051003174131.GA2865@gmail.com \
--to=coywolf@sosdg.org \
--cc=akpm@osdl.org \
--cc=kernel@kolivas.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
/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
Powered by JetHome