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=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 A420AC433DF for ; Sun, 14 Jun 2020 16:26:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 59C05206A4 for ; Sun, 14 Jun 2020 16:26:54 +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="BFZhmc9k" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 59C05206A4 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 C9DB86B005C; Sun, 14 Jun 2020 12:26:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C4E1C6B005D; Sun, 14 Jun 2020 12:26:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B3BD26B0062; Sun, 14 Jun 2020 12:26:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0125.hostedemail.com [216.40.44.125]) by kanga.kvack.org (Postfix) with ESMTP id 912906B005C for ; Sun, 14 Jun 2020 12:26:53 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4E440824556B for ; Sun, 14 Jun 2020 16:26:53 +0000 (UTC) X-FDA: 76928346306.14.able63_1414b7a26def Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id 2572E18229818 for ; Sun, 14 Jun 2020 16:26:53 +0000 (UTC) X-HE-Tag: able63_1414b7a26def X-Filterd-Recvd-Size: 3478 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Sun, 14 Jun 2020 16:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=FBrl4ugPRoXqesloMxkA/RUdd2QTtkIhYi/oDtcA+pI=; b=BFZhmc9kch9DtqFlRZY6kAVze0 ptdNqXcCHmIzUSLc7FZSe4umBFI8Pt6SiK3Q6nFOXMw5x/CQJYpkQemlzbaf4uFbEMtB9HzpGd2rM 208bESHaF40xc/6lK0r8OXHZ2fUEjpNfsUnhSHqF8S8VX1tbIkM8ebmCjPeOyVVYtqRYwhb2GkXcU tbOe0xlNP2sYNXvCqhw//9pV0RJutqE8P0syXpHyw5+fCvpKNr7pFem9UKv4/7DkKpbR0LL0pJmxk SXFMDkCTnn3NXkXNLtSxRyCQCvj+tPBjXiFZPW9ABI9CMbRFgSbDjdu6YIqzc8bpTKZF4hbuCejXk NpWMhZBA==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jkVT8-0002sm-R5; Sun, 14 Jun 2020 16:26:50 +0000 Date: Sun, 14 Jun 2020 09:26:50 -0700 From: Matthew Wilcox To: linux-fsdevel@vger.kernel.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hugh Dickins Subject: Re: [RFC v6 00/51] Large pages in the page cache Message-ID: <20200614162650.GP8681@bombadil.infradead.org> References: <20200610201345.13273-1-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200610201345.13273-1-willy@infradead.org> X-Rspamd-Queue-Id: 2572E18229818 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 Wed, Jun 10, 2020 at 01:12:54PM -0700, Matthew Wilcox wrote: > Another fortnight, another dump of my current large pages work. The generic/127 test has pointed out to me that range writeback is broken by this patchset. Here's how (may not be exactly what's going on, but it's close): page cache allocates an order-2 page covering indices 40-43. bytes are written, page is dirtied test then calls fallocate(FALLOC_FL_COLLAPSE_RANGE) for a range which starts in page 41. XFS calls filemap_write_and_wait_range() which calls __filemap_fdatawrite_range() which calls do_writepages() which calls iomap_writepages() which calls write_cache_pages() which calls tag_pages_for_writeback() which calls xas_for_each_marked() starting at page 41. Which doesn't find page 41 because when we dirtied pages 40-43, we only marked index 40 as being dirty. Annoyingly, the XArray actually handles this just fine ... if we were using multi-order entries, we'd find it. But we're still storing 2^N entries for an order N page. I can see two ways to fix this. One is to bite the bullet and do the conversion of the page cache to use multi-order entries. The second is to set and clear the marks on all entries. I'm concerned about the performance of the latter solution. Not so bad for order-2 pages, but for an order-9 page we have 520 bits to set, spread over 9 non-consecutive cachelines. Also, I'm unenthusiastic about writing code that I want to throw away as quickly as possible. So unless somebody has a really good alternative idea, I'm going to convert the page cache over to multi-order entries. This will have several positive effects: - Get DAX and regular page cache using the xarray in a more similar way - Saves about 4.5kB of memory for every 2MB page in tmpfs/shmem - Prep work for converting hugetlbfs to use the page cache the same way as tmpfs