Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp8307pxy; Thu, 29 Apr 2021 21:19:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9G44SlYHK746RTR+9c/gvVkfN8j5dqVpl0JeQZYRAexGEBCQRsQlz7RtW3UxutnldZH34 X-Received: by 2002:a17:907:1b20:: with SMTP id mp32mr1984463ejc.495.1619756341285; Thu, 29 Apr 2021 21:19:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619756341; cv=none; d=google.com; s=arc-20160816; b=zMwU++01n7AWFTK3oLgP8YBhIzIgQvRayb/xxPe89Xxs1IIytPMcxsmz47OFrfcSaX qjLqdcs9FLDEjfu0eYPVGwKVutfpc/kS4EwjgX3ORh7FUz8ImS/c6xYDQf/cSJ6l8gF4 ceCUnQ3zAHt5wcAK6WN2Z7h3Sh+fZccPCQDsvoe3kYfstN4M6BSvBK+h5dA6Lff9ojXo 2JSjDHqco1hzs6WJqmfUZIEgyYwWQbVwCTT2JxlYxTvJy6C3G8U6RWL/xGTRWbLQelC1 4RpZKye651ou4OZYSGPz5KliSvBW5NzzMm+74MZ/mhhV1a1oAvLxwa8ubJEbXaeNi1zU JOsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=+1yq03pQVyXC1i5WlWQakG8ZEZAfkkFSQ0cg0OvVm8c=; b=o1/4G68LyVNN8xRm8aiQYj4GUD71hWy1oH82FFzt6gJoZF1JnXxk2KA3Dqaj8QI4Jv 4qbb6RlijR/GXBEGi90SPie1mNocwAoZ9C8LMb+/xmYIGXa1ACFUTQDiZUpPkyF7OoMr Inup9fn6vpOHjP5Y31/b6kcCvz5158yxB/MdHEKIidHPVG0Ew1t5g4Mn2fqnpG1qo9Rk bID8Xq3VwjQGxKvXHbQL4D4EfitIwmGyO+V0k7iINltkKnjNSgqhq/tuFLfJ3dv0B7Mz O2Ai0n0Xa3YL5z536MpszAOE7Hl3unuG7cBdgpziP+qSzw7Ve4IlqCc33RimMLibMdDJ zBuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=2YqwBTJK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c95si710660edf.106.2021.04.29.21.18.21; Thu, 29 Apr 2021 21:19:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=2YqwBTJK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229609AbhD3ERX (ORCPT + 99 others); Fri, 30 Apr 2021 00:17:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:55462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbhD3ERX (ORCPT ); Fri, 30 Apr 2021 00:17:23 -0400 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.