Re: BUG in FIB trie v.0.404 kernel 2.6.16

From: Jesper Dangaard Brouer
Date: Sun Mar 26 2006 - 13:45:41 EST




On Sun, 26 Mar 2006, Robert Olsson wrote:

Jesper Dangaard Brouer writes:

> BUG report for: FIB trie v.0.404
> Kernel version: 2.6.16
>
> When booting the kernel, the following debug output is printed. I assume
> its a bug in the FIB trie code, as it is printed right after the fib tree
> code is activated, and some of the functions refer to the trie code.

> Linux version 2.6.16-orig (hawk@host) (gcc version 3.3.4) #1 SMP PREEMPT Sat Mar 25 22:26:15 CET 2006
> ...
> IPv4 FIB: Using LC-trie version 0.404
> Debug: sleeping function called from invalid context at mm/slab.c:2729
> in_atomic():1, irqs_disabled():0
> [<c0103c4e>] show_trace+0x20/0x24

Hello!

I've have enabled debugging and was expecting to see this as well but I don't.
I'll assume this disapears if you change GFP_KERNEL to GFP_ATOMIC for tnode
and leaf allocations well replace throughout fib_trie.c

Cheers.
--ro

I solved the problem! :-)
Have attached a patch with the changes I made.

See you around!
Jesper Brouer

--
-------------------------------------------------------------------
MSc. Master of Computer Science
Dept. of Computer Science, University of Copenhagen
---------------------------------------------------------------------- linux-2.6.16-orig/net/ipv4/fib_trie.c 2006-03-20 06:53:29.000000000 +0100
+++ linux-2.6.16-test/net/ipv4/fib_trie.c 2006-03-26 13:36:31.000000000 +0200
@@ -50,7 +50,7 @@
* Patrick McHardy <kaber@xxxxxxxxx>
*/

-#define VERSION "0.404"
+#define VERSION "0.405"

#include <linux/config.h>
#include <asm/uaccess.h>
@@ -334,9 +334,9 @@ static struct tnode *tnode_alloc(unsigne
struct page *pages;

if (size <= PAGE_SIZE)
- return kcalloc(size, 1, GFP_KERNEL);
+ return kcalloc(size, 1, GFP_ATOMIC);

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

@@ -362,7 +362,7 @@ static inline void tnode_free(struct tno

static struct leaf *leaf_new(void)
{
- struct leaf *l = kmalloc(sizeof(struct leaf), GFP_KERNEL);
+ struct leaf *l = kmalloc(sizeof(struct leaf), GFP_ATOMIC);
if (l) {
l->parent = T_LEAF;
INIT_HLIST_HEAD(&l->list);
@@ -372,7 +372,7 @@ static struct leaf *leaf_new(void)

static struct leaf_info *leaf_info_new(int plen)
{
- struct leaf_info *li = kmalloc(sizeof(struct leaf_info), GFP_KERNEL);
+ struct leaf_info *li = kmalloc(sizeof(struct leaf_info), GFP_ATOMIC);
if (li) {
li->plen = plen;
INIT_LIST_HEAD(&li->falh);
@@ -1959,7 +1959,7 @@ struct fib_table * __init fib_hash_init(
NULL, NULL);

tb = kmalloc(sizeof(struct fib_table) + sizeof(struct trie),
- GFP_KERNEL);
+ GFP_ATOMIC);
if (tb == NULL)
return NULL;

@@ -2137,7 +2137,7 @@ static int fib_triestat_seq_show(struct
{
struct trie_stat *stat;

- stat = kmalloc(sizeof(*stat), GFP_KERNEL);
+ stat = kmalloc(sizeof(*stat), GFP_ATOMIC);
if (!stat)
return -ENOMEM;

@@ -2336,7 +2336,7 @@ static int fib_trie_seq_open(struct inod
{
struct seq_file *seq;
int rc = -ENOMEM;
- struct fib_trie_iter *s = kmalloc(sizeof(*s), GFP_KERNEL);
+ struct fib_trie_iter *s = kmalloc(sizeof(*s), GFP_ATOMIC);

if (!s)
goto out;
@@ -2457,7 +2457,7 @@ static int fib_route_seq_open(struct ino
{
struct seq_file *seq;
int rc = -ENOMEM;
- struct fib_trie_iter *s = kmalloc(sizeof(*s), GFP_KERNEL);
+ struct fib_trie_iter *s = kmalloc(sizeof(*s), GFP_ATOMIC);

if (!s)
goto out;