All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Jens Axboe <axboe@kernel.dk>, Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>, Qian Cai <cai@lca.pw>,
	akpm@linux-foundation.org, hch@lst.de, gkohli@codeaurora.org,
	mingo@redhat.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block: fix a crash in do_task_dead()
Date: Sun, 30 Jun 2019 16:06:25 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LSU.2.11.1906301542410.1105@eggly.anvils> (raw)
In-Reply-To: <ddf9ee34-cd97-a62b-6e91-6b4511586339@kernel.dk>

On Wed, 5 Jun 2019, Jens Axboe wrote:
> 
> How about the following plan - if folks are happy with this sched patch,
> we can queue it up for 5.3. Once that is in, I'll kill the block change
> that special cases the polled task wakeup. For 5.2, we go with Oleg's
> patch for the swap case.

I just hit the do_task_dead() kernel BUG at kernel/sched/core.c:3463!
while heavy swapping on 5.2-rc7: it looks like Oleg's patch intended
for 5.2 was not signed off, and got forgotten.

I did hit the do_task_dead() BUG (but not at all easily) on early -rcs
before seeing Oleg's patch, then folded it in and and didn't hit the BUG
again; then just tried again without it, and luckily hit in a few hours.

So I can give it an enthusiastic
Acked-by: Hugh Dickins <hughd@google.com>
because it makes good sense to avoid the get/blk_wake/put overhead on
the asynch path anyway, even if it didn't work around a bug; but only
Half-Tested-by: Hugh Dickins <hughd@google.com>
since I have not been exercising the synchronous path at all.

Hugh, requoting Oleg:

> 
> I don't understand this code at all but I am just curious, can we do
> something like incomplete patch below ?
> 
> Oleg.
> 
> --- x/mm/page_io.c
> +++ x/mm/page_io.c
> @@ -140,8 +140,10 @@ int swap_readpage(struct page *page, bool synchronous)
>  	unlock_page(page);
>  	WRITE_ONCE(bio->bi_private, NULL);
>  	bio_put(bio);
> -	blk_wake_io_task(waiter);
> -	put_task_struct(waiter);
> +	if (waiter) {
> +		blk_wake_io_task(waiter);
> +		put_task_struct(waiter);
> +	}
>  }
>  
>  int generic_swapfile_activate(struct swap_info_struct *sis,
> @@ -398,11 +400,12 @@ int swap_readpage(struct page *page, boo
>  	 * 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);
> -	if (synchronous)
> +	if (synchronous) {
>  		bio->bi_opf |= REQ_HIPRI;
> +		get_task_struct(current);
> +		bio->bi_private = current;
> +	}
>  	count_vm_event(PSWPIN);
>  	bio_get(bio);
>  	qc = submit_bio(bio);

  parent reply	other threads:[~2019-06-30 23:06 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29 20:25 [PATCH] block: fix a crash in do_task_dead() Qian Cai
2019-05-29 20:31 ` Jens Axboe
2019-05-30  8:03 ` Peter Zijlstra
2019-05-31 21:12   ` Jens Axboe
2019-06-03 12:37     ` Peter Zijlstra
2019-06-03 12:44       ` Peter Zijlstra
2019-06-03 16:09         ` Oleg Nesterov
2019-06-03 16:19           ` Peter Zijlstra
2019-06-03 16:23       ` Jens Axboe
2019-06-05 15:04       ` Jens Axboe
2019-06-07 13:35         ` Peter Zijlstra
2019-06-07 14:23           ` Peter Zijlstra
2019-06-08  8:39             ` Jens Axboe
2019-06-10 13:13             ` Gaurav Kohli
2019-06-10 14:46               ` Oleg Nesterov
2019-06-11  4:39                 ` Gaurav Kohli
2019-06-30 23:06         ` Hugh Dickins [this message]
2019-06-30 23:06           ` Hugh Dickins
2019-07-01 14:22           ` Jens Axboe
2019-07-02 22:06             ` Andrew Morton
2019-07-03 17:35               ` Oleg Nesterov
2019-07-03 17:44                 ` Hugh Dickins
2019-07-03 17:44                   ` Hugh Dickins
2019-07-04 16:00                   ` Oleg Nesterov
2019-07-03 17:52                 ` Jens Axboe
2019-05-30 11:15 ` Oleg Nesterov
2019-05-31 21:10   ` Jens Axboe
2019-07-04 16:03 ` [PATCH] swap_readpage: avoid blk_wake_io_task() if !synchronous Oleg Nesterov
2019-07-04 19:32   ` Andrew Morton
2019-07-04 21:15     ` Hugh Dickins
2019-07-04 21:15       ` Hugh Dickins

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=alpine.LSU.2.11.1906301542410.1105@eggly.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=cai@lca.pw \
    --cc=gkohli@codeaurora.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.