mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 14:20:55 +07:00
sctp: optimize the sctp_sysctl_net_register
Here, when the net is init_net, we needn't to kmemdup the ctl_table again. So add a check for net. Also we can save some memory. Signed-off-by: Wang Weidong <wangweidong1@huawei.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
22a1f5140e
commit
efb842c45e
@ -402,7 +402,9 @@ static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write,
|
||||
|
||||
int sctp_sysctl_net_register(struct net *net)
|
||||
{
|
||||
struct ctl_table *table;
|
||||
struct ctl_table *table = sctp_net_table;
|
||||
|
||||
if (!net_eq(net, &init_net)) {
|
||||
int i;
|
||||
|
||||
table = kmemdup(sctp_net_table, sizeof(sctp_net_table), GFP_KERNEL);
|
||||
@ -411,6 +413,7 @@ int sctp_sysctl_net_register(struct net *net)
|
||||
|
||||
for (i = 0; table[i].data; i++)
|
||||
table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp;
|
||||
}
|
||||
|
||||
net->sctp.sysctl_header = register_net_sysctl(net, "net/sctp", table);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user