diff options
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 40169f0b7e9e..3c0f69ded6b5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -724,6 +724,14 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark, | |||
724 | return 1; | 724 | return 1; |
725 | } | 725 | } |
726 | 726 | ||
727 | static inline int | ||
728 | should_reclaim_zone(struct zone *z, unsigned int gfp_mask) | ||
729 | { | ||
730 | if (!z->reclaim_pages) | ||
731 | return 0; | ||
732 | return 1; | ||
733 | } | ||
734 | |||
727 | /* | 735 | /* |
728 | * This is the 'heart' of the zoned buddy allocator. | 736 | * This is the 'heart' of the zoned buddy allocator. |
729 | */ | 737 | */ |
@@ -760,17 +768,32 @@ __alloc_pages(unsigned int __nocast gfp_mask, unsigned int order, | |||
760 | 768 | ||
761 | classzone_idx = zone_idx(zones[0]); | 769 | classzone_idx = zone_idx(zones[0]); |
762 | 770 | ||
763 | restart: | 771 | restart: |
764 | /* Go through the zonelist once, looking for a zone with enough free */ | 772 | /* Go through the zonelist once, looking for a zone with enough free */ |
765 | for (i = 0; (z = zones[i]) != NULL; i++) { | 773 | for (i = 0; (z = zones[i]) != NULL; i++) { |
766 | 774 | int do_reclaim = should_reclaim_zone(z, gfp_mask); | |
767 | if (!zone_watermark_ok(z, order, z->pages_low, | ||
768 | classzone_idx, 0, 0)) | ||
769 | continue; | ||
770 | 775 | ||
771 | if (!cpuset_zone_allowed(z)) | 776 | if (!cpuset_zone_allowed(z)) |
772 | continue; | 777 | continue; |
773 | 778 | ||
779 | /* | ||
780 | * If the zone is to attempt early page reclaim then this loop | ||
781 | * will try to reclaim pages and check the watermark a second | ||
782 | * time before giving up and falling back to the next zone. | ||
783 | */ | ||
784 | zone_reclaim_retry: | ||
785 | if (!zone_watermark_ok(z, order, z->pages_low, | ||
786 | classzone_idx, 0, 0)) { | ||
787 | if (!do_reclaim) | ||
788 | continue; | ||
789 | else { | ||
790 | zone_reclaim(z, gfp_mask, order); | ||
791 | /* Only try reclaim once */ | ||
792 | do_reclaim = 0; | ||
793 | goto zone_reclaim_retry; | ||
794 | } | ||
795 | } | ||
796 | |||
774 | page = buffered_rmqueue(z, order, gfp_mask); | 797 | page = buffered_rmqueue(z, order, gfp_mask); |
775 | if (page) | 798 | if (page) |
776 | goto got_pg; | 799 | goto got_pg; |