• Hugh Dickins's avatar
    ksm: allocate roots when needed · ef53d16c
    Hugh Dickins authored
    It is a pity to have MAX_NUMNODES+MAX_NUMNODES tree roots statically
    allocated, particularly when very few users will ever actually tune
    merge_across_nodes 0 to use more than 1+1 of those trees.  Not a big
    deal (only 16kB wasted on each machine with CONFIG_MAXSMP), but a pity.
    
    Start off with 1+1 statically allocated, then if merge_across_nodes is
    ever tuned, allocate for nr_node_ids+nr_node_ids.  Do not attempt to
    free up the extra if it's tuned back, that would be a waste of effort.
    Signed-off-by: default avatarHugh Dickins <hughd@google.com>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Petr Holasek <pholasek@redhat.com>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Izik Eidus <izik.eidus@ravellosystems.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    ef53d16c
ksm.c 66 KB