From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E1B5C38A2C for ; Thu, 16 Apr 2020 22:01:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 39F6B21973 for ; Thu, 16 Apr 2020 22:01:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="JevE7sur" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 39F6B21973 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 93D328E00BC; Thu, 16 Apr 2020 18:01:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 845B08E00E6; Thu, 16 Apr 2020 18:01:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 66BA18E00E5; Thu, 16 Apr 2020 18:01:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0098.hostedemail.com [216.40.44.98]) by kanga.kvack.org (Postfix) with ESMTP id 43D838E00E4 for ; Thu, 16 Apr 2020 18:01:34 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 0946045C1 for ; Thu, 16 Apr 2020 22:01:34 +0000 (UTC) X-FDA: 76715090508.18.lift31_47d86efdaec0f X-HE-Tag: lift31_47d86efdaec0f X-Filterd-Recvd-Size: 3016 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Thu, 16 Apr 2020 22:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=kMLTih8CX/GbD68c1YCwFJOmEFKi+9QpHvxsolCFJz4=; b=JevE7sur3OWGtTKp99HAl+14H1 PGOjJxot1la2A/fjqZB+Ciyc6kAZoIrw/0SOCHWFCF+WntMLV/+76lweFkJAw+pDNv9k1Khvl7LGt LAdDVVnhUtVjN+mkRS8Xo0EugTAAF9WZhQ/BrCj1fHf5o2+wx+KuGyYy0e4FqAYYjS3Pn731IbNRS Tat3rzfme1k8brNy8lkmqQAJ0lb1cqKp3qHqKpUkcTNxUXNB8qcHSCdpsgsVpwSYl9GkmJH2TPb5U UsFvwcVnviiv3GDd90obCuGt8VH4aS02Ch+afMr5mzyUCPVEPnHABwKc7gfTOvZc9QoYIcRhQNacs pGwA162w==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jPCZg-0003Uh-MX; Thu, 16 Apr 2020 22:01:32 +0000 From: Matthew Wilcox To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH v3 09/11] mm: Convert writeback BUG to WARN_ON Date: Thu, 16 Apr 2020 15:01:28 -0700 Message-Id: <20200416220130.13343-10-willy@infradead.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200416220130.13343-1-willy@infradead.org> References: <20200416220130.13343-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: "Matthew Wilcox (Oracle)" If this BUG() ever triggers, we'll have a dead system with no particular information. Dumping the page will give us a fighting chance of debuggin= g the problem, and I think it's safe for us to just continue if we try to clear the writeback bit on a page which already has the writeback bit clear. Signed-off-by: Matthew Wilcox (Oracle) --- mm/filemap.c | 4 +--- mm/page-writeback.c | 5 +++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index b7c5d2402370..401b24d980ba 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1293,9 +1293,7 @@ void end_page_writeback(struct page *page) rotate_reclaimable_page(page); } =20 - if (!test_clear_page_writeback(page)) - BUG(); - + test_clear_page_writeback(page); smp_mb__after_atomic(); wake_up_page(page, PG_writeback); } diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 7326b54ab728..ebaf0d8263a6 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2718,6 +2718,11 @@ int test_clear_page_writeback(struct page *page) struct lruvec *lruvec; int ret; =20 + if (WARN_ON(!PageWriteback(page))) { + dump_page(page, "!writeback"); + return false; + } + memcg =3D lock_page_memcg(page); lruvec =3D mem_cgroup_page_lruvec(page, page_pgdat(page)); if (mapping && mapping_use_writeback_tags(mapping)) { --=20 2.25.1