From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Con Kolivas <kernel@kolivas.org>
Cc: linux list <linux-kernel@vger.kernel.org>,
ck list <ck@vds.kolivas.org>, Andrew Morton <akpm@osdl.org>,
Rafael Wysocki <rjw@sisk.pl>, Pavel Machek <pavel@ucw.cz>,
linux-mm@kvack.org
Subject: Re: [PATCH][1/3] mm: swsusp shrink_all_memory tweaks
Date: Mon, 20 Mar 2006 22:41:46 +1100 [thread overview]
Message-ID: <441E94FA.8070408@yahoo.com.au> (raw)
In-Reply-To: <200603200231.50666.kernel@kolivas.org>
Con Kolivas wrote:
> -
> +
> +#define for_each_priority_reverse(priority) \
> + for (priority = DEF_PRIORITY; \
> + priority >= 0; \
> + priority--)
> +
> /*
> * This is the main entry point to direct page reclaim.
> *
> @@ -979,7 +1010,7 @@ unsigned long try_to_free_pages(struct z
> lru_pages += zone->nr_active + zone->nr_inactive;
> }
>
> - for (priority = DEF_PRIORITY; priority >= 0; priority--) {
> + for_each_priority_reverse(priority) {
> sc.nr_mapped = read_page_state(nr_mapped);
> sc.nr_scanned = 0;
> if (!priority)
I still don't like this change. Apart from being harder to read in
my opinion, I don't believe there is a precedent for "consolidating"
simple for loops in the kernel, is there?
More complex loops get helpers, but they're made part of the wider
well-known kernel API.
Why does for_each_priority_reverse blow up when you pass it an unsigned
argument? What range has priority? What direction does the loop go in?
(_reverse postfix doesn't tell me, because it is going from low->high
priority so I would have thought that is going forward, or up)
You had to look in two places each time you wanted to know the answers.
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
--
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:[~2006-03-20 11:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-19 15:31 Con Kolivas
2006-03-20 11:41 ` Nick Piggin [this message]
2006-03-20 11:50 ` Con Kolivas
2006-03-20 18:46 ` Rafael J. Wysocki
2006-03-24 7:07 ` [PATCH] " Con Kolivas
2006-03-24 15:16 ` Rafael J. Wysocki
2006-03-24 15:30 ` Con Kolivas
2006-03-24 16:14 ` Rafael J. Wysocki
2006-03-30 17:12 ` Rafael J. Wysocki
2006-03-30 18:37 ` Rafael J. Wysocki
2006-03-30 20:38 ` Con Kolivas
2006-03-30 20:57 ` Rafael J. Wysocki
2006-03-27 12:24 ` Pavel Machek
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=441E94FA.8070408@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=ck@vds.kolivas.org \
--cc=kernel@kolivas.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pavel@ucw.cz \
--cc=rjw@sisk.pl \
/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