Re: [PATCH] swap: fix oops during block io poll in swapin path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 26 Jul 2017 14:31:53 -0700 Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Wed, 26 Jul 2017 09:33:50 -0700 Shaohua Li <shli@xxxxxx> 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@xxxxxx>
> > 
> 
> 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@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux