From: Andrew Morton <akpm@linux-foundation.org>
To: Shaohua Li <shli@fb.com>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Tim Chen <tim.c.chen@intel.com>,
Huang Ying <ying.huang@intel.com>, Jens Axboe <axboe@fb.com>,
Hugh Dickins <hughd@google.com>,
linux-mm@kvack.org
Subject: Re: [PATCH] swap: fix oops during block io poll in swapin path
Date: Wed, 26 Jul 2017 14:48:12 -0700 [thread overview]
Message-ID: <20170726144812.30423e9eb7894ed97fa5fa32@linux-foundation.org> (raw)
In-Reply-To: <20170726143153.4b74dad79efb13480c728c04@linux-foundation.org>
On Wed, 26 Jul 2017 14:31:53 -0700 Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 26 Jul 2017 09:33:50 -0700 Shaohua Li <shli@fb.com> wrote:
>
> > On Wed, Jul 26, 2017 at 07:25:03PM +0900, Tetsuo Handa wrote:
> > > When a thread is OOM-killed during swap_readpage() operation, an oops
> > > occurs because end_swap_bio_read() is calling wake_up_process() based on
> > > an assumption that the thread which called swap_readpage() is still alive.
> > >
> >
> > ...
> >
> > >
> > > Fix it by holding a reference to the thread.
> >
> > Ok, so the task is killed in the page fault retry time check, thanks!
> >
> > Reviewed-by: Shaohua Li <shli@fb.com>
> >
>
> The original patch didn't appear in my inbox and marc.info doesn't
> appear to have received it either. Can we please have a resend?
Jens sent me a copy (thanks).
A get_task_struct in the middle of readpage is very strange-looking.
So a comment is needed. This?
--- a/mm/page_io.c~swap-fix-oops-during-block-io-poll-in-swapin-path-fix
+++ a/mm/page_io.c
@@ -380,6 +380,10 @@ int swap_readpage(struct page *page, boo
goto out;
}
bdev = bio->bi_bdev;
+ /*
+ * Keep this task valid during swap readpage because the oom killer may
+ * attempt to access it in the page fault retry time check.
+ */
get_task_struct(current);
bio->bi_private = current;
bio_set_op_attrs(bio, REQ_OP_READ, 0);
_
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2017-07-26 21:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1501064703-5888-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp>
2017-07-26 16:33 ` [PATCH] swap: fix oops during block io poll in swapin path Shaohua Li
2017-07-26 21:31 ` Andrew Morton
2017-07-26 21:48 ` Andrew Morton [this message]
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=20170726144812.30423e9eb7894ed97fa5fa32@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=axboe@fb.com \
--cc=hughd@google.com \
--cc=linux-mm@kvack.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=shli@fb.com \
--cc=tim.c.chen@intel.com \
--cc=ying.huang@intel.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;
as well as URLs for NNTP newsgroup(s).