public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* SLAB_LEVEL_MASK question
@ 2003-09-04 18:18 Henry Qian
  0 siblings, 0 replies; 3+ messages in thread
From: Henry Qian @ 2003-09-04 18:18 UTC (permalink / raw)
  To: linux-kernel

I had a kernel panic at:

static int kmem_cache_grow (kmem_cache_t * cachep, int flags)
{
        .....

        /*
         * The test for missing atomic flag is performed here, rather
than
         * the more obvious place, simply to reduce the critical path
length
         * in kmem_cache_alloc(). If a caller is seriously mis-behaving
they
         * will eventually be caught here (where it matters).
         */
        if (in_interrupt() && (flags & SLAB_LEVEL_MASK) != SLAB_ATOMIC)
                BUG();
        ...
}

The kernel panics because in the flags variable, I have other flags
(0x1f0) besides SLAB_ATOMIC.

I modified it to:

        if (in_interrupt() && (flags & SLAB_ATOMIC) != SLAB_ATOMIC)
                BUG();

It seems working fine.

Is this good?

Henry Qian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: SLAB_LEVEL_MASK question
@ 2003-09-04 19:49 Manfred Spraul
  0 siblings, 0 replies; 3+ messages in thread
From: Manfred Spraul @ 2003-09-04 19:49 UTC (permalink / raw)
  To: Henry Qian; +Cc: linux-kernel

Hi Henry,

>The kernel panics because in the flags variable, I have other flags
>(0x1f0) besides SLAB_ATOMIC.
>  
>
Which flags were set? __GFP_WAIT must not be set [i.e. will panic], the 
other combinations are invalid. The only legal values for the flags 
variable are 0 or SLAB_ATOMIC [aka GFP_ATOMIC, aka __GFP_HIGH].

>I modified it to:
>
>        if (in_interrupt() && (flags & SLAB_ATOMIC) != SLAB_ATOMIC)
>                BUG();
>
>It seems working fine.
>
>Is this good?
>  
>
No, it's wrong. Your driver will panic once in a while, especially under 
memory intensive stress tests.

--
    Manfred


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: SLAB_LEVEL_MASK question
@ 2003-09-04 20:19 Henry Qian
  0 siblings, 0 replies; 3+ messages in thread
From: Henry Qian @ 2003-09-04 20:19 UTC (permalink / raw)
  To: Manfred Spraul; +Cc: linux-kernel

The other flags are __GFP_WAIT, __GFP_HIGH, __GFP_IO, __GFP_HIGHIO, and
__GFP_FS (flags == 0x1f0).

So this must be something else's wrong.  I was using madwifi Atheros
driver.

Thank you very much,

Henry

-----Original Message-----
From: Manfred Spraul [mailto:manfred@colorfullife.com] 
Sent: Thursday, September 04, 2003 3:50 PM
To: Henry Qian
Cc: linux-kernel@vger.kernel.org
Subject: Re: SLAB_LEVEL_MASK question


Hi Henry,

>The kernel panics because in the flags variable, I have other flags
>(0x1f0) besides SLAB_ATOMIC.
>  
>
Which flags were set? __GFP_WAIT must not be set [i.e. will panic], the 
other combinations are invalid. The only legal values for the flags 
variable are 0 or SLAB_ATOMIC [aka GFP_ATOMIC, aka __GFP_HIGH].

>I modified it to:
>
>        if (in_interrupt() && (flags & SLAB_ATOMIC) != SLAB_ATOMIC)
>                BUG();
>
>It seems working fine.
>
>Is this good?
>  
>
No, it's wrong. Your driver will panic once in a while, especially under

memory intensive stress tests.

--
    Manfred


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-09-04 20:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-04 19:49 SLAB_LEVEL_MASK question Manfred Spraul
  -- strict thread matches above, loose matches on Subject: below --
2003-09-04 20:19 Henry Qian
2003-09-04 18:18 Henry Qian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox