diff options
author | Johannes Weiner <hannes@cmpxchg.org> | 2013-09-11 17:20:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-11 18:57:22 -0400 |
commit | e085dbc52fad8d79fa2245339c84bf3ef0b3a802 (patch) | |
tree | b6793560ebcfd6e878e37dc851ff06a63926fed6 /mm/page_alloc.c | |
parent | 892f795df1eb119b560a3ee5a1ca3f385a852e84 (diff) |
mm: page_alloc: rearrange watermark checking in get_page_from_freelist
Allocations that do not have to respect the watermarks are rare
high-priority events. Reorder the code such that per-zone dirty limits
and future checks important only to regular page allocations are ignored
in these extraordinary situations.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mgorman@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Paul Bolle <paul.bollee@gmail.com>
Tested-by: Zlatko Calusic <zcalusic@bitsync.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 8c68ef13cefa..9884aa0f233a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1889,12 +1889,17 @@ zonelist_scan: | |||
1889 | */ | 1889 | */ |
1890 | for_each_zone_zonelist_nodemask(zone, z, zonelist, | 1890 | for_each_zone_zonelist_nodemask(zone, z, zonelist, |
1891 | high_zoneidx, nodemask) { | 1891 | high_zoneidx, nodemask) { |
1892 | unsigned long mark; | ||
1893 | |||
1892 | if (IS_ENABLED(CONFIG_NUMA) && zlc_active && | 1894 | if (IS_ENABLED(CONFIG_NUMA) && zlc_active && |
1893 | !zlc_zone_worth_trying(zonelist, z, allowednodes)) | 1895 | !zlc_zone_worth_trying(zonelist, z, allowednodes)) |
1894 | continue; | 1896 | continue; |
1895 | if ((alloc_flags & ALLOC_CPUSET) && | 1897 | if ((alloc_flags & ALLOC_CPUSET) && |
1896 | !cpuset_zone_allowed_softwall(zone, gfp_mask)) | 1898 | !cpuset_zone_allowed_softwall(zone, gfp_mask)) |
1897 | continue; | 1899 | continue; |
1900 | BUILD_BUG_ON(ALLOC_NO_WATERMARKS < NR_WMARK); | ||
1901 | if (alloc_flags & ALLOC_NO_WATERMARKS) | ||
1902 | goto try_this_zone; | ||
1898 | /* | 1903 | /* |
1899 | * When allocating a page cache page for writing, we | 1904 | * When allocating a page cache page for writing, we |
1900 | * want to get it from a zone that is within its dirty | 1905 | * want to get it from a zone that is within its dirty |
@@ -1925,16 +1930,11 @@ zonelist_scan: | |||
1925 | (gfp_mask & __GFP_WRITE) && !zone_dirty_ok(zone)) | 1930 | (gfp_mask & __GFP_WRITE) && !zone_dirty_ok(zone)) |
1926 | goto this_zone_full; | 1931 | goto this_zone_full; |
1927 | 1932 | ||
1928 | BUILD_BUG_ON(ALLOC_NO_WATERMARKS < NR_WMARK); | 1933 | mark = zone->watermark[alloc_flags & ALLOC_WMARK_MASK]; |
1929 | if (!(alloc_flags & ALLOC_NO_WATERMARKS)) { | 1934 | if (!zone_watermark_ok(zone, order, mark, |
1930 | unsigned long mark; | 1935 | classzone_idx, alloc_flags)) { |
1931 | int ret; | 1936 | int ret; |
1932 | 1937 | ||
1933 | mark = zone->watermark[alloc_flags & ALLOC_WMARK_MASK]; | ||
1934 | if (zone_watermark_ok(zone, order, mark, | ||
1935 | classzone_idx, alloc_flags)) | ||
1936 | goto try_this_zone; | ||
1937 | |||
1938 | if (IS_ENABLED(CONFIG_NUMA) && | 1938 | if (IS_ENABLED(CONFIG_NUMA) && |
1939 | !did_zlc_setup && nr_online_nodes > 1) { | 1939 | !did_zlc_setup && nr_online_nodes > 1) { |
1940 | /* | 1940 | /* |