Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90612
b: refs/heads/master
c: 15be75c
h: refs/heads/master
v: v3
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Apr 10, 2008
1 parent 8180c74 commit c31472e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5c06f510a25153ff79e8c2dca312b732a367c5bb
refs/heads/master: 15be75cdb5db442d0e33d37b20832b88f3ccd383
25 changes: 15 additions & 10 deletions trunk/net/ipv4/fib_trie.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ struct tnode {
unsigned char bits; /* 2log(KEYLENGTH) bits needed */
unsigned int full_children; /* KEYLENGTH bits needed */
unsigned int empty_children; /* KEYLENGTH bits needed */
struct rcu_head rcu;
union {
struct rcu_head rcu;
struct work_struct work;
};
struct node *child[0];
};

Expand Down Expand Up @@ -346,16 +349,16 @@ static inline void free_leaf_info(struct leaf_info *leaf)

static struct tnode *tnode_alloc(size_t size)
{
struct page *pages;

if (size <= PAGE_SIZE)
return kzalloc(size, GFP_KERNEL);
else
return __vmalloc(size, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL);
}

pages = alloc_pages(GFP_KERNEL|__GFP_ZERO, get_order(size));
if (!pages)
return NULL;

return page_address(pages);
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)
Expand All @@ -366,8 +369,10 @@ static void __tnode_free_rcu(struct rcu_head *head)

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

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

0 comments on commit c31472e

Please sign in to comment.