linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zhouyi Zhou <zhouzhouyi@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Paul Menzel <pmenzel@molgen.mpg.de>,
	Michael Ellerman <mpe@ellerman.id.au>,
	 linuxppc-dev@lists.ozlabs.org, Linux-MM <linux-mm@kvack.org>,
	 Peter Zijlstra <peterz@infradead.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	 Jason Baron <jbaron@akamai.com>, rcu <rcu@vger.kernel.org>,
	 LKML <linux-kernel@vger.kernel.org>,
	"Paul E. McKenney" <paulmck@kernel.org>
Subject: Re: BUG: sleeping function called from invalid context at include/linux/sched/mm.h:256
Date: Sun, 13 Feb 2022 12:17:50 +0800	[thread overview]
Message-ID: <CAABZP2wNEUpM0OyhpKb+EtKY2RynpeU2N2tu9Jw_9B6iv6jGNQ@mail.gmail.com> (raw)
In-Reply-To: <YgiEeHzz4JZFszJD@casper.infradead.org>

Thank Matthew for correcting me

On Sun, Feb 13, 2022 at 12:09 PM Matthew Wilcox <willy@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


  reply	other threads:[~2022-02-13  4:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-12 23:05 Paul Menzel
2022-02-12 23:48 ` Paul E. McKenney
2022-02-13  7:39   ` Paul Menzel
2022-02-13 14:45     ` Paul E. McKenney
2022-02-13 17:26       ` Paul Menzel
2022-02-13  3:19 ` Zhouyi Zhou
2022-02-13  4:09   ` Matthew Wilcox
2022-02-13  4:17     ` Zhouyi Zhou [this message]
2022-02-14  9:35 ` Peter Zijlstra
2022-02-14  9:50   ` Christophe Leroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAABZP2wNEUpM0OyhpKb+EtKY2RynpeU2N2tu9Jw_9B6iv6jGNQ@mail.gmail.com \
    --to=zhouzhouyi@gmail.com \
    --cc=jbaron@akamai.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pmenzel@molgen.mpg.de \
    --cc=rcu@vger.kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox