Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00203563 authored by Al Viro's avatar Al Viro Committed by David S. Miller
Browse files

fib_trie: no need to delay vfree()



Now that vfree() can be called from interrupt contexts, there's no
need to play games with schedule_work() to escape calling vfree()
from RCU callbacks.

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b56141ab
Loading
Loading
Loading
Loading
+2 −11
Original line number Original line Diff line number Diff line
@@ -125,7 +125,6 @@ struct tnode {
	unsigned int empty_children;	/* KEYLENGTH bits needed */
	unsigned int empty_children;	/* KEYLENGTH bits needed */
	union {
	union {
		struct rcu_head rcu;
		struct rcu_head rcu;
		struct work_struct work;
		struct tnode *tnode_free;
		struct tnode *tnode_free;
	};
	};
	struct rt_trie_node __rcu *child[0];
	struct rt_trie_node __rcu *child[0];
@@ -383,12 +382,6 @@ static struct tnode *tnode_alloc(size_t size)
		return vzalloc(size);
		return vzalloc(size);
}
}


static void __tnode_vfree(struct work_struct *arg)
{
	struct tnode *tn = container_of(arg, struct tnode, work);
	vfree(tn);
}

static void __tnode_free_rcu(struct rcu_head *head)
static void __tnode_free_rcu(struct rcu_head *head)
{
{
	struct tnode *tn = container_of(head, struct tnode, rcu);
	struct tnode *tn = container_of(head, struct tnode, rcu);
@@ -397,10 +390,8 @@ static void __tnode_free_rcu(struct rcu_head *head)


	if (size <= PAGE_SIZE)
	if (size <= PAGE_SIZE)
		kfree(tn);
		kfree(tn);
	else {
	else
		INIT_WORK(&tn->work, __tnode_vfree);
		vfree(tn);
		schedule_work(&tn->work);
	}
}
}


static inline void tnode_free(struct tnode *tn)
static inline void tnode_free(struct tnode *tn)