Re: xfrm_state locking regression...
From: Timo Teräs <hidden>
Date: 2008-09-23 13:01:34
Herbert Xu wrote:
On Tue, Sep 23, 2008 at 03:25:41PM +0300, Timo Teräs wrote:quoted
There can be a lot of xfrm_state structs. As in thousands. So it will take more memory then. hlist would be enough, so it'd be a 4/8 bytes addition. Single pointer would not be enough as we can have multiple walks on the same entry.Right, we need doubly linked lists in the walkers to ease unlinking. But only a single pointer (i.e., an hlist) is needed in xfrm_state.
Right.
quoted
I was thinking about the same. That's why I wasn't so sure if this is better. In practice there aren't many walks active. Maybe we limit the maximum simultaneous walks?That sounds like a hack :)
Yes :)
quoted
But in real life, there is only a one or two walkers if any active. So I would not consider a global update too expensive. But if you think it might become a problem, I'd add an hlist to xfrm_state of walkers referencing that entry.Well in real life dumps don't tend to get suspended either :) In any case, a suspended dump is only going to pin down some memory, while a very long list walk may kill the box.
So, what to do? 1. Go back to: list_del_rcu, xfrm_state_hold(all.next) on delete and xfrm_state_put(all.next) on destruct. 2. Add per-entry hlist of walkers currently referencing it. 3. Use the global walker list. 1 can keep memory allocated until userland wakes up. 2 & 3 can make the delete of that entry slow if there's many walkers suspended. Btw. the current stuff in net-next is broken. There's no locking for xfrm_state_walkers list handling. Cheers, Timo