Message ID | 20230105214631.3939268-3-willy@infradead.org (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Split netmem from struct page | expand |
Hi Matthew, I love your patch! Perhaps something to improve: [auto build test WARNING on bpf-next/master] [also build test WARNING on bpf/master net/master net-next/master linus/master v6.2-rc2 next-20230105] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Matthew-Wilcox-Oracle/netmem-Create-new-type/20230106-054852 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master patch link: https://lore.kernel.org/r/20230105214631.3939268-3-willy%40infradead.org patch subject: [PATCH v2 02/24] netmem: Add utility functions config: arm-randconfig-r014-20230105 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 8d9828ef5aa9688500657d36cd2aefbe12bbd162) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm cross compiling tool for clang build # apt-get install binutils-arm-linux-gnueabi # https://github.com/intel-lab-lkp/linux/commit/167a5c35da10f97c077af525e9f537fab4438b94 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Matthew-Wilcox-Oracle/netmem-Create-new-type/20230106-054852 git checkout 167a5c35da10f97c077af525e9f537fab4438b94 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash kernel/ net/core/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): kernel/fork.c:162:13: warning: no previous prototype for function 'arch_release_task_struct' [-Wmissing-prototypes] void __weak arch_release_task_struct(struct task_struct *tsk) ^ kernel/fork.c:162:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void __weak arch_release_task_struct(struct task_struct *tsk) ^ static kernel/fork.c:862:20: warning: no previous prototype for function 'arch_task_cache_init' [-Wmissing-prototypes] void __init __weak arch_task_cache_init(void) { } ^ kernel/fork.c:862:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void __init __weak arch_task_cache_init(void) { } ^ static kernel/fork.c:957:12: warning: no previous prototype for function 'arch_dup_task_struct' [-Wmissing-prototypes] int __weak arch_dup_task_struct(struct task_struct *dst, ^ kernel/fork.c:957:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int __weak arch_dup_task_struct(struct task_struct *dst, ^ static In file included from kernel/fork.c:1087: In file included from include/linux/init_task.h:18: In file included from include/net/net_namespace.h:43: In file included from include/linux/skbuff.h:41: >> include/net/page_pool.h:111:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_pfn(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:116:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_nid(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:126:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_virt(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:131:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_address(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:136:24: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_ref_count(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ 8 warnings generated. -- In file included from kernel/exit.c:55: In file included from include/linux/init_task.h:18: In file included from include/net/net_namespace.h:43: In file included from include/linux/skbuff.h:41: >> include/net/page_pool.h:111:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_pfn(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:116:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_nid(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:126:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_virt(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:131:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_address(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:136:24: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_ref_count(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ 5 warnings generated. -- In file included from kernel/kallsyms.c:25: In file included from include/linux/filter.h:12: In file included from include/linux/skbuff.h:41: >> include/net/page_pool.h:111:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_pfn(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:116:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_nid(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:126:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_virt(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:131:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_address(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:136:24: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_ref_count(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ kernel/kallsyms.c:663:12: warning: no previous prototype for function 'arch_get_kallsym' [-Wmissing-prototypes] int __weak arch_get_kallsym(unsigned int symnum, unsigned long *value, ^ kernel/kallsyms.c:663:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int __weak arch_get_kallsym(unsigned int symnum, unsigned long *value, ^ static 6 warnings generated. -- In file included from net/core/flow_dissector.c:3: In file included from include/linux/skbuff.h:41: >> include/net/page_pool.h:111:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_pfn(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:116:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_nid(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:126:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_virt(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:131:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_address(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:136:24: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_ref_count(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ In file included from net/core/flow_dissector.c:21: In file included from include/linux/if_pppox.h:17: include/uapi/linux/if_pppox.h:71:4: warning: field sa_addr within 'struct sockaddr_pppox' is less aligned than 'union (unnamed union at include/uapi/linux/if_pppox.h:68:2)' and is usually due to 'struct sockaddr_pppox' being packed, which can lead to unaligned accesses [-Wunaligned-access] } sa_addr; ^ 6 warnings generated. -- In file included from net/core/dev.c:89: In file included from include/linux/if_ether.h:19: In file included from include/linux/skbuff.h:41: >> include/net/page_pool.h:111:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_pfn(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:116:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_nid(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:126:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_virt(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:131:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_address(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:136:24: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_ref_count(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ net/core/dev.c:5098:1: warning: unused function 'sch_handle_ingress' [-Wunused-function] sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret, ^ net/core/dev.c:5251:19: warning: unused function 'nf_ingress' [-Wunused-function] static inline int nf_ingress(struct sk_buff *skb, struct packet_type **pt_prev, ^ 7 warnings generated. -- In file included from kernel/sched/core.c:44: In file included from include/linux/init_task.h:18: In file included from include/net/net_namespace.h:43: In file included from include/linux/skbuff.h:41: >> include/net/page_pool.h:111:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_pfn(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:116:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_nid(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:126:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_virt(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:131:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_address(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:136:24: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_ref_count(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ kernel/sched/core.c:6664:35: warning: no previous prototype for function 'schedule_user' [-Wmissing-prototypes] asmlinkage __visible void __sched schedule_user(void) ^ kernel/sched/core.c:6664:22: note: declare 'static' if the function is not intended to be used outside of this translation unit asmlinkage __visible void __sched schedule_user(void) ^ static kernel/sched/core.c:3579:20: warning: unused function 'rq_has_pinned_tasks' [-Wunused-function] static inline bool rq_has_pinned_tasks(struct rq *rq) ^ kernel/sched/core.c:5673:20: warning: unused function 'sched_tick_start' [-Wunused-function] static inline void sched_tick_start(int cpu) { } ^ kernel/sched/core.c:5674:20: warning: unused function 'sched_tick_stop' [-Wunused-function] static inline void sched_tick_stop(int cpu) { } ^ kernel/sched/core.c:6367:20: warning: unused function 'sched_core_cpu_starting' [-Wunused-function] static inline void sched_core_cpu_starting(unsigned int cpu) {} ^ kernel/sched/core.c:6368:20: warning: unused function 'sched_core_cpu_deactivate' [-Wunused-function] static inline void sched_core_cpu_deactivate(unsigned int cpu) {} ^ kernel/sched/core.c:6369:20: warning: unused function 'sched_core_cpu_dying' [-Wunused-function] static inline void sched_core_cpu_dying(unsigned int cpu) {} ^ 12 warnings generated. -- In file included from kernel/bpf/core.c:21: In file included from include/linux/filter.h:12: In file included from include/linux/skbuff.h:41: >> include/net/page_pool.h:111:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_pfn(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:116:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_nid(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:126:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_to_virt(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:131:22: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_address(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ include/net/page_pool.h:136:24: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] return page_ref_count(netmem_page(nmem)); ^ include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' const struct netmem: (const struct page *)nmem, \ ^ kernel/bpf/core.c:1630:12: warning: no previous prototype for function 'bpf_probe_read_kernel' [-Wmissing-prototypes] u64 __weak bpf_probe_read_kernel(void *dst, u32 size, const void *unsafe_ptr) ^ kernel/bpf/core.c:1630:1: note: declare 'static' if the function is not intended to be used outside of this translation unit u64 __weak bpf_probe_read_kernel(void *dst, u32 size, const void *unsafe_ptr) ^ static kernel/bpf/core.c:2069:6: warning: no previous prototype for function 'bpf_patch_call_args' [-Wmissing-prototypes] void bpf_patch_call_args(struct bpf_insn *insn, u32 stack_depth) ^ kernel/bpf/core.c:2069:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void bpf_patch_call_args(struct bpf_insn *insn, u32 stack_depth) ^ static 7 warnings generated. vim +111 include/net/page_pool.h 108 109 static inline unsigned long netmem_pfn(const struct netmem *nmem) 110 { > 111 return page_to_pfn(netmem_page(nmem)); 112 } 113
On 05/01/2023 22.46, Matthew Wilcox (Oracle) wrote: > netmem_page() is defined this way to preserve constness. page_netmem() > doesn't call compound_head() because netmem users always use the head > page; it does include a debugging assert to check that it's true. > > Signed-off-by: Matthew Wilcox (Oracle)<willy@infradead.org> > --- > include/net/page_pool.h | 59 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 59 insertions(+) Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
On Fri, Jan 06, 2023 at 10:24:30AM +0800, kernel test robot wrote: > >> include/net/page_pool.h:111:21: warning: due to lvalue conversion of the controlling expression, association of type 'const struct netmem' will never be selected because it is qualified [-Wunreachable-code-generic-assoc] > return page_to_pfn(netmem_page(nmem)); > ^ > include/net/page_pool.h:100:8: note: expanded from macro 'netmem_page' > const struct netmem: (const struct page *)nmem, \ > ^ OK, figured out what this error means. #define netmem_page(nmem) (_Generic((*nmem), \ const struct netmem: (const struct page *)nmem, \ struct netmem: (struct page *)nmem)) Because I defined this with _Generic((*nmem),...) instead of _Generic((nmem),...) (like page_folio() is defined), clang always selects the second case and not the const case. Apparently lvalue coversions remove the const (backed up by https://en.cppreference.com/w/c/language/conversion) but I had no idea that _Generic applied lvalue conversion to the controlling-expression (it does! https://en.cppreference.com/w/c/language/generic) So, yay for clang's extra warning. I'll fix this up (as below) and send a v3 next week including the various R-b that I've received. -#define netmem_page(nmem) (_Generic((*nmem), \ - const struct netmem: (const struct page *)nmem, \ - struct netmem: (struct page *)nmem)) +#define netmem_page(nmem) (_Generic((nmem), \ + const struct netmem *: (const struct page *)nmem, \ + struct netmem *: (struct page *)nmem))
diff --git a/include/net/page_pool.h b/include/net/page_pool.h index cbea4df54918..84b4ea8af015 100644 --- a/include/net/page_pool.h +++ b/include/net/page_pool.h @@ -96,6 +96,65 @@ NETMEM_MATCH(_refcount, _refcount); #undef NETMEM_MATCH static_assert(sizeof(struct netmem) <= sizeof(struct page)); +#define netmem_page(nmem) (_Generic((*nmem), \ + const struct netmem: (const struct page *)nmem, \ + struct netmem: (struct page *)nmem)) + +static inline struct netmem *page_netmem(struct page *page) +{ + VM_BUG_ON_PAGE(PageTail(page), page); + return (struct netmem *)page; +} + +static inline unsigned long netmem_pfn(const struct netmem *nmem) +{ + return page_to_pfn(netmem_page(nmem)); +} + +static inline unsigned long netmem_nid(const struct netmem *nmem) +{ + return page_to_nid(netmem_page(nmem)); +} + +static inline struct netmem *virt_to_netmem(const void *x) +{ + return page_netmem(virt_to_head_page(x)); +} + +static inline void *netmem_to_virt(const struct netmem *nmem) +{ + return page_to_virt(netmem_page(nmem)); +} + +static inline void *netmem_address(const struct netmem *nmem) +{ + return page_address(netmem_page(nmem)); +} + +static inline int netmem_ref_count(const struct netmem *nmem) +{ + return page_ref_count(netmem_page(nmem)); +} + +static inline void netmem_get(struct netmem *nmem) +{ + struct folio *folio = (struct folio *)nmem; + + folio_get(folio); +} + +static inline void netmem_put(struct netmem *nmem) +{ + struct folio *folio = (struct folio *)nmem; + + folio_put(folio); +} + +static inline bool netmem_is_pfmemalloc(const struct netmem *nmem) +{ + return nmem->pp_magic & BIT(1); +} + /* * Fast allocation side cache array/stack *
netmem_page() is defined this way to preserve constness. page_netmem() doesn't call compound_head() because netmem users always use the head page; it does include a debugging assert to check that it's true. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> --- include/net/page_pool.h | 59 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+)