diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2005-12-05 10:48:41 -0500 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-12-05 10:48:41 -0500 |
commit | 292d4ed32e35df4755052b5002e533348d1648fd (patch) | |
tree | 8522e6bab962696bd25a6c02fb068c674a09b7ee /mm/page_alloc.c | |
parent | 3c6af7fa787f21f8873a050568ed892312899eb5 (diff) | |
parent | e4f5c82a92c2a546a16af1614114eec19120e40a (diff) |
Merge branch 'master' of /usr/src/ntfs-2.6/
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 1731236dec35..3b21a13d841c 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -773,9 +773,12 @@ again: | |||
773 | } | 773 | } |
774 | 774 | ||
775 | #define ALLOC_NO_WATERMARKS 0x01 /* don't check watermarks at all */ | 775 | #define ALLOC_NO_WATERMARKS 0x01 /* don't check watermarks at all */ |
776 | #define ALLOC_HARDER 0x02 /* try to alloc harder */ | 776 | #define ALLOC_WMARK_MIN 0x02 /* use pages_min watermark */ |
777 | #define ALLOC_HIGH 0x04 /* __GFP_HIGH set */ | 777 | #define ALLOC_WMARK_LOW 0x04 /* use pages_low watermark */ |
778 | #define ALLOC_CPUSET 0x08 /* check for correct cpuset */ | 778 | #define ALLOC_WMARK_HIGH 0x08 /* use pages_high watermark */ |
779 | #define ALLOC_HARDER 0x10 /* try to alloc harder */ | ||
780 | #define ALLOC_HIGH 0x20 /* __GFP_HIGH set */ | ||
781 | #define ALLOC_CPUSET 0x40 /* check for correct cpuset */ | ||
779 | 782 | ||
780 | /* | 783 | /* |
781 | * Return 1 if free pages are above 'mark'. This takes into account the order | 784 | * Return 1 if free pages are above 'mark'. This takes into account the order |
@@ -830,7 +833,14 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, | |||
830 | continue; | 833 | continue; |
831 | 834 | ||
832 | if (!(alloc_flags & ALLOC_NO_WATERMARKS)) { | 835 | if (!(alloc_flags & ALLOC_NO_WATERMARKS)) { |
833 | if (!zone_watermark_ok(*z, order, (*z)->pages_low, | 836 | unsigned long mark; |
837 | if (alloc_flags & ALLOC_WMARK_MIN) | ||
838 | mark = (*z)->pages_min; | ||
839 | else if (alloc_flags & ALLOC_WMARK_LOW) | ||
840 | mark = (*z)->pages_low; | ||
841 | else | ||
842 | mark = (*z)->pages_high; | ||
843 | if (!zone_watermark_ok(*z, order, mark, | ||
834 | classzone_idx, alloc_flags)) | 844 | classzone_idx, alloc_flags)) |
835 | continue; | 845 | continue; |
836 | } | 846 | } |
@@ -871,7 +881,7 @@ restart: | |||
871 | } | 881 | } |
872 | 882 | ||
873 | page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, order, | 883 | page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, order, |
874 | zonelist, ALLOC_CPUSET); | 884 | zonelist, ALLOC_WMARK_LOW|ALLOC_CPUSET); |
875 | if (page) | 885 | if (page) |
876 | goto got_pg; | 886 | goto got_pg; |
877 | 887 | ||
@@ -888,7 +898,7 @@ restart: | |||
888 | * cannot run direct reclaim, or if the caller has realtime scheduling | 898 | * cannot run direct reclaim, or if the caller has realtime scheduling |
889 | * policy. | 899 | * policy. |
890 | */ | 900 | */ |
891 | alloc_flags = 0; | 901 | alloc_flags = ALLOC_WMARK_MIN; |
892 | if ((unlikely(rt_task(p)) && !in_interrupt()) || !wait) | 902 | if ((unlikely(rt_task(p)) && !in_interrupt()) || !wait) |
893 | alloc_flags |= ALLOC_HARDER; | 903 | alloc_flags |= ALLOC_HARDER; |
894 | if (gfp_mask & __GFP_HIGH) | 904 | if (gfp_mask & __GFP_HIGH) |
@@ -959,7 +969,7 @@ rebalance: | |||
959 | * under heavy pressure. | 969 | * under heavy pressure. |
960 | */ | 970 | */ |
961 | page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, order, | 971 | page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, order, |
962 | zonelist, ALLOC_CPUSET); | 972 | zonelist, ALLOC_WMARK_HIGH|ALLOC_CPUSET); |
963 | if (page) | 973 | if (page) |
964 | goto got_pg; | 974 | goto got_pg; |
965 | 975 | ||
@@ -1762,16 +1772,16 @@ static int __devinit zone_batchsize(struct zone *zone) | |||
1762 | batch = 1; | 1772 | batch = 1; |
1763 | 1773 | ||
1764 | /* | 1774 | /* |
1765 | * We will be trying to allcoate bigger chunks of contiguous | 1775 | * Clamp the batch to a 2^n - 1 value. Having a power |
1766 | * memory of the order of fls(batch). This should result in | 1776 | * of 2 value was found to be more likely to have |
1767 | * better cache coloring. | 1777 | * suboptimal cache aliasing properties in some cases. |
1768 | * | 1778 | * |
1769 | * A sanity check also to ensure that batch is still in limits. | 1779 | * For example if 2 tasks are alternately allocating |
1780 | * batches of pages, one task can end up with a lot | ||
1781 | * of pages of one half of the possible page colors | ||
1782 | * and the other with pages of the other colors. | ||
1770 | */ | 1783 | */ |
1771 | batch = (1 << fls(batch + batch/2)); | 1784 | batch = (1 << (fls(batch + batch/2)-1)) - 1; |
1772 | |||
1773 | if (fls(batch) >= (PAGE_SHIFT + MAX_ORDER - 2)) | ||
1774 | batch = PAGE_SHIFT + ((MAX_ORDER - 1 - PAGE_SHIFT)/2); | ||
1775 | 1785 | ||
1776 | return batch; | 1786 | return batch; |
1777 | } | 1787 | } |