diff options
author | David Rientjes <rientjes@google.com> | 2007-10-17 02:25:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 11:42:45 -0400 |
commit | e815af95f94914993bbad279c71cf5fef9f4eaac (patch) | |
tree | 492e0d3e8d3303f37cf9fb0beecf952a1c828c53 /include/linux/mmzone.h | |
parent | 70e24bdf6d2fead14631e72a07fba012400c521e (diff) |
oom: change all_unreclaimable zone member to flags
Convert the int all_unreclaimable member of struct zone to unsigned long
flags. This can now be used to specify several different zone flags such as
all_unreclaimable and reclaim_in_progress, which can now be removed and
converted to a per-zone flag.
Flags are set and cleared as follows:
zone_set_flag(struct zone *zone, zone_flags_t flag)
zone_clear_flag(struct zone *zone, zone_flags_t flag)
Defines the first zone flags, ZONE_ALL_UNRECLAIMABLE and ZONE_RECLAIM_LOCKED,
which have the same semantics as the old zone->all_unreclaimable and
zone->reclaim_in_progress, respectively. Also converts all current users that
set or clear either flag to use the new interface.
Helper functions are defined to test the flags:
int zone_is_all_unreclaimable(const struct zone *zone)
int zone_is_reclaim_locked(const struct zone *zone)
All flag operators are of the atomic variety because there are currently
readers that are implemented that do not take zone->lock.
[akpm@linux-foundation.org: add needed include]
Cc: Andrea Arcangeli <andrea@suse.de>
Acked-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/mmzone.h')
-rw-r--r-- | include/linux/mmzone.h | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index f4bfe824834f..bad9486ee0cc 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/spinlock.h> | 7 | #include <linux/spinlock.h> |
8 | #include <linux/list.h> | 8 | #include <linux/list.h> |
9 | #include <linux/wait.h> | 9 | #include <linux/wait.h> |
10 | #include <linux/bitops.h> | ||
10 | #include <linux/cache.h> | 11 | #include <linux/cache.h> |
11 | #include <linux/threads.h> | 12 | #include <linux/threads.h> |
12 | #include <linux/numa.h> | 13 | #include <linux/numa.h> |
@@ -262,10 +263,7 @@ struct zone { | |||
262 | unsigned long nr_scan_active; | 263 | unsigned long nr_scan_active; |
263 | unsigned long nr_scan_inactive; | 264 | unsigned long nr_scan_inactive; |
264 | unsigned long pages_scanned; /* since last reclaim */ | 265 | unsigned long pages_scanned; /* since last reclaim */ |
265 | int all_unreclaimable; /* All pages pinned */ | 266 | unsigned long flags; /* zone flags, see below */ |
266 | |||
267 | /* A count of how many reclaimers are scanning this zone */ | ||
268 | atomic_t reclaim_in_progress; | ||
269 | 267 | ||
270 | /* Zone statistics */ | 268 | /* Zone statistics */ |
271 | atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS]; | 269 | atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS]; |
@@ -343,6 +341,29 @@ struct zone { | |||
343 | const char *name; | 341 | const char *name; |
344 | } ____cacheline_internodealigned_in_smp; | 342 | } ____cacheline_internodealigned_in_smp; |
345 | 343 | ||
344 | typedef enum { | ||
345 | ZONE_ALL_UNRECLAIMABLE, /* all pages pinned */ | ||
346 | ZONE_RECLAIM_LOCKED, /* prevents concurrent reclaim */ | ||
347 | } zone_flags_t; | ||
348 | |||
349 | static inline void zone_set_flag(struct zone *zone, zone_flags_t flag) | ||
350 | { | ||
351 | set_bit(flag, &zone->flags); | ||
352 | } | ||
353 | static inline void zone_clear_flag(struct zone *zone, zone_flags_t flag) | ||
354 | { | ||
355 | clear_bit(flag, &zone->flags); | ||
356 | } | ||
357 | |||
358 | static inline int zone_is_all_unreclaimable(const struct zone *zone) | ||
359 | { | ||
360 | return test_bit(ZONE_ALL_UNRECLAIMABLE, &zone->flags); | ||
361 | } | ||
362 | static inline int zone_is_reclaim_locked(const struct zone *zone) | ||
363 | { | ||
364 | return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags); | ||
365 | } | ||
366 | |||
346 | /* | 367 | /* |
347 | * The "priority" of VM scanning is how much of the queues we will scan in one | 368 | * The "priority" of VM scanning is how much of the queues we will scan in one |
348 | * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the | 369 | * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the |