BUG: sleeping function called from invalid context at include/linux/sched/mm.h:256

Zhouyi Zhou zhouzhouyi at gmail.com
Sun Feb 13 15:17:50 AEDT 2022


Thank Matthew for correcting me

On Sun, Feb 13, 2022 at 12:09 PM Matthew Wilcox <willy at infradead.org> wrote:
>
> On Sun, Feb 13, 2022 at 11:19:09AM +0800, Zhouyi Zhou wrote:
> > I think the key to the problem lies in your attached console.log
> > (pasted below), at times 0.014987 and 0.015995, I see there are two
> > locks (cpu_hotplug_lock and jump_label_mutex)  holded while
> > kmem_cache_alloc calls __might_resched (0.023356).
>
> Those are both sleeping locks (a percpu_rwsem and mutex, respectively).
> There is no problem with sleeping while holding a mutex or rwsem.
>From console.log, I see
[    0.012154][    T1] BUG: sleeping function called from invalid
context at include/linux/sched/mm.h:256
[    0.013128][    T1] in_atomic(): 0, irqs_disabled(): 1, non_block:
0, pid: 1, name: swapper/0
>From ___might_sleep, I see

9506         if ((preempt_count_equals(preempt_offset) && !irqs_disabled() &&
9507              !is_idle_task(current) && !current->non_block_count) ||
9508             system_state == SYSTEM_BOOTING || system_state >
SYSTEM_RUNNING ||
9509             oops_in_progress)
9510                 return;

I guess it is irq_disable which cause the bug.

Thanks
Zhouyi


More information about the Linuxppc-dev mailing list