Skip to content
  • Vlastimil Babka's avatar
    mm, page_alloc: reduce number of alloc_pages* functions' parameters · a9263751
    Vlastimil Babka authored
    
    
    Introduce struct alloc_context to accumulate the numerous parameters
    passed between the alloc_pages* family of functions and
    get_page_from_freelist().  This excludes gfp_flags and alloc_info, which
    mutate too much along the way, and allocation order, which is conceptually
    different.
    
    The result is shorter function signatures, as well as overal code size and
    stack usage reductions.
    
    bloat-o-meter:
    
    add/remove: 0/0 grow/shrink: 1/2 up/down: 127/-310 (-183)
    function                                     old     new   delta
    get_page_from_freelist                      2525    2652    +127
    __alloc_pages_direct_compact                 329     283     -46
    __alloc_pages_nodemask                      2564    2300    -264
    
    checkstack.pl:
    
    function                            old    new
    __alloc_pages_nodemask              248    200
    get_page_from_freelist              168    184
    __alloc_pages_direct_compact         40     24
    
    Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
    Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
    Cc: Minchan Kim <minchan@kernel.org>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
    Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    a9263751