diff options
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r-- | mm/vmscan.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index cfffe5098d53..0095533cdde9 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -822,6 +822,8 @@ shrink_zone(struct zone *zone, struct scan_control *sc) | |||
822 | unsigned long nr_active; | 822 | unsigned long nr_active; |
823 | unsigned long nr_inactive; | 823 | unsigned long nr_inactive; |
824 | 824 | ||
825 | atomic_inc(&zone->reclaim_in_progress); | ||
826 | |||
825 | /* | 827 | /* |
826 | * Add one to `nr_to_scan' just to make sure that the kernel will | 828 | * Add one to `nr_to_scan' just to make sure that the kernel will |
827 | * slowly sift through the active list. | 829 | * slowly sift through the active list. |
@@ -861,6 +863,8 @@ shrink_zone(struct zone *zone, struct scan_control *sc) | |||
861 | } | 863 | } |
862 | 864 | ||
863 | throttle_vm_writeout(); | 865 | throttle_vm_writeout(); |
866 | |||
867 | atomic_dec(&zone->reclaim_in_progress); | ||
864 | } | 868 | } |
865 | 869 | ||
866 | /* | 870 | /* |
@@ -900,9 +904,7 @@ shrink_caches(struct zone **zones, struct scan_control *sc) | |||
900 | if (zone->all_unreclaimable && sc->priority != DEF_PRIORITY) | 904 | if (zone->all_unreclaimable && sc->priority != DEF_PRIORITY) |
901 | continue; /* Let kswapd poll it */ | 905 | continue; /* Let kswapd poll it */ |
902 | 906 | ||
903 | atomic_inc(&zone->reclaim_in_progress); | ||
904 | shrink_zone(zone, sc); | 907 | shrink_zone(zone, sc); |
905 | atomic_dec(&zone->reclaim_in_progress); | ||
906 | } | 908 | } |
907 | } | 909 | } |
908 | 910 | ||
@@ -1358,14 +1360,13 @@ int zone_reclaim(struct zone *zone, unsigned int gfp_mask, unsigned int order) | |||
1358 | sc.swap_cluster_max = SWAP_CLUSTER_MAX; | 1360 | sc.swap_cluster_max = SWAP_CLUSTER_MAX; |
1359 | 1361 | ||
1360 | /* Don't reclaim the zone if there are other reclaimers active */ | 1362 | /* Don't reclaim the zone if there are other reclaimers active */ |
1361 | if (!atomic_inc_and_test(&zone->reclaim_in_progress)) | 1363 | if (atomic_read(&zone->reclaim_in_progress) > 0) |
1362 | goto out; | 1364 | goto out; |
1363 | 1365 | ||
1364 | shrink_zone(zone, &sc); | 1366 | shrink_zone(zone, &sc); |
1365 | total_reclaimed = sc.nr_reclaimed; | 1367 | total_reclaimed = sc.nr_reclaimed; |
1366 | 1368 | ||
1367 | out: | 1369 | out: |
1368 | atomic_dec(&zone->reclaim_in_progress); | ||
1369 | return total_reclaimed; | 1370 | return total_reclaimed; |
1370 | } | 1371 | } |
1371 | 1372 | ||
@@ -1375,6 +1376,9 @@ asmlinkage long sys_set_zone_reclaim(unsigned int node, unsigned int zone, | |||
1375 | struct zone *z; | 1376 | struct zone *z; |
1376 | int i; | 1377 | int i; |
1377 | 1378 | ||
1379 | if (!capable(CAP_SYS_ADMIN)) | ||
1380 | return -EACCES; | ||
1381 | |||
1378 | if (node >= MAX_NUMNODES || !node_online(node)) | 1382 | if (node >= MAX_NUMNODES || !node_online(node)) |
1379 | return -EINVAL; | 1383 | return -EINVAL; |
1380 | 1384 | ||