linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Linus Torvalds <torvalds@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: Wed, 30 Jan 2019 14:13:37 -0800	[thread overview]
Message-ID: <20190130141337.5d0d5e96e5544bf562cb5b8d@linux-foundation.org> (raw)
In-Reply-To: <CAHk-=wjEHQZyen7WEG5K5gC_5gEb9gM_r+WtpkfsLkYFstN5XA@mail.gmail.com>

On Wed, 30 Jan 2019 09:18:20 -0800 Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Tue, Jan 29, 2019 at 6:54 PM Tetsuo Handa
> <penguin-kernel@i-love.sakura.ne.jp> wrote:
> >
> > Then, do we automatically defer vfree() to mm_percpu_wq context?
> 
> We might do that, and say "if you call vfree with interrupts disabled,
> it gets deferred".
> 
> That said, the deferred case should generally not be a common case
> either. It has real issues, one of which is simply that particularly
> on 32-bit architectures we can run out of vmalloc space even normally,
> and if there are loads that do a lot of allocation and then deferred
> frees, that problem could become really bad.
> 
> So I'd almost be happier having a warning if we end up doing the TLB
> flush and defer. At least to find *what* people do.
> 
> And I do wonder if we should just always warn, and have that
> "might_sleep()", and simply say "if you do vfree from interrupts or
> with interrupts disabled, you really should be aware of these kinds of
> issues, and you really should *show* that you are aware by using
> vfree_atomic()".
> 

Agree.  if (irqs_disabled()) {warn_once; punt_to_workqueue} is the way
to go here.  vfree() should be callable from spinlocked code and
might_sleep() is an inappropriate check.


  reply	other threads:[~2019-01-30 22:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-29  7:21 [PATCH] mm: fix sleeping function warning in alloc_swap_info 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
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 [this message]
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=20190130141337.5d0d5e96e5544bf562cb5b8d@linux-foundation.org \
    --to=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 \
    --cc=torvalds@linux-foundation.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).