}
 EXPORT_SYMBOL(nexthop_res_grp_activity_update);
 
-static void __net_exit nexthop_net_exit(struct net *net)
+static void __net_exit nexthop_net_exit_batch(struct list_head *net_list)
 {
+       struct net *net;
+
        rtnl_lock();
-       flush_all_nexthops(net);
+       list_for_each_entry(net, net_list, exit_list) {
+               flush_all_nexthops(net);
+               kfree(net->nexthop.devhash);
+       }
        rtnl_unlock();
-       kfree(net->nexthop.devhash);
 }
 
 static int __net_init nexthop_net_init(struct net *net)
 
 static struct pernet_operations nexthop_net_ops = {
        .init = nexthop_net_init,
-       .exit = nexthop_net_exit,
+       .exit_batch = nexthop_net_exit_batch,
 };
 
 static int __init nexthop_init(void)