mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
net: dummy: do not acquire RTNL for too long
Instead of holding RTNL for an arbitrary amount of time, call register_netdev() for each dummy device created at module loading time. Tested: modprobe dummy numdummies=10000 Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20260427091016.737015-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
790ead9394
commit
bed510e440
|
|
@ -158,7 +158,7 @@ static int __init dummy_init_one(void)
|
|||
return -ENOMEM;
|
||||
|
||||
dev_dummy->rtnl_link_ops = &dummy_link_ops;
|
||||
err = register_netdevice(dev_dummy);
|
||||
err = register_netdev(dev_dummy);
|
||||
if (err < 0)
|
||||
goto err;
|
||||
return 0;
|
||||
|
|
@ -176,15 +176,11 @@ static int __init dummy_init_module(void)
|
|||
if (err < 0)
|
||||
return err;
|
||||
|
||||
rtnl_net_lock(&init_net);
|
||||
|
||||
for (i = 0; i < numdummies && !err; i++) {
|
||||
err = dummy_init_one();
|
||||
cond_resched();
|
||||
}
|
||||
|
||||
rtnl_net_unlock(&init_net);
|
||||
|
||||
if (err < 0)
|
||||
rtnl_link_unregister(&dummy_link_ops);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user