• Eric Dumazet's avatar
    mlx4_core: restore optimal ICM memory allocation · 885892fb
    Eric Dumazet authored
    Commit 1383cb81 ("mlx4_core: allocate ICM memory in page size chunks")
    brought two regressions caught in our regression suite.
    
    The big one is an additional cost of 256 bytes of overhead per 4096 bytes,
    or 6.25 % which is unacceptable since ICM can be pretty large.
    
    This comes from having to allocate one struct mlx4_icm_chunk (256 bytes)
    per MLX4_TABLE_CHUNK, which the buggy commit shrank to 4KB
    (instead of prior 256KB)
    
    Note that mlx4_alloc_icm() is already able to try high order allocations
    and fallback to low-order allocations under high memory pressure.
    
    Most of these allocations happen right after boot time, when we get
    plenty of non fragmented memory, there is really no point being so
    pessimistic and break huge pages into order-0 ones just for fun.
    
    We only have to tweak gfp_mask a bit, to help falling back faster,
    without risking OOM killings.
    
    Second regression is an KASAN fault, that will need further investigations.
    
    Fixes: 1383cb81 ("mlx4_core: allocate ICM memory in page size chunks")
    Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
    Acked-by: default avatarTariq Toukan <tariqt@mellanox.com>
    Cc: John Sperbeck <jsperbeck@google.com>
    Cc: Tarick Bedeir <tarick@google.com>
    Cc: Qing Huang <qing.huang@oracle.com>
    Cc: Daniel Jurgens <danielj@mellanox.com>
    Cc: Zhu Yanjun <yanjun.zhu@oracle.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    885892fb
icm.c 11.4 KB