ipv6: avoid high order memory allocations for /proc/net/ipv6_route
Subsystems (3)
PATCH 1/2 ipv6: avoid high order memory allocations for /proc/net/ipv6_route
Dumping routes on a system with lots rt6_infos in the fibs causes up to 11-order allocations in seq_file (which fail). While we could switch there to vmalloc we could just implement the streaming interface for /proc/net/ipv6_route. This patch switches /proc/net/ipv6_route from single_open_net to seq_open_net.
loff_t *pos tracks dst entries.
Also kill never used struct rt6_proc_arg and now unused function fib6_clean_all_ro.
--- include/net/ip6_fib.h | 7 +- net/ipv6/ip6_fib.c | 191 +++++++++++++++++++++++++++++++++++++++++++++----- net/ipv6/route.c | 46 +----------- 3 files changed, 176 insertions(+), 68 deletions(-)
include/net/ip6_fib.h +3 -4
@@ -281,10 +281,6 @@ struct fib6_node *fib6_locate(struct fib6_node *root, const struct in6_addr *daddr, int dst_len, const struct in6_addr *saddr, int src_len); -extern void fib6_clean_all_ro (struct net *net, -int (*func)(struct rt6_info *,void *arg), -int prune,void *arg); -extern void fib6_clean_all (struct net *net,int (*func)(struct rt6_info *,void *arg),int prune,void *arg);
@@ -306,6 +302,9 @@ extern void fib6_gc_cleanup(void);extern int fib6_init (void ); +int ipv6_route_open (struct inode *inode, +struct file *file); +#ifdef CONFIG_IPV6_MULTIPLE_TABLES extern int fib6_rules_init (void );extern void fib6_rules_cleanup (void );
net/ipv6/ip6_fib.c +172 -19
200 lines not on this page · raw message
net/ipv6/route.c +1 -45
57 lines not on this page · raw message
Signature · 1 line
1.8.3.1
From: Hannes Frederic Sowa <[email protected]>
Date: Sat, 21 Sep 2013 16:55:59 +0200
Quoted 8 lines
Dumping routes on a system with lots
rt6_infosin the fibs causes up to 11-order allocations inseq_file(which fail). While we could switch there to vmalloc we could just implement the streaming interface for/proc/net/ipv6_route. This patch switches/proc/net/ipv6_routefromsingle_open_nettoseq_open_net.
loff_t*pos tracks dst entries.
Quoted 7 lines
Also kill never used struct
rt6_proc_argand now unused functionfib6_clean_all_ro.Cc Ben Greear <[email protected]>Cc Patrick McHardy <[email protected]>Cc YOSHIFUJI Hideaki <[email protected]>Signed-off-by Hannes Frederic Sowa <[email protected]>
Applied, nice work.