summaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorVlastimil Babka <vbabka@suse.cz>2017-07-06 18:40:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-06 19:24:34 -0400
commit04ec6264f28793e56114d0a367bb4d3af667ab6a (patch)
treeb20688e500f325ad1aab00398a56da78bcc8b911 /mm/page_alloc.c
parent45816682b2cd6771cf63cb7dc7dbebdd827a0132 (diff)
mm, page_alloc: pass preferred nid instead of zonelist to allocator
The main allocator function __alloc_pages_nodemask() takes a zonelist pointer as one of its parameters. All of its callers directly or indirectly obtain the zonelist via node_zonelist() using a preferred node id and gfp_mask. We can make the code a bit simpler by doing the zonelist lookup in __alloc_pages_nodemask(), passing it a preferred node id instead (gfp_mask is already another parameter). There are some code size benefits thanks to removal of inlined node_zonelist(): bloat-o-meter add/remove: 2/2 grow/shrink: 4/36 up/down: 399/-1351 (-952) This will also make things simpler if we proceed with converting cpusets to zonelists. Link: http://lkml.kernel.org/r/20170517081140.30654-4-vbabka@suse.cz Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Reviewed-by: Christoph Lameter <cl@linux.com> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Dimitri Sivanich <sivanich@sgi.com> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Anshuman Khandual <khandual@linux.vnet.ibm.com> Cc: David Rientjes <rientjes@google.com> Cc: Hugh Dickins <hughd@google.com> Cc: Li Zefan <lizefan@huawei.com> Cc: Mel Gorman <mgorman@techsingularity.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.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 019af778ec55..8aa860017d66 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3980,12 +3980,12 @@ got_pg:
3980} 3980}
3981 3981
3982static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order, 3982static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order,
3983 struct zonelist *zonelist, nodemask_t *nodemask, 3983 int preferred_nid, nodemask_t *nodemask,
3984 struct alloc_context *ac, gfp_t *alloc_mask, 3984 struct alloc_context *ac, gfp_t *alloc_mask,
3985 unsigned int *alloc_flags) 3985 unsigned int *alloc_flags)
3986{ 3986{
3987 ac->high_zoneidx = gfp_zone(gfp_mask); 3987 ac->high_zoneidx = gfp_zone(gfp_mask);
3988 ac->zonelist = zonelist; 3988 ac->zonelist = node_zonelist(preferred_nid, gfp_mask);
3989 ac->nodemask = nodemask; 3989 ac->nodemask = nodemask;
3990 ac->migratetype = gfpflags_to_migratetype(gfp_mask); 3990 ac->migratetype = gfpflags_to_migratetype(gfp_mask);
3991 3991
@@ -4030,8 +4030,8 @@ static inline void finalise_ac(gfp_t gfp_mask,
4030 * This is the 'heart' of the zoned buddy allocator. 4030 * This is the 'heart' of the zoned buddy allocator.
4031 */ 4031 */
4032struct page * 4032struct page *
4033__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, 4033__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid,
4034 struct zonelist *zonelist, nodemask_t *nodemask) 4034 nodemask_t *nodemask)
4035{ 4035{
4036 struct page *page; 4036 struct page *page;
4037 unsigned int alloc_flags = ALLOC_WMARK_LOW; 4037 unsigned int alloc_flags = ALLOC_WMARK_LOW;
@@ -4039,7 +4039,7 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
4039 struct alloc_context ac = { }; 4039 struct alloc_context ac = { };
4040 4040
4041 gfp_mask &= gfp_allowed_mask; 4041 gfp_mask &= gfp_allowed_mask;
4042 if (!prepare_alloc_pages(gfp_mask, order, zonelist, nodemask, &ac, &alloc_mask, &alloc_flags)) 4042 if (!prepare_alloc_pages(gfp_mask, order, preferred_nid, nodemask, &ac, &alloc_mask, &alloc_flags))
4043 return NULL; 4043 return NULL;
4044 4044
4045 finalise_ac(gfp_mask, order, &ac); 4045 finalise_ac(gfp_mask, order, &ac);