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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]