From: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
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 11:54:20 +0900 [thread overview]
Message-ID: <201901300254.x0U2sKdE090905@www262.sakura.ne.jp> (raw)
In-Reply-To: <CAHk-=wg=gquY8DT6s1Qb46HkJn=hV2uHeX-dafdb8T4iZAmhdw@mail.gmail.com>
Andrew Morton wrote:
> > change. But I think that we converted kmalloc() to kvmalloc() without checking
> > context of kvfree() callers. Therefore, I think that kvfree() needs to use
> > vfree_atomic() rather than just saying "vfree() might sleep if called not in
> > interrupt context."...
>
> Whereabouts in the vfree() path can the kernel sleep?
Indeed. Although __vunmap() must not be called from interrupt context because
mutex_trylock()/mutex_unlock() from try_purge_vmap_area_lazy() from
free_vmap_area_noflush() from free_unmap_vmap_area() from remove_vm_area() from
__vunmap() cannot be called from interrupt context, it seems that there is no
location that does sleeping operation.
Linus Torvalds wrote:
> Which - as mentioned - is fine because we currently don't actually do
> the TLB flush synchronously, but it's worth noting again. "vfree()"
> really is a *lot* different from "kfree()". It's unsafe in all kinds
> of special ways, and the locking difference is just part of it.
>
> So whatever might_sleep() has found might be a potential real issue at
> some point...
Then, do we automatically defer vfree() to mm_percpu_wq context?
next prev parent reply other threads:[~2019-01-30 2:54 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
2019-01-30 1:23 ` Linus Torvalds
2019-01-30 2:54 ` Tetsuo Handa [this message]
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=201901300254.x0U2sKdE090905@www262.sakura.ne.jp \
--to=penguin-kernel@i-love.sakura.ne.jp \
--cc=akpm@linux-foundation.org \
--cc=jiufei.xue@linux.alibaba.com \
--cc=joseph.qi@linux.alibaba.com \
--cc=linux-mm@kvack.org \
--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