page_frag: unify gfp bits for order 3 page allocation
authorYunsheng Lin <linyunsheng@huawei.com>
Wed, 28 Feb 2024 09:30:09 +0000 (17:30 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 5 Mar 2024 10:38:14 +0000 (11:38 +0100)
commit4bc0d63a23957262b01b5848bd5e1739e98bbf36
tree338d70eb8386b8f128f26b6d01f12dec1f7dc2a7
parent411c5f36805c02c7c412f1ad6bfa4459a1148011
page_frag: unify gfp bits for order 3 page allocation

Currently there seems to be three page frag implementations
which all try to allocate order 3 page, if that fails, it
then fail back to allocate order 0 page, and each of them
all allow order 3 page allocation to fail under certain
condition by using specific gfp bits.

The gfp bits for order 3 page allocation are different
between different implementation, __GFP_NOMEMALLOC is
or'd to forbid access to emergency reserves memory for
__page_frag_cache_refill(), but it is not or'd in other
implementions, __GFP_DIRECT_RECLAIM is masked off to avoid
direct reclaim in vhost_net_page_frag_refill(), but it is
not masked off in __page_frag_cache_refill().

This patch unifies the gfp bits used between different
implementions by or'ing __GFP_NOMEMALLOC and masking off
__GFP_DIRECT_RECLAIM for order 3 page allocation to avoid
possible pressure for mm.

Leave the gfp unifying for page frag implementation in sock.c
for now as suggested by Paolo Abeni.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
CC: Alexander Duyck <alexander.duyck@gmail.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/vhost/net.c
mm/page_alloc.c