net: introduce common dev_page_is_reusable()
authorAlexander Lobakin <alobakin@pm.me>
Tue, 2 Feb 2021 13:31:21 +0000 (13:31 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 5 Feb 2021 02:20:14 +0000 (18:20 -0800)
commitff6c05cdc8133a179a76f53610e20584b6fd359e
treef9c798db94e324b4b2b08efbf69b1764961075e6
parentbc2f1dc84f322f7999c7ae1a44dced149c945b1a
net: introduce common dev_page_is_reusable()

A bunch of drivers test the page before reusing/recycling for two
common conditions:
 - if a page was allocated under memory pressure (pfmemalloc page);
 - if a page was allocated at a distant memory node (to exclude
   slowdowns).

Introduce a new common inline for doing this, with likely() already
folded inside to make driver code a bit simpler.

Suggested-by: David Rientjes <rientjes@google.com>
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Cc: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/skbuff.h