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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,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 A04B8C433ED for ; Fri, 30 Apr 2021 04:16:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1653C61450 for ; Fri, 30 Apr 2021 04:16:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1653C61450 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5F9276B006C; Fri, 30 Apr 2021 00:16:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 55A8E6B006E; Fri, 30 Apr 2021 00:16:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D4046B0070; Fri, 30 Apr 2021 00:16:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0047.hostedemail.com [216.40.44.47]) by kanga.kvack.org (Postfix) with ESMTP id 1E7CA6B006C for ; Fri, 30 Apr 2021 00:16:37 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D2D508249980 for ; Fri, 30 Apr 2021 04:16:36 +0000 (UTC) X-FDA: 78087721992.05.AEF3DF7 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf01.hostedemail.com (Postfix) with ESMTP id EDBAA500152F for ; Fri, 30 Apr 2021 04:16:27 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 341236101B; Fri, 30 Apr 2021 04:16:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1619756195; bh=xhexiXbss3a7nAe5J1pREY15jAnW/gq8wn0LwB5fLgw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=2YqwBTJKXUnmfpyHTuBgrTeLpDen/BK/fRgjhh6RTzcIJReUpeNqFOK5RteKgCCy+ KVkkI5XaJeDLq5Ggn3Q0Fv3rE1/FErkuyzAX0dyb+fJLqk1ZvjKq5a+u09bAmjz4Ki az6Om78xeZmHXevcWYARg2t1wDzkMj0Wa0xPl4HU= Date: Thu, 29 Apr 2021 21:16:34 -0700 From: Andrew Morton To: Hugh Dickins Cc: Matthew Wilcox , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org Subject: Re: BUG_ON(!mapping_empty(&inode->i_data)) Message-Id: <20210429211634.de4e0fb98d27b3ab9d05757c@linux-foundation.org> In-Reply-To: References: <20210331024913.GS351017@casper.infradead.org> <20210401170615.GH351017@casper.infradead.org> <20210402031305.GK351017@casper.infradead.org> <20210402132708.GM351017@casper.infradead.org> <20210402170414.GQ351017@casper.infradead.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=2YqwBTJK; dmarc=none; spf=pass (imf01.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Stat-Signature: 9s89bytbsoc9hw8i7dc7xsiyt4scc1w1 X-Rspamd-Queue-Id: EDBAA500152F X-Rspamd-Server: rspam05 Received-SPF: none (linux-foundation.org>: No applicable sender policy available) receiver=imf01; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1619756187-460988 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 Fri, 2 Apr 2021 14:16:04 -0700 (PDT) Hugh Dickins wrote: > On Fri, 2 Apr 2021, Hugh Dickins wrote: > > > > There is a "Put holes back where they were" xas_store(&xas, NULL) on > > the failure path, which I think we would expect to delete empty nodes. > > But it only goes as far as nr_none. Is it ok to xas_store(&xas, NULL) > > where there was no non-NULL entry before? I should try that, maybe > > adjusting the !nr_none break will give a very simple fix. > > No, XArray did not like that: > xas_update() XA_NODE_BUG_ON(node, !list_empty(&node->private_list)). > > But also it's the wrong thing for collapse_file() to do, from a file > integrity point of view. So far as there is a non-NULL page in the list, > or nr_none is non-zero, those subpages are frozen at the src end, and > THP head locked and not Uptodate at the dst end. But go beyond nr_none, > and a racing task could be adding new pages, which THP collapse failure > has no right to delete behind its back. > > Not an issue for READ_ONLY_THP_FOR_FS, but important for shmem and future. > > > > > Or, if you remove the "static " from xas_trim(), maybe that provides > > the xas_prune_range() you proposed, or the cleanup pass I proposed. > > To be called on collapse_file() failure, or when eviction finds > > !mapping_empty(). > > Something like this I think. > I'm not sure this ever was resolved? Is it the case that the series "Remove nrexceptional tracking v2" at least exposed this bug? IOW, what the heck should I do with mm-introduce-and-use-mapping_empty.patch mm-stop-accounting-shadow-entries.patch dax-account-dax-entries-as-nrpages.patch mm-remove-nrexceptional-from-inode.patch Thanks.