Re: iptables very slow after commit 784544739a25c30637397ace5489eeb6e15d7d49

Linus Torvalds
2009-04-11T18:00:16Z

On Sat, 11 Apr 2009, Jan Engelhardt wrote:
>
> iptables works in whole tables.

Not really.

Yes, iptables as a single command works in whole tables.

USERS, on the other hand, often work in multiple iptables commands, ie
they just add things to the tables. And in fact, I think this is the exact
workload that Jeff complains about - doing two hundred "update table"
commands.

> Userspace submits a table, checkentry is called for all rules in the new
> table, things are swapped, then destroy is called for all rules in the
> old table. By that logic (which existed since dawn I think), only the
> swap operation needs to be locked.

The problem is, the new code makes the "wait after swap" thing happen
after every switch. And if you do two hundred "update table" commands, you
now take a _long_ time to update.

Sure, you could tell people to just do everything as one single table
update, but that isn't what they do.

Linus