aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorAndi Kleen <andi@basil.nowhere.org>2006-11-21 04:22:09 -0500
committerAndi Kleen <andi@basil.nowhere.org>2006-11-21 04:22:09 -0500
commit1b7f6a626f0ff511c3840678466cbfe1d62c0b29 (patch)
tree415e8c838c0067bff384afb8a2c91e5f7c6d11d3 /mm
parentb3edc9cec07ade41aaf1804f7c9e876afa90c862 (diff)
parent3f5a6ca31c334011fd929501a078424c0d3f71be (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'mm')
-rw-r--r--mm/filemap.c24
-rw-r--r--mm/hugetlb.c3
-rw-r--r--mm/migrate.c3
-rw-r--r--mm/mmap.c5
-rw-r--r--mm/page_alloc.c6
-rw-r--r--mm/readahead.c2
-rw-r--r--mm/slab.c2
-rw-r--r--mm/sparse.c2
-rw-r--r--mm/vmalloc.c47
-rw-r--r--mm/vmscan.c63
-rw-r--r--mm/vmstat.c2
11 files changed, 92 insertions, 67 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index cb26e33fd0ff..7b84dc814347 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -467,25 +467,15 @@ int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
467} 467}
468 468
469#ifdef CONFIG_NUMA 469#ifdef CONFIG_NUMA
470struct page *page_cache_alloc(struct address_space *x) 470struct page *__page_cache_alloc(gfp_t gfp)
471{ 471{
472 if (cpuset_do_page_mem_spread()) { 472 if (cpuset_do_page_mem_spread()) {
473 int n = cpuset_mem_spread_node(); 473 int n = cpuset_mem_spread_node();
474 return alloc_pages_node(n, mapping_gfp_mask(x), 0); 474 return alloc_pages_node(n, gfp, 0);
475 } 475 }
476 return alloc_pages(mapping_gfp_mask(x), 0); 476 return alloc_pages(gfp, 0);
477} 477}
478EXPORT_SYMBOL(page_cache_alloc); 478EXPORT_SYMBOL(__page_cache_alloc);
479
480struct page *page_cache_alloc_cold(struct address_space *x)
481{
482 if (cpuset_do_page_mem_spread()) {
483 int n = cpuset_mem_spread_node();
484 return alloc_pages_node(n, mapping_gfp_mask(x)|__GFP_COLD, 0);
485 }
486 return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0);
487}
488EXPORT_SYMBOL(page_cache_alloc_cold);
489#endif 479#endif
490 480
491static int __sleep_on_page_lock(void *word) 481static int __sleep_on_page_lock(void *word)
@@ -826,7 +816,6 @@ struct page *
826grab_cache_page_nowait(struct address_space *mapping, unsigned long index) 816grab_cache_page_nowait(struct address_space *mapping, unsigned long index)
827{ 817{
828 struct page *page = find_get_page(mapping, index); 818 struct page *page = find_get_page(mapping, index);
829 gfp_t gfp_mask;
830 819
831 if (page) { 820 if (page) {
832 if (!TestSetPageLocked(page)) 821 if (!TestSetPageLocked(page))
@@ -834,9 +823,8 @@ grab_cache_page_nowait(struct address_space *mapping, unsigned long index)
834 page_cache_release(page); 823 page_cache_release(page);
835 return NULL; 824 return NULL;
836 } 825 }
837 gfp_mask = mapping_gfp_mask(mapping) & ~__GFP_FS; 826 page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~__GFP_FS);
838 page = alloc_pages(gfp_mask, 0); 827 if (page && add_to_page_cache_lru(page, mapping, index, GFP_KERNEL)) {
839 if (page && add_to_page_cache_lru(page, mapping, index, gfp_mask)) {
840 page_cache_release(page); 828 page_cache_release(page);
841 page = NULL; 829 page = NULL;
842 } 830 }
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 2dbec90dc3ba..a088f593a807 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -478,6 +478,9 @@ int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma,
478retry: 478retry:
479 page = find_lock_page(mapping, idx); 479 page = find_lock_page(mapping, idx);
480 if (!page) { 480 if (!page) {
481 size = i_size_read(mapping->host) >> HPAGE_SHIFT;
482 if (idx >= size)
483 goto out;
481 if (hugetlb_get_quota(mapping)) 484 if (hugetlb_get_quota(mapping))
482 goto out; 485 goto out;
483 page = alloc_huge_page(vma, address); 486 page = alloc_huge_page(vma, address);
diff --git a/mm/migrate.c b/mm/migrate.c
index ba2453f9483d..b4979d423d2b 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -952,7 +952,8 @@ asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
952 goto out; 952 goto out;
953 953
954 pm[i].node = node; 954 pm[i].node = node;
955 } 955 } else
956 pm[i].node = 0; /* anything to not match MAX_NUMNODES */
956 } 957 }
957 /* End marker */ 958 /* End marker */
958 pm[nr_pages].node = MAX_NUMNODES; 959 pm[nr_pages].node = MAX_NUMNODES;
diff --git a/mm/mmap.c b/mm/mmap.c
index 497e502dfd6b..7b40abd7cba2 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1379,7 +1379,7 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
1379 * Check if the given range is hugepage aligned, and 1379 * Check if the given range is hugepage aligned, and
1380 * can be made suitable for hugepages. 1380 * can be made suitable for hugepages.
1381 */ 1381 */
1382 ret = prepare_hugepage_range(addr, len); 1382 ret = prepare_hugepage_range(addr, len, pgoff);
1383 } else { 1383 } else {
1384 /* 1384 /*
1385 * Ensure that a normal request is not falling in a 1385 * Ensure that a normal request is not falling in a
@@ -1880,6 +1880,9 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
1880 if ((addr + len) > TASK_SIZE || (addr + len) < addr) 1880 if ((addr + len) > TASK_SIZE || (addr + len) < addr)
1881 return -EINVAL; 1881 return -EINVAL;
1882 1882
1883 if (is_hugepage_only_range(mm, addr, len))
1884 return -EINVAL;
1885
1883 flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags; 1886 flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
1884 1887
1885 error = arch_mmap_check(addr, len, flags); 1888 error = arch_mmap_check(addr, len, flags);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f5fc45472d5c..bf2f6cff1d6a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -853,7 +853,7 @@ again:
853 pcp = &zone_pcp(zone, cpu)->pcp[cold]; 853 pcp = &zone_pcp(zone, cpu)->pcp[cold];
854 local_irq_save(flags); 854 local_irq_save(flags);
855 if (!pcp->count) { 855 if (!pcp->count) {
856 pcp->count += rmqueue_bulk(zone, 0, 856 pcp->count = rmqueue_bulk(zone, 0,
857 pcp->batch, &pcp->list); 857 pcp->batch, &pcp->list);
858 if (unlikely(!pcp->count)) 858 if (unlikely(!pcp->count))
859 goto failed; 859 goto failed;
@@ -2261,7 +2261,7 @@ unsigned long __init __absent_pages_in_range(int nid,
2261 2261
2262 /* Account for ranges past physical memory on this node */ 2262 /* Account for ranges past physical memory on this node */
2263 if (range_end_pfn > prev_end_pfn) 2263 if (range_end_pfn > prev_end_pfn)
2264 hole_pages = range_end_pfn - 2264 hole_pages += range_end_pfn -
2265 max(range_start_pfn, prev_end_pfn); 2265 max(range_start_pfn, prev_end_pfn);
2266 2266
2267 return hole_pages; 2267 return hole_pages;
@@ -2407,7 +2407,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat,
2407 zone->zone_pgdat = pgdat; 2407 zone->zone_pgdat = pgdat;
2408 zone->free_pages = 0; 2408 zone->free_pages = 0;
2409 2409
2410 zone->temp_priority = zone->prev_priority = DEF_PRIORITY; 2410 zone->prev_priority = DEF_PRIORITY;
2411 2411
2412 zone_pcp_init(zone); 2412 zone_pcp_init(zone);
2413 INIT_LIST_HEAD(&zone->active_list); 2413 INIT_LIST_HEAD(&zone->active_list);
diff --git a/mm/readahead.c b/mm/readahead.c
index 1ba736ac0367..23cb61a01c6e 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -173,6 +173,8 @@ static int read_pages(struct address_space *mapping, struct file *filp,
173 173
174 if (mapping->a_ops->readpages) { 174 if (mapping->a_ops->readpages) {
175 ret = mapping->a_ops->readpages(filp, mapping, pages, nr_pages); 175 ret = mapping->a_ops->readpages(filp, mapping, pages, nr_pages);
176 /* Clean up the remaining pages */
177 put_pages_list(pages);
176 goto out; 178 goto out;
177 } 179 }
178 180
diff --git a/mm/slab.c b/mm/slab.c
index 84c631f30741..3c4a7e34eddc 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -883,7 +883,7 @@ static void init_reap_node(int cpu)
883 if (node == MAX_NUMNODES) 883 if (node == MAX_NUMNODES)
884 node = first_node(node_online_map); 884 node = first_node(node_online_map);
885 885
886 __get_cpu_var(reap_node) = node; 886 per_cpu(reap_node, cpu) = node;
887} 887}
888 888
889static void next_reap_node(void) 889static void next_reap_node(void)
diff --git a/mm/sparse.c b/mm/sparse.c
index 86c52ab80878..b3c82ba30012 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -211,7 +211,7 @@ static struct page *__kmalloc_section_memmap(unsigned long nr_pages)
211 struct page *page, *ret; 211 struct page *page, *ret;
212 unsigned long memmap_size = sizeof(struct page) * nr_pages; 212 unsigned long memmap_size = sizeof(struct page) * nr_pages;
213 213
214 page = alloc_pages(GFP_KERNEL, get_order(memmap_size)); 214 page = alloc_pages(GFP_KERNEL|__GFP_NOWARN, get_order(memmap_size));
215 if (page) 215 if (page)
216 goto got_map_page; 216 goto got_map_page;
217 217
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 1133dd3aafcf..86897ee792d6 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -160,13 +160,15 @@ int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages)
160 return err; 160 return err;
161} 161}
162 162
163struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long flags, 163static struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long flags,
164 unsigned long start, unsigned long end, int node) 164 unsigned long start, unsigned long end,
165 int node, gfp_t gfp_mask)
165{ 166{
166 struct vm_struct **p, *tmp, *area; 167 struct vm_struct **p, *tmp, *area;
167 unsigned long align = 1; 168 unsigned long align = 1;
168 unsigned long addr; 169 unsigned long addr;
169 170
171 BUG_ON(in_interrupt());
170 if (flags & VM_IOREMAP) { 172 if (flags & VM_IOREMAP) {
171 int bit = fls(size); 173 int bit = fls(size);
172 174
@@ -179,16 +181,13 @@ struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long flags,
179 } 181 }
180 addr = ALIGN(start, align); 182 addr = ALIGN(start, align);
181 size = PAGE_ALIGN(size); 183 size = PAGE_ALIGN(size);
184 if (unlikely(!size))
185 return NULL;
182 186
183 area = kmalloc_node(sizeof(*area), GFP_KERNEL, node); 187 area = kmalloc_node(sizeof(*area), gfp_mask & GFP_LEVEL_MASK, node);
184 if (unlikely(!area)) 188 if (unlikely(!area))
185 return NULL; 189 return NULL;
186 190
187 if (unlikely(!size)) {
188 kfree (area);
189 return NULL;
190 }
191
192 /* 191 /*
193 * We always allocate a guard page. 192 * We always allocate a guard page.
194 */ 193 */
@@ -236,7 +235,7 @@ out:
236struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, 235struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
237 unsigned long start, unsigned long end) 236 unsigned long start, unsigned long end)
238{ 237{
239 return __get_vm_area_node(size, flags, start, end, -1); 238 return __get_vm_area_node(size, flags, start, end, -1, GFP_KERNEL);
240} 239}
241 240
242/** 241/**
@@ -253,9 +252,11 @@ struct vm_struct *get_vm_area(unsigned long size, unsigned long flags)
253 return __get_vm_area(size, flags, VMALLOC_START, VMALLOC_END); 252 return __get_vm_area(size, flags, VMALLOC_START, VMALLOC_END);
254} 253}
255 254
256struct vm_struct *get_vm_area_node(unsigned long size, unsigned long flags, int node) 255struct vm_struct *get_vm_area_node(unsigned long size, unsigned long flags,
256 int node, gfp_t gfp_mask)
257{ 257{
258 return __get_vm_area_node(size, flags, VMALLOC_START, VMALLOC_END, node); 258 return __get_vm_area_node(size, flags, VMALLOC_START, VMALLOC_END, node,
259 gfp_mask);
259} 260}
260 261
261/* Caller must hold vmlist_lock */ 262/* Caller must hold vmlist_lock */
@@ -487,7 +488,7 @@ static void *__vmalloc_node(unsigned long size, gfp_t gfp_mask, pgprot_t prot,
487 if (!size || (size >> PAGE_SHIFT) > num_physpages) 488 if (!size || (size >> PAGE_SHIFT) > num_physpages)
488 return NULL; 489 return NULL;
489 490
490 area = get_vm_area_node(size, VM_ALLOC, node); 491 area = get_vm_area_node(size, VM_ALLOC, node, gfp_mask);
491 if (!area) 492 if (!area)
492 return NULL; 493 return NULL;
493 494
@@ -528,11 +529,12 @@ void *vmalloc_user(unsigned long size)
528 void *ret; 529 void *ret;
529 530
530 ret = __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL); 531 ret = __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL);
531 write_lock(&vmlist_lock); 532 if (ret) {
532 area = __find_vm_area(ret); 533 write_lock(&vmlist_lock);
533 area->flags |= VM_USERMAP; 534 area = __find_vm_area(ret);
534 write_unlock(&vmlist_lock); 535 area->flags |= VM_USERMAP;
535 536 write_unlock(&vmlist_lock);
537 }
536 return ret; 538 return ret;
537} 539}
538EXPORT_SYMBOL(vmalloc_user); 540EXPORT_SYMBOL(vmalloc_user);
@@ -601,11 +603,12 @@ void *vmalloc_32_user(unsigned long size)
601 void *ret; 603 void *ret;
602 604
603 ret = __vmalloc(size, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL); 605 ret = __vmalloc(size, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL);
604 write_lock(&vmlist_lock); 606 if (ret) {
605 area = __find_vm_area(ret); 607 write_lock(&vmlist_lock);
606 area->flags |= VM_USERMAP; 608 area = __find_vm_area(ret);
607 write_unlock(&vmlist_lock); 609 area->flags |= VM_USERMAP;
608 610 write_unlock(&vmlist_lock);
611 }
609 return ret; 612 return ret;
610} 613}
611EXPORT_SYMBOL(vmalloc_32_user); 614EXPORT_SYMBOL(vmalloc_32_user);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f05527bf792b..518540a4a2a6 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -723,6 +723,20 @@ done:
723 return nr_reclaimed; 723 return nr_reclaimed;
724} 724}
725 725
726/*
727 * We are about to scan this zone at a certain priority level. If that priority
728 * level is smaller (ie: more urgent) than the previous priority, then note
729 * that priority level within the zone. This is done so that when the next
730 * process comes in to scan this zone, it will immediately start out at this
731 * priority level rather than having to build up its own scanning priority.
732 * Here, this priority affects only the reclaim-mapped threshold.
733 */
734static inline void note_zone_scanning_priority(struct zone *zone, int priority)
735{
736 if (priority < zone->prev_priority)
737 zone->prev_priority = priority;
738}
739
726static inline int zone_is_near_oom(struct zone *zone) 740static inline int zone_is_near_oom(struct zone *zone)
727{ 741{
728 return zone->pages_scanned >= (zone->nr_active + zone->nr_inactive)*3; 742 return zone->pages_scanned >= (zone->nr_active + zone->nr_inactive)*3;
@@ -746,7 +760,7 @@ static inline int zone_is_near_oom(struct zone *zone)
746 * But we had to alter page->flags anyway. 760 * But we had to alter page->flags anyway.
747 */ 761 */
748static void shrink_active_list(unsigned long nr_pages, struct zone *zone, 762static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
749 struct scan_control *sc) 763 struct scan_control *sc, int priority)
750{ 764{
751 unsigned long pgmoved; 765 unsigned long pgmoved;
752 int pgdeactivate = 0; 766 int pgdeactivate = 0;
@@ -770,7 +784,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
770 * `distress' is a measure of how much trouble we're having 784 * `distress' is a measure of how much trouble we're having
771 * reclaiming pages. 0 -> no problems. 100 -> great trouble. 785 * reclaiming pages. 0 -> no problems. 100 -> great trouble.
772 */ 786 */
773 distress = 100 >> zone->prev_priority; 787 distress = 100 >> min(zone->prev_priority, priority);
774 788
775 /* 789 /*
776 * The point of this algorithm is to decide when to start 790 * The point of this algorithm is to decide when to start
@@ -922,7 +936,7 @@ static unsigned long shrink_zone(int priority, struct zone *zone,
922 nr_to_scan = min(nr_active, 936 nr_to_scan = min(nr_active,
923 (unsigned long)sc->swap_cluster_max); 937 (unsigned long)sc->swap_cluster_max);
924 nr_active -= nr_to_scan; 938 nr_active -= nr_to_scan;
925 shrink_active_list(nr_to_scan, zone, sc); 939 shrink_active_list(nr_to_scan, zone, sc, priority);
926 } 940 }
927 941
928 if (nr_inactive) { 942 if (nr_inactive) {
@@ -972,9 +986,7 @@ static unsigned long shrink_zones(int priority, struct zone **zones,
972 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL)) 986 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL))
973 continue; 987 continue;
974 988
975 zone->temp_priority = priority; 989 note_zone_scanning_priority(zone, priority);
976 if (zone->prev_priority > priority)
977 zone->prev_priority = priority;
978 990
979 if (zone->all_unreclaimable && priority != DEF_PRIORITY) 991 if (zone->all_unreclaimable && priority != DEF_PRIORITY)
980 continue; /* Let kswapd poll it */ 992 continue; /* Let kswapd poll it */
@@ -1024,7 +1036,6 @@ unsigned long try_to_free_pages(struct zone **zones, gfp_t gfp_mask)
1024 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL)) 1036 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL))
1025 continue; 1037 continue;
1026 1038
1027 zone->temp_priority = DEF_PRIORITY;
1028 lru_pages += zone->nr_active + zone->nr_inactive; 1039 lru_pages += zone->nr_active + zone->nr_inactive;
1029 } 1040 }
1030 1041
@@ -1065,13 +1076,22 @@ unsigned long try_to_free_pages(struct zone **zones, gfp_t gfp_mask)
1065 if (!sc.all_unreclaimable) 1076 if (!sc.all_unreclaimable)
1066 ret = 1; 1077 ret = 1;
1067out: 1078out:
1079 /*
1080 * Now that we've scanned all the zones at this priority level, note
1081 * that level within the zone so that the next thread which performs
1082 * scanning of this zone will immediately start out at this priority
1083 * level. This affects only the decision whether or not to bring
1084 * mapped pages onto the inactive list.
1085 */
1086 if (priority < 0)
1087 priority = 0;
1068 for (i = 0; zones[i] != 0; i++) { 1088 for (i = 0; zones[i] != 0; i++) {
1069 struct zone *zone = zones[i]; 1089 struct zone *zone = zones[i];
1070 1090
1071 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL)) 1091 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL))
1072 continue; 1092 continue;
1073 1093
1074 zone->prev_priority = zone->temp_priority; 1094 zone->prev_priority = priority;
1075 } 1095 }
1076 return ret; 1096 return ret;
1077} 1097}
@@ -1111,6 +1131,11 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order)
1111 .swap_cluster_max = SWAP_CLUSTER_MAX, 1131 .swap_cluster_max = SWAP_CLUSTER_MAX,
1112 .swappiness = vm_swappiness, 1132 .swappiness = vm_swappiness,
1113 }; 1133 };
1134 /*
1135 * temp_priority is used to remember the scanning priority at which
1136 * this zone was successfully refilled to free_pages == pages_high.
1137 */
1138 int temp_priority[MAX_NR_ZONES];
1114 1139
1115loop_again: 1140loop_again:
1116 total_scanned = 0; 1141 total_scanned = 0;
@@ -1118,11 +1143,8 @@ loop_again:
1118 sc.may_writepage = !laptop_mode; 1143 sc.may_writepage = !laptop_mode;
1119 count_vm_event(PAGEOUTRUN); 1144 count_vm_event(PAGEOUTRUN);
1120 1145
1121 for (i = 0; i < pgdat->nr_zones; i++) { 1146 for (i = 0; i < pgdat->nr_zones; i++)
1122 struct zone *zone = pgdat->node_zones + i; 1147 temp_priority[i] = DEF_PRIORITY;
1123
1124 zone->temp_priority = DEF_PRIORITY;
1125 }
1126 1148
1127 for (priority = DEF_PRIORITY; priority >= 0; priority--) { 1149 for (priority = DEF_PRIORITY; priority >= 0; priority--) {
1128 int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */ 1150 int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */
@@ -1183,10 +1205,9 @@ scan:
1183 if (!zone_watermark_ok(zone, order, zone->pages_high, 1205 if (!zone_watermark_ok(zone, order, zone->pages_high,
1184 end_zone, 0)) 1206 end_zone, 0))
1185 all_zones_ok = 0; 1207 all_zones_ok = 0;
1186 zone->temp_priority = priority; 1208 temp_priority[i] = priority;
1187 if (zone->prev_priority > priority)
1188 zone->prev_priority = priority;
1189 sc.nr_scanned = 0; 1209 sc.nr_scanned = 0;
1210 note_zone_scanning_priority(zone, priority);
1190 nr_reclaimed += shrink_zone(priority, zone, &sc); 1211 nr_reclaimed += shrink_zone(priority, zone, &sc);
1191 reclaim_state->reclaimed_slab = 0; 1212 reclaim_state->reclaimed_slab = 0;
1192 nr_slab = shrink_slab(sc.nr_scanned, GFP_KERNEL, 1213 nr_slab = shrink_slab(sc.nr_scanned, GFP_KERNEL,
@@ -1226,10 +1247,15 @@ scan:
1226 break; 1247 break;
1227 } 1248 }
1228out: 1249out:
1250 /*
1251 * Note within each zone the priority level at which this zone was
1252 * brought into a happy state. So that the next thread which scans this
1253 * zone will start out at that priority level.
1254 */
1229 for (i = 0; i < pgdat->nr_zones; i++) { 1255 for (i = 0; i < pgdat->nr_zones; i++) {
1230 struct zone *zone = pgdat->node_zones + i; 1256 struct zone *zone = pgdat->node_zones + i;
1231 1257
1232 zone->prev_priority = zone->temp_priority; 1258 zone->prev_priority = temp_priority[i];
1233 } 1259 }
1234 if (!all_zones_ok) { 1260 if (!all_zones_ok) {
1235 cond_resched(); 1261 cond_resched();
@@ -1358,7 +1384,7 @@ static unsigned long shrink_all_zones(unsigned long nr_pages, int pass,
1358 if (zone->nr_scan_active >= nr_pages || pass > 3) { 1384 if (zone->nr_scan_active >= nr_pages || pass > 3) {
1359 zone->nr_scan_active = 0; 1385 zone->nr_scan_active = 0;
1360 nr_to_scan = min(nr_pages, zone->nr_active); 1386 nr_to_scan = min(nr_pages, zone->nr_active);
1361 shrink_active_list(nr_to_scan, zone, sc); 1387 shrink_active_list(nr_to_scan, zone, sc, prio);
1362 } 1388 }
1363 } 1389 }
1364 1390
@@ -1614,6 +1640,7 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
1614 */ 1640 */
1615 priority = ZONE_RECLAIM_PRIORITY; 1641 priority = ZONE_RECLAIM_PRIORITY;
1616 do { 1642 do {
1643 note_zone_scanning_priority(zone, priority);
1617 nr_reclaimed += shrink_zone(priority, zone, &sc); 1644 nr_reclaimed += shrink_zone(priority, zone, &sc);
1618 priority--; 1645 priority--;
1619 } while (priority >= 0 && nr_reclaimed < nr_pages); 1646 } while (priority >= 0 && nr_reclaimed < nr_pages);
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 45b124e012f5..8614e8f6743b 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -587,11 +587,9 @@ static int zoneinfo_show(struct seq_file *m, void *arg)
587 seq_printf(m, 587 seq_printf(m,
588 "\n all_unreclaimable: %u" 588 "\n all_unreclaimable: %u"
589 "\n prev_priority: %i" 589 "\n prev_priority: %i"
590 "\n temp_priority: %i"
591 "\n start_pfn: %lu", 590 "\n start_pfn: %lu",
592 zone->all_unreclaimable, 591 zone->all_unreclaimable,
593 zone->prev_priority, 592 zone->prev_priority,
594 zone->temp_priority,
595 zone->zone_start_pfn); 593 zone->zone_start_pfn);
596 spin_unlock_irqrestore(&zone->lock, flags); 594 spin_unlock_irqrestore(&zone->lock, flags);
597 seq_putc(m, '\n'); 595 seq_putc(m, '\n');