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=-3.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 757CAC00A89 for ; Fri, 30 Oct 2020 12:08:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B96F5207DE for ; Fri, 30 Oct 2020 12:08:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RIdgxlY6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B96F5207DE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BAFDE6B005C; Fri, 30 Oct 2020 08:08:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B3B886B005D; Fri, 30 Oct 2020 08:08:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 966EA6B0062; Fri, 30 Oct 2020 08:08:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0027.hostedemail.com [216.40.44.27]) by kanga.kvack.org (Postfix) with ESMTP id 66D616B005C for ; Fri, 30 Oct 2020 08:08:22 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E80FB3626 for ; Fri, 30 Oct 2020 12:08:21 +0000 (UTC) X-FDA: 77428469202.14.kite15_631166027295 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id B7AB818229818 for ; Fri, 30 Oct 2020 12:08:21 +0000 (UTC) X-HE-Tag: kite15_631166027295 X-Filterd-Recvd-Size: 5508 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Fri, 30 Oct 2020 12:08:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604059700; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KxlJ8Mwn0Tke0WPb8nHZ6w8mEJXEo5j2Z00nnV/ApfQ=; b=RIdgxlY6iQ0/cWzjuztCs3yLSNoFPiu2wvIaeCkOUC5fJC4DEvcZKVQBJr0bW1toWZBdGY vYe5hM1+Dy5mAzwk4wyIKUNz5R7uxO9qJjcF9NwRFpEVh9+3VhGQSXo231aTSTTO6GAHT1 AuAH71UuqhM40pGz2hEU8IO2AsbOY1w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-50-AzIfXLJtNRSF2-f3T9HVoQ-1; Fri, 30 Oct 2020 08:08:18 -0400 X-MC-Unique: AzIfXLJtNRSF2-f3T9HVoQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1A88A101F000; Fri, 30 Oct 2020 12:08:17 +0000 (UTC) Received: from ovpn-66-212.rdu2.redhat.com (ovpn-66-212.rdu2.redhat.com [10.10.66.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id F238219C71; Fri, 30 Oct 2020 12:08:15 +0000 (UTC) Message-ID: Subject: Re: kernel BUG at mm/page-writeback.c:2241 [ BUG_ON(PageWriteback(page); ] From: Qian Cai To: Matthew Wilcox Cc: Christoph Hellwig , "Darrick J. Wong" , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jens Axboe , linux-mm@kvack.org Date: Fri, 30 Oct 2020 08:08:15 -0400 In-Reply-To: <20201022171243.GX20115@casper.infradead.org> References: <645a3f332f37e09057c10bc32f4f298ce56049bb.camel@lca.pw> <20201022004906.GQ20115@casper.infradead.org> <7ec15e2710db02be81a6c47afc57abed4bf8016c.camel@lca.pw> <20201022171243.GX20115@casper.infradead.org> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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: On Thu, 2020-10-22 at 18:12 +0100, Matthew Wilcox wrote: > On Thu, Oct 22, 2020 at 11:35:26AM -0400, Qian Cai wrote: > > On Thu, 2020-10-22 at 01:49 +0100, Matthew Wilcox wrote: > > > On Wed, Oct 21, 2020 at 08:30:18PM -0400, Qian Cai wrote: > > > > Today's linux-next starts to trigger this wondering if anyone has any > > > > clue. > > > > > > I've seen that occasionally too. I changed that BUG_ON to VM_BUG_ON_PAGE > > > to try to get a clue about it. Good to know it's not the THP patches > > > since they aren't in linux-next. > > > > > > I don't understand how it can happen. We have the page locked, and then > > > we > > > do: > > > > > > if (PageWriteback(page)) { > > > if (wbc->sync_mode != WB_SYNC_NONE) > > > wait_on_page_writeback(page); > > > else > > > goto continue_unlock; > > > } > > > > > > VM_BUG_ON_PAGE(PageWriteback(page), page); > > > > > > Nobody should be able to put this page under writeback while we have it > > > locked ... right? The page can be redirtied by the code that's supposed > > > to be writing it back, but I don't see how anyone can make PageWriteback > > > true while we're holding the page lock. > > > > It happened again on today's linux-next: > > > > [ 7613.579890][T55770] page:00000000a4b35e02 refcount:3 mapcount:0 > > mapping:00000000457ceb87 index:0x3e pfn:0x1cef4e > > [ 7613.590594][T55770] aops:xfs_address_space_operations ino:805d85a dentry > > name:"doio.f1.55762" > > [ 7613.599192][T55770] flags: > > 0xbfffc0000000bf(locked|waiters|referenced|uptodate|dirty|lru|active) > > [ 7613.608596][T55770] raw: 00bfffc0000000bf ffffea0005027d48 > > ffff88810eaec030 ffff888231f3a6a8 > > [ 7613.617101][T55770] raw: 000000000000003e 0000000000000000 > > 00000003ffffffff ffff888143724000 > > [ 7613.625590][T55770] page dumped because: > > VM_BUG_ON_PAGE(PageWriteback(page)) > > [ 7613.632695][T55770] page->mem_cgroup:ffff888143724000 > > Seems like it reproduces for you pretty quickly. I have no luck ;-( > > Can you add this? It turns out I had no luck for the last a few days. I'll keep running and report back if it triggers again. > > +++ b/mm/page-writeback.c > @@ -2774,6 +2774,7 @@ int __test_set_page_writeback(struct page *page, bool > keep_write) > struct address_space *mapping = page_mapping(page); > int ret, access_ret; > > + VM_BUG_ON_PAGE(!PageLocked(page), page); > lock_page_memcg(page); > if (mapping && mapping_use_writeback_tags(mapping)) { > XA_STATE(xas, &mapping->i_pages, page_index(page)); > > This is the only place (afaict) that sets PageWriteback, so that will > tell us whether someone is setting Writeback without holding the lock, > or whether we're suffering from a spurious wakeup. >