linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@suse.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: kernel test robot <oliver.sang@intel.com>,
	Uladzislau Rezki <urezki@gmail.com>,
	Hillf Danton <hdanton@sina.com>,
	Matthew Wilcox <willy@infradead.org>,
	Michal Hocko <mhocko@suse.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	Oleksiy Avramchenko <oleksiy.avramchenko@sonymobile.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	lkp@lists.01.org, kernel test robot <lkp@intel.com>
Subject: Re: [mm/vmalloc] 5c1f4e690e: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c
Date: Tue, 13 Jul 2021 22:54:47 +0100	[thread overview]
Message-ID: <20210713215447.GA3741@suse.de> (raw)
In-Reply-To: <CAHk-=wiDif7SvA5DOWj9ssDuYHC4ujUFPd7ad-ydhY-WMLb-kQ@mail.gmail.com>

On Tue, Jul 13, 2021 at 11:19:29AM -0700, Linus Torvalds wrote:
> On Tue, Jul 13, 2021 at 7:06 AM kernel test robot <oliver.sang@intel.com> wrote:
> >
> > [  131.014885] BUG: sleeping function called from invalid context at mm/page_alloc.c:4992
> 
> Strange. The call chain doesn't actually seem to be anything off: it's
> writev -> sock_write_iter -> sock_sendmsg -> netlink_sendmsg ->
> vmalloc.
> 
> All good to sleep as far as I can tell. The warning itself seems to be just
> 
>         might_sleep_if(gfp_mask & __GFP_DIRECT_RECLAIM);
> 
> in prepare_alloc_pages().
> 
> I don't see what's wrong with that commit, but it does seem to be very
> consistent, in that the parent doesn't have it:
> 

It's almost certainly going to be fixed by
https://lore.kernel.org/r/20210713152100.10381-2-mgorman@techsingularity.net
whenever it hits your tree as part of this series
https://lore.kernel.org/lkml/20210713152100.10381-1-mgorman@techsingularity.net/.
It should make its way through Andrew's tree before RC2 but if he is busy
I'll create a git pull request.

> which means that the might_sleep_if() happens _after_
> __alloc_pages_bulk() has disabled interrupts. That would explain it,
> but the stack_depot_save() thing actually makes that call chain really
> hard to read because it duplicates the addresses on the stack.
> 
> I don't see the nesting there, but that's what it kind of smells like to me.
> 
> Anybody?
> 

The problem is that PAGE_OWNER can recurse allocate from bulk allocation
context to store the caller stack. When I wrote the patch, I missed that
prep_new_page can allocate if PAGE_OWNER is active. The most relevant
part of the trace is

[  131.092667]  stack_depot_save+0x390/0x4c0

-- 
Mel Gorman
SUSE Labs

  parent reply	other threads:[~2021-07-13 21:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13 14:24 [mm/vmalloc] 5c1f4e690e: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c kernel test robot
2021-07-13 18:19 ` Linus Torvalds
2021-07-13 18:26   ` Matthew Wilcox
2021-07-13 19:58     ` Uladzislau Rezki
2021-07-13 21:54   ` Mel Gorman [this message]
2021-07-13 19:52 ` Linus Torvalds
2021-07-14  8:48   ` [LKP] " Chen, Rong A

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=20210713215447.GA3741@suse.de \
    --to=mgorman@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=lkp@lists.01.org \
    --cc=mhocko@suse.com \
    --cc=npiggin@gmail.com \
    --cc=oleksiy.avramchenko@sonymobile.com \
    --cc=oliver.sang@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@linux-foundation.org \
    --cc=urezki@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).