Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 4120
b: refs/heads/master
c: f0e36f8
h: refs/heads/master
v: v3
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Jul 5, 2005
1 parent 414d0c8 commit acc3fbc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 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: 93e266f600f4048fe7a2e8803abb9f8baff84aa7
refs/heads/master: f0e36f8cee8101604378085171c980d9cc71d779
25 changes: 23 additions & 2 deletions trunk/net/ipv4/fib_trie.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,32 @@ static inline void free_leaf_info(struct leaf_info *li)
kfree(li);
}

static struct tnode *tnode_alloc(unsigned int size)
{
if (size <= PAGE_SIZE) {
return kmalloc(size, GFP_KERNEL);
} else {
return (struct tnode *)
__get_free_pages(GFP_KERNEL, get_order(size));
}
}

static void __tnode_free(struct tnode *tn)
{
unsigned int size = sizeof(struct tnode) +
(1<<tn->bits) * sizeof(struct node *);

if (size <= PAGE_SIZE)
kfree(tn);
else
free_pages((unsigned long)tn, get_order(size));
}

static struct tnode* tnode_new(t_key key, int pos, int bits)
{
int nchildren = 1<<bits;
int sz = sizeof(struct tnode) + nchildren * sizeof(struct node *);
struct tnode *tn = kmalloc(sz, GFP_KERNEL);
struct tnode *tn = tnode_alloc(sz);

if(tn) {
memset(tn, 0, sz);
Expand Down Expand Up @@ -390,7 +411,7 @@ static void tnode_free(struct tnode *tn)
printk("FL %p \n", tn);
}
else if(IS_TNODE(tn)) {
kfree(tn);
__tnode_free(tn);
if(trie_debug > 0 )
printk("FT %p \n", tn);
}
Expand Down

0 comments on commit acc3fbc

Please sign in to comment.