• Dennis Zhou's avatar
    percpu: add __GFP_NORETRY semantics to the percpu balancing path · 72682b16
    Dennis Zhou authored
    commit 47504ee0 upstream.
    Percpu memory using the vmalloc area based chunk allocator lazily
    populates chunks by first requesting the full virtual address space
    required for the chunk and subsequently adding pages as allocations come
    through. To ensure atomic allocations can succeed, a workqueue item is
    used to maintain a minimum number of empty pages. In certain scenarios,
    such as reported in [1], it is possible that physical memory becomes
    quite scarce which can result in either a rather long time spent trying
    to find free pages or worse, a kernel panic.
    This patch adds support for __GFP_NORETRY and __GFP_NOWARN passing them
    through to the underlying allocators. This should prevent any
    unnecessary panics potentially caused by the workqueue item. The passing
    of gfp around is as additional flags rather than a full set of flags.
    The next patch will change these to caller passed semantics.
    Added const modifier to gfp flags in the balance path.
    Removed an extra whitespace.
    [1] https://lkml.org/lkml/2018/2/12/551Signed-off-by: default avatarDennis Zhou <dennisszhou@gmail.com>
    Suggested-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Reported-by: syzbot+adb03f3f0bb57ce3acda@syzkaller.appspotmail.com
    Acked-by: default avatarChristoph Lameter <cl@linux.com>
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>