linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	Yang Shi <shy828301@gmail.com>,
	 Jiufei Xue <jiufei.xue@linux.alibaba.com>,
	Linux MM <linux-mm@kvack.org>,
	 joseph.qi@linux.alibaba.com
Subject: Re: [PATCH] mm: fix sleeping function warning in alloc_swap_info
Date: Tue, 29 Jan 2019 17:11:30 -0800	[thread overview]
Message-ID: <CAHk-=widebSUzbugcLS2txfucxDNOGWFbWBWVseAmxrdypDBrg@mail.gmail.com> (raw)
In-Reply-To: <20190129170150.57021080bdfd3a46a479d45d@linux-foundation.org>

On Tue, Jan 29, 2019 at 5:01 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> >
> >     - * Context: Any context except NMI.
> >     + * Context: Either preemptible task context or not-NMI interrupt.
>
> Whereabouts in the vfree() path can the kernel sleep?

Note that it's not necessarily about *sleeping*.

One thing that vfree() really fundamentally should do is to flush
TLB's. And you must not do a cross-TLB flush with interrupts disabled.

NOTE! Right now, I think we do lazy TLB flushing, so the flush
actually is delayed until the vmalloc() when the address rolls around
in the vmalloc address space. But there really are very real and
obvious reasons why we might want to do it at vfree time.

So I'd honestly be a whole lot happier with vmalloc/vfree being
process context only. Or at least with with interrupts enabled (so
swirq/BH context would be fine, but an actual interrupt not so).

Again, this is not about sleeping. But the end result is almost the
same: we really should strive to not do vfree() in interrupt context.

                Linus


  reply	other threads:[~2019-01-30  1:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-29  7:21 Jiufei Xue
2019-01-29  8:53 ` Aaron Lu
2019-01-29 10:43   ` Joseph Qi
2019-01-29 11:19     ` Aaron Lu
2019-01-29 11:43 ` Tetsuo Handa
2019-01-29 19:13   ` Andrew Morton
2019-01-29 21:12     ` Tetsuo Handa
2019-01-29 21:51       ` Yang Shi
2019-01-30  0:42         ` Tetsuo Handa
2019-01-30  1:01           ` Andrew Morton
2019-01-30  1:11             ` Linus Torvalds [this message]
2019-01-30  1:23               ` Linus Torvalds
2019-01-30  2:54                 ` Tetsuo Handa
2019-01-30 17:18                   ` Linus Torvalds
2019-01-30 22:13                     ` Andrew Morton
2019-03-07 14:43             ` Aaron Lu
2019-03-07 14:47               ` Andrey Ryabinin
2019-03-07 15:24                 ` Aaron Lu
2019-03-07 16:33                   ` Andrey Ryabinin
2019-03-08  2:41                     ` Aaron Lu
2019-03-11  1:43                       ` Jiufei Xue

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='CAHk-=widebSUzbugcLS2txfucxDNOGWFbWBWVseAmxrdypDBrg@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=jiufei.xue@linux.alibaba.com \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-mm@kvack.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=shy828301@gmail.com \
    /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