diff options
author | Mel Gorman <mgorman@techsingularity.net> | 2016-05-19 20:14:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-19 22:12:14 -0400 |
commit | c33d6c06f60f710f0305ae792773e1c2560e1e51 (patch) | |
tree | 97fc4be2e392b0b5c80f6d7458ab8d3a0e940c48 /include/linux/mmzone.h | |
parent | 48ee5f3696f62496481a8b6d852bcad9b3ebbe37 (diff) |
mm, page_alloc: avoid looking up the first zone in a zonelist twice
The allocator fast path looks up the first usable zone in a zonelist and
then get_page_from_freelist does the same job in the zonelist iterator.
This patch preserves the necessary information.
4.6.0-rc2 4.6.0-rc2
fastmark-v1r20 initonce-v1r20
Min alloc-odr0-1 364.00 ( 0.00%) 359.00 ( 1.37%)
Min alloc-odr0-2 262.00 ( 0.00%) 260.00 ( 0.76%)
Min alloc-odr0-4 214.00 ( 0.00%) 214.00 ( 0.00%)
Min alloc-odr0-8 186.00 ( 0.00%) 186.00 ( 0.00%)
Min alloc-odr0-16 173.00 ( 0.00%) 173.00 ( 0.00%)
Min alloc-odr0-32 165.00 ( 0.00%) 165.00 ( 0.00%)
Min alloc-odr0-64 161.00 ( 0.00%) 162.00 ( -0.62%)
Min alloc-odr0-128 159.00 ( 0.00%) 161.00 ( -1.26%)
Min alloc-odr0-256 168.00 ( 0.00%) 170.00 ( -1.19%)
Min alloc-odr0-512 180.00 ( 0.00%) 181.00 ( -0.56%)
Min alloc-odr0-1024 190.00 ( 0.00%) 190.00 ( 0.00%)
Min alloc-odr0-2048 196.00 ( 0.00%) 196.00 ( 0.00%)
Min alloc-odr0-4096 202.00 ( 0.00%) 202.00 ( 0.00%)
Min alloc-odr0-8192 206.00 ( 0.00%) 205.00 ( 0.49%)
Min alloc-odr0-16384 206.00 ( 0.00%) 205.00 ( 0.49%)
The benefit is negligible and the results are within the noise but each
cycle counts.
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/mmzone.h')
-rw-r--r-- | include/linux/mmzone.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 327f0fa1e1ce..4b28d2f8125e 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -959,13 +959,10 @@ static __always_inline struct zoneref *next_zones_zonelist(struct zoneref *z, | |||
959 | */ | 959 | */ |
960 | static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist, | 960 | static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist, |
961 | enum zone_type highest_zoneidx, | 961 | enum zone_type highest_zoneidx, |
962 | nodemask_t *nodes, | 962 | nodemask_t *nodes) |
963 | struct zone **zone) | ||
964 | { | 963 | { |
965 | struct zoneref *z = next_zones_zonelist(zonelist->_zonerefs, | 964 | return next_zones_zonelist(zonelist->_zonerefs, |
966 | highest_zoneidx, nodes); | 965 | highest_zoneidx, nodes); |
967 | *zone = zonelist_zone(z); | ||
968 | return z; | ||
969 | } | 966 | } |
970 | 967 | ||
971 | /** | 968 | /** |
@@ -980,10 +977,17 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist, | |||
980 | * within a given nodemask | 977 | * within a given nodemask |
981 | */ | 978 | */ |
982 | #define for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, nodemask) \ | 979 | #define for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, nodemask) \ |
983 | for (z = first_zones_zonelist(zlist, highidx, nodemask, &zone); \ | 980 | for (z = first_zones_zonelist(zlist, highidx, nodemask), zone = zonelist_zone(z); \ |
984 | zone; \ | 981 | zone; \ |
985 | z = next_zones_zonelist(++z, highidx, nodemask), \ | 982 | z = next_zones_zonelist(++z, highidx, nodemask), \ |
986 | zone = zonelist_zone(z)) \ | 983 | zone = zonelist_zone(z)) |
984 | |||
985 | #define for_next_zone_zonelist_nodemask(zone, z, zlist, highidx, nodemask) \ | ||
986 | for (zone = z->zone; \ | ||
987 | zone; \ | ||
988 | z = next_zones_zonelist(++z, highidx, nodemask), \ | ||
989 | zone = zonelist_zone(z)) | ||
990 | |||
987 | 991 | ||
988 | /** | 992 | /** |
989 | * for_each_zone_zonelist - helper macro to iterate over valid zones in a zonelist at or below a given zone index | 993 | * for_each_zone_zonelist - helper macro to iterate over valid zones in a zonelist at or below a given zone index |