forked from mirrors/linux
		
	net: add __netdev_alloc_pcpu_stats() to indicate gfp flags
nf_tables may create percpu counters from the packet path through its dynamic set instantiation infrastructure, so we need a way to allocate this through GFP_ATOMIC. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Acked-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									74ec4d55c4
								
							
						
					
					
						commit
						aabc92bbe3
					
				
					 1 changed files with 15 additions and 12 deletions
				
			
		| 
						 | 
					@ -2068,9 +2068,9 @@ struct pcpu_sw_netstats {
 | 
				
			||||||
	struct u64_stats_sync   syncp;
 | 
						struct u64_stats_sync   syncp;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define netdev_alloc_pcpu_stats(type)				\
 | 
					#define __netdev_alloc_pcpu_stats(type, gfp)				\
 | 
				
			||||||
({									\
 | 
					({									\
 | 
				
			||||||
	typeof(type) __percpu *pcpu_stats = alloc_percpu(type); \
 | 
						typeof(type) __percpu *pcpu_stats = alloc_percpu_gfp(type, gfp);\
 | 
				
			||||||
	if (pcpu_stats)	{						\
 | 
						if (pcpu_stats)	{						\
 | 
				
			||||||
		int __cpu;						\
 | 
							int __cpu;						\
 | 
				
			||||||
		for_each_possible_cpu(__cpu) {				\
 | 
							for_each_possible_cpu(__cpu) {				\
 | 
				
			||||||
| 
						 | 
					@ -2082,6 +2082,9 @@ struct pcpu_sw_netstats {
 | 
				
			||||||
	pcpu_stats;							\
 | 
						pcpu_stats;							\
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define netdev_alloc_pcpu_stats(type)					\
 | 
				
			||||||
 | 
						__netdev_alloc_pcpu_stats(type, GFP_KERNEL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <linux/notifier.h>
 | 
					#include <linux/notifier.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* netdevice notifier chain. Please remember to update the rtnetlink
 | 
					/* netdevice notifier chain. Please remember to update the rtnetlink
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue