Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2235155ybi; Mon, 1 Jul 2019 08:29:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvTKY09fI0QEkRc8hQSfb9XN8+65812yesA4cn1gC6vzU+1tbu2mSBD22gtKTyEc7VXhZV X-Received: by 2002:a63:c60b:: with SMTP id w11mr24594430pgg.356.1561994955483; Mon, 01 Jul 2019 08:29:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561994955; cv=none; d=google.com; s=arc-20160816; b=BKxR2XCgTr/vFT7I9JGQ24wWux2/SsSzJkrp7Bv/x13kFDhmw6l+h/ZfaMQMZSF8AX p2A9H+LAIBL38eQtrDcrQh4KPYDvFWQ9fFt5fA5daJRAoRTEbvXDIrx0RAtr8Ap23+aB IzdyIB0BlpOnCB8vt3NJdpKH3rtvNBjgb1rkUq/e4ZVYsiBkjqDL102juB9DCOGR0wtH TdidufjsjaxHIFDWbVM5EpuVbfYl1Vvfj8u/l0/e86BBtublasEPP34qYVGjWwmt+KhH Y17riUpyA6I01Gsd9ukw7VtY4YFcYbOh9X1Px0MACHnXRB2RUn6/FK2HYKSmjoRGpPpb 59cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=btB19IKd1k8U8AFXegKGIuJCLiqvpxzyOkY8GOJfQnQ=; b=z88jBceR2HhE1mTr+4kJrhlP0LxpVP1AYhpMNnK/6CchKLaLgC21iryYH/9cBXu7jK MNAqPxyp0XtGrUgf0moDX1cM3W9ZsHPi/f7j2tlzVQaYnSME0YwJElaufkEt82FkvcPC IMHF4K1fU8rN6gYRXRAKnc31+YYLiI8fPXV6j07psBvrWn26wvH8UIkiHo6asmnxEsBT ev8ooJkmcanb4/5jAFGzSnznIeFAqbXDJryQByr3DVSU+FHpIa4xz0O+a0LkSonutrDB Ww3uFzMk1UtAT87udiA2o53tk1U0ZMapRqz6gDQn5ihESOCZ03LFAtlepiYMO3SBR7zR 9CYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=hanCNMW6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h125si11344708pfb.176.2019.07.01.08.28.59; Mon, 01 Jul 2019 08:29:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=hanCNMW6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729481AbfGAOWg (ORCPT + 99 others); Mon, 1 Jul 2019 10:22:36 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:41208 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727064AbfGAOWg (ORCPT ); Mon, 1 Jul 2019 10:22:36 -0400 Received: by mail-io1-f65.google.com with SMTP id w25so29175807ioc.8 for ; Mon, 01 Jul 2019 07:22:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=btB19IKd1k8U8AFXegKGIuJCLiqvpxzyOkY8GOJfQnQ=; b=hanCNMW6XBQ9ko0So04XIcjf8oRLewRZVmW9+7bcPtobH+yCIR2NkbuTQwq3XoVPUe L/bcXt7K5MxSM0o+nEwVyEspze7MxmsxVl3F54sn5FH4QYXfL4W2duJ6JixaMCo5j963 sqfhZwq2EWLsJSwho7hJPy5VUvnyPRpDnLCvGxpI0Hpocf7NdOjZFcNuOJiiTkVPRAsL iTfzBsqM3PRdettAwvdJwz9tYgQd8V214v6BS5UFlSd9pzGDFjBQ+kONre+m94D5wbdR nvFOF5FdBUGblmAA6UFbWB335aso2amFqL+WWr2z3FMMuhG3YBgv0qerKRmLT82zT+KZ HJ4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=btB19IKd1k8U8AFXegKGIuJCLiqvpxzyOkY8GOJfQnQ=; b=WHledQs6B9yAAFihPc/bX0VIEv4k8uhsW964FIJIaPM/6OlSJrFj0cGR8e2jVDo1L9 WvPlCj4+dGcDHTegl7sc/nWjhX6JCNryqQBpGKYEIeL0R9UXow08/KjJnWxt0e2dMK2g AXVgRev/c4Sviwlp7sXepfqS2ouo88gUICai1xoBbtHHKoAmuJ1UdfvyK6l3KG5maQG4 7QuWq9hhtFPiFcF51P/Uk1P7ou5lxkf2OVYt1MnADJs9UX/P6CIaXFaNQaQNhIu0/mFp vplFRC9FFdtq8MevMzD26sOzyQNHUsqkMBfdGYCEP3WEnJmzLdy4acxA+RIQChn2hraT UT5A== X-Gm-Message-State: APjAAAWL30MHBY3nsSwkdACq8U5atHfdufy5OtKQcAq/GeFrALb/jEGF xbd1Af0V6rGOOzpPJqGxKyapIigUFiErQEOl X-Received: by 2002:a6b:ce19:: with SMTP id p25mr27241142iob.201.1561990954936; Mon, 01 Jul 2019 07:22:34 -0700 (PDT) Received: from [192.168.1.158] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id q15sm10426451ioi.15.2019.07.01.07.22.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jul 2019 07:22:33 -0700 (PDT) Subject: Re: [PATCH] block: fix a crash in do_task_dead() To: Hugh Dickins , Oleg Nesterov Cc: Peter Zijlstra , Qian Cai , akpm@linux-foundation.org, hch@lst.de, gkohli@codeaurora.org, mingo@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <1559161526-618-1-git-send-email-cai@lca.pw> <20190530080358.GG2623@hirez.programming.kicks-ass.net> <82e88482-1b53-9423-baad-484312957e48@kernel.dk> <20190603123705.GB3419@hirez.programming.kicks-ass.net> From: Jens Axboe Message-ID: <97d2f5cc-fe98-f28e-86ce-6fbdeb8b67bd@kernel.dk> Date: Mon, 1 Jul 2019 08:22:32 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/30/19 5:06 PM, Hugh Dickins wrote: > 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 > 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 > since I have not been exercising the synchronous path at all. I'll take the blame for that, went away on vacation for 3 weeks... But yes, for 5.2, the patch from Oleg looks fine. Once Peter's other change is in mainline, I'll go through and remove these special cases. Andrew, can you queue Oleg's patch for 5.2? You can also add my: Reviewed-by: Jens Axboe to it. > > 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); -- Jens Axboe