Subject: Re: Very slow remove interface from kernel

From: Ido Schimmel <[email-masked]>
Date: Tue, 9 May 2023 13:20:20 +0300

On Tue, May 09, 2023 at 11:22:13AM +0300, Martin Zaharinov wrote:
> add vlans : 
> for i in $(seq 2 4094); do ip link add link eth1 name vlan$i type vlan id $i; done
> for i in $(seq 2 4094); do ip link set dev vlan$i up; done
> 
> 
> and after that run : 
> 
> for i in $(seq 2 4094); do ip link del link eth1 name vlan$i type vlan id $i; done
> 
> 
> time for remove for this 4093 vlans is 5-10 min .
> 
> Is there options to make fast this ?

If you know you are going to delete all of them together, then you can
add them to the same group during creation:

for i in $(seq 2 4094); do ip link add link eth1 name vlan$i up group 10 type vlan id $i; done

Then delete the group:

ip link del group 10

IIRC, in the past there was a patchset to allow passing a list of
ifindexes instead of a group number, but it never made its way upstream.