diff options
author | David Rientjes <rientjes@google.com> | 2007-10-17 02:26:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 11:42:46 -0400 |
commit | ae74138da609c576b221c765efa8b81b2365f465 (patch) | |
tree | 514b8ea20d97815a7dfd5fd9ebcb6377b178f2b0 /mm/oom_kill.c | |
parent | 9aad369e5690cbd0505f75aa1d34c9cacfef48da (diff) |
oom: convert zone_scan_lock from mutex to spinlock
There's no reason to sleep in try_set_zone_oom() or clear_zonelist_oom() if
the lock can't be acquired; it will be available soon enough once the zonelist
scanning is done. All other threads waiting for the OOM killer are also
contingent on the exiting task being able to acquire the lock in
clear_zonelist_oom() so it doesn't make sense to put it to sleep.
Cc: Andrea Arcangeli <andrea@suse.de>
Cc: 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 'mm/oom_kill.c')
-rw-r--r-- | mm/oom_kill.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 183a964ca61b..a64decb5b13f 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | int sysctl_panic_on_oom; | 29 | int sysctl_panic_on_oom; |
30 | int sysctl_oom_kill_allocating_task; | 30 | int sysctl_oom_kill_allocating_task; |
31 | static DEFINE_MUTEX(zone_scan_mutex); | 31 | static DEFINE_SPINLOCK(zone_scan_mutex); |
32 | /* #define DEBUG */ | 32 | /* #define DEBUG */ |
33 | 33 | ||
34 | /** | 34 | /** |
@@ -396,7 +396,7 @@ int try_set_zone_oom(struct zonelist *zonelist) | |||
396 | 396 | ||
397 | z = zonelist->zones; | 397 | z = zonelist->zones; |
398 | 398 | ||
399 | mutex_lock(&zone_scan_mutex); | 399 | spin_lock(&zone_scan_mutex); |
400 | do { | 400 | do { |
401 | if (zone_is_oom_locked(*z)) { | 401 | if (zone_is_oom_locked(*z)) { |
402 | ret = 0; | 402 | ret = 0; |
@@ -413,7 +413,7 @@ int try_set_zone_oom(struct zonelist *zonelist) | |||
413 | zone_set_flag(*z, ZONE_OOM_LOCKED); | 413 | zone_set_flag(*z, ZONE_OOM_LOCKED); |
414 | } while (*(++z) != NULL); | 414 | } while (*(++z) != NULL); |
415 | out: | 415 | out: |
416 | mutex_unlock(&zone_scan_mutex); | 416 | spin_unlock(&zone_scan_mutex); |
417 | return ret; | 417 | return ret; |
418 | } | 418 | } |
419 | 419 | ||
@@ -428,11 +428,11 @@ void clear_zonelist_oom(struct zonelist *zonelist) | |||
428 | 428 | ||
429 | z = zonelist->zones; | 429 | z = zonelist->zones; |
430 | 430 | ||
431 | mutex_lock(&zone_scan_mutex); | 431 | spin_lock(&zone_scan_mutex); |
432 | do { | 432 | do { |
433 | zone_clear_flag(*z, ZONE_OOM_LOCKED); | 433 | zone_clear_flag(*z, ZONE_OOM_LOCKED); |
434 | } while (*(++z) != NULL); | 434 | } while (*(++z) != NULL); |
435 | mutex_unlock(&zone_scan_mutex); | 435 | spin_unlock(&zone_scan_mutex); |
436 | } | 436 | } |
437 | 437 | ||
438 | /** | 438 | /** |