diff mbox series

[net-next,v4,7/8] net: netmem: add netmem_is_pfmemalloc() helper function

Message ID 20241022162359.2713094-8-ap420073@gmail.com (mailing list archive)
State New
Delegated to: Netdev Maintainers
Headers show
Series bnxt_en: implement device memory TCP for bnxt | expand

Commit Message

Taehee Yoo Oct. 22, 2024, 4:23 p.m. UTC
The netmem_is_pfmemalloc() is a netmem version of page_is_pfmemalloc().

Tested-by: Stanislav Fomichev <sdf@fomichev.me>
Suggested-by: Mina Almasry <almasrymina@google.com>
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---

v4:
 - Patch added.

 include/net/netmem.h | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/include/net/netmem.h b/include/net/netmem.h
index 8a6e20be4b9d..49ae2bf05362 100644
--- a/include/net/netmem.h
+++ b/include/net/netmem.h
@@ -171,4 +171,12 @@  static inline unsigned long netmem_get_dma_addr(netmem_ref netmem)
 	return __netmem_clear_lsb(netmem)->dma_addr;
 }
 
+static inline bool netmem_is_pfmemalloc(netmem_ref netmem)
+{
+	if (netmem_is_net_iov(netmem))
+		return false;
+
+	return page_is_pfmemalloc(netmem_to_page(netmem));
+}
+
 #endif /* _NET_NETMEM_H */