Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp693046pxb; Tue, 19 Oct 2021 10:57:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3bawWs/qFqwrnwMIget5T7uLVCXaBxMn/HZUsRRqD4IwHs1sztTortxyXWROSOl7AiiKb X-Received: by 2002:a05:6402:3512:: with SMTP id b18mr54509578edd.15.1634666273479; Tue, 19 Oct 2021 10:57:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634666273; cv=none; d=google.com; s=arc-20160816; b=aIfPz39Ftj5OLUl79JyuTnRa4vRHxDoaBkvR9F3sylz7LrvT/gZbbigNYNWvEJzLGq 6BrT5LrMYm66+FtN/qkBMMh+ToFHmZiz8ZbcKPgm7zh3ag0QexdlNQ876tQXKfPu/3Lc PpqkFnH338rxziGdJ1YM+ok6Kj53oNbHO8D60KjPZRZq2z+MAd+7mqfs6n8WSD1Te2ME r5+Pr43ZKFDCeJA2j2BmY35bb2WwUuJ5qXa2KGCJ22BZdSnoDEgcYkZUEbPcfTEZLP6k H9Mygqok0s5hzkNZL+mzXqNPHS21mtd95XpkPgDwixzJSSkCGrwyv9NgLNH9N0gIKoU9 tt4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:dkim-signature; bh=8XjHbwaYHM5oHkGBVxzOHAKhrKSyHzfayy11ICOjKLU=; b=vDIQhi7X0/T/DOO/Nv2CIEMiEdY+rB/IhkFbn9+3YKfxGOGLTkhDtYQw5Bvg34Apce kgaNFiHDOsjVi5pVZCgCzOzuhYt+VxKededx9Za7ECZfnUKuu1KYFKZHtFt/I5a+Wnx1 Mqd6yCLj68MsW3noe72u25xxJPiLlwCwA5E9NH/xDerhBHxaSkWgeiRA/yHcVtLGXGer hukg/4rNc4SZo12u6ULCzi0JvqW5Wxo8koGwxhJIEbC+xwqjiD2BRHq6q0DPgM1zzBXH Row2L8J5L2izpSiFYvIJ4jbMvKH+bw8lWb0zRj6KGRbhYIgJ+P0YWQlZ/6rezF4vjrQZ 1V3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YxBiacY1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hs24si38754265ejc.59.2021.10.19.10.57.29; Tue, 19 Oct 2021 10:57:53 -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=@kernel.org header.s=k20201202 header.b=YxBiacY1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234869AbhJSR4t (ORCPT + 99 others); Tue, 19 Oct 2021 13:56:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:37956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234939AbhJSR4q (ORCPT ); Tue, 19 Oct 2021 13:56:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5328860F57; Tue, 19 Oct 2021 17:54:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634666073; bh=0lmHBiMAYwQI6ZLGGLhhIuhQ0S+abmoZURDHJhYO9DE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YxBiacY1zC4MphhR5iKglY+9y5xo38OaiVqWRhG40SjtxcNvYiFUV52YxQ20WiKeU wjhebfLkt4veySjZg7gP3hEJsJtsCymcp1asP5F8l2sHwCHMOoS0pHok8lD51j5pYE U1aB58E8NZtIwCOPQWtnGKgLBb9+ajDlzgucylgz0BkBgn/K/+L/5GSe+Oi/ITmkNf FLrQ7hD62IYXvvi++fBwsTfoKBoJNQW6Yy8JXg9M9LSRRdTS5tUPC20hx8250NeTNV 4MNuv/iD4bq4vSZ3ZD2op3k61ZVbgWIdaq4ip/tI0orZDJZ9GgfdVWWTVT3fDhL9UI 20j8dCjUWZmTA== Date: Wed, 20 Oct 2021 01:54:20 +0800 From: Gao Xiang To: Matthew Wilcox Cc: Kent Overstreet , Johannes Weiner , Linus Torvalds , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Morton , "Darrick J. Wong" , Christoph Hellwig , David Howells Subject: Re: Splitting struct page into multiple types - Was: re: Folio discussion recap - Message-ID: <20211019175419.GA22532@hsiangkao-HP-ZHAN-66-Pro-G1> Mail-Followup-To: Matthew Wilcox , Kent Overstreet , Johannes Weiner , Linus Torvalds , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Morton , "Darrick J. Wong" , Christoph Hellwig , David Howells References: <20211019170603.GA15424@hsiangkao-HP-ZHAN-66-Pro-G1> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Matthew, On Tue, Oct 19, 2021 at 06:34:19PM +0100, Matthew Wilcox wrote: > On Wed, Oct 20, 2021 at 01:06:04AM +0800, Gao Xiang wrote: > > On Tue, Oct 19, 2021 at 12:11:35PM -0400, Kent Overstreet wrote: > > > Other things that need to be fixed: > > > > > > - page->lru is used by the old .readpages interface for the list of pages we're > > > doing reads to; Matthew converted most filesystems to his new and improved > > > .readahead which thankfully no longer uses page->lru, but there's still a few > > > filesystems that need to be converted - it looks like cifs and erofs, not > > > sure what's going on with fs/cachefiles/. We need help from the maintainers > > > of those filesystems to get that conversion done, this is holding up future > > > cleanups. > > > > The reason why using page->lru for non-LRU pages was just because the > > page struct is already there and it's an effective way to organize > > variable temporary pages without any extra memory overhead other than > > page structure itself. Another benefits is that such non-LRU pages can > > be immediately picked from the list and added into page cache without > > any pain (thus ->lru can be reused for real lru usage). > > > > In order to maximize the performance (so that pages can be shared in > > the same read request flexibly without extra overhead rather than > > memory allocation/free from/to the buddy allocator) and minimise extra > > footprint, this way was used. I'm pretty fine to transfer into some > > other way instead if some similar field can be used in this way. > > > > Yet if no such field anymore, I'm also very glad to write a patch to > > get rid of such usage, but I wish it could be merged _only_ with the > > real final transformation together otherwise it still takes the extra > > memory of the old page structure and sacrifices the overall performance > > to end users (..thus has no benefits at all.) > > I haven't dived in to clean up erofs because I don't have a way to test > it, and I haven't taken the time to understand exactly what it's doing. Actually I don't think it's an actual clean up due to the current page structure design. > > The old ->readpages interface gave you pages linked together on ->lru > and this code seems to have been written in that era, when you would > add pages to the page cache yourself. > > In the new scheme, the pages get added to the page cache for you, and > then you take care of filling them (and marking them uptodate if the > read succeeds). There's now readahead_expand() which you can call to add > extra pages to the cache if the readahead request isn't compressed-block > aligned. Of course, it may not succeed if we're out of memory or there > were already pages in the cache. Hmmm, these temporary pages in the list may be (re)used later for page cache, or just used for temporary compressed pages for some I/O or lz4 decompression buffer (technically called lz77 sliding window) to temporarily contain some decompressed data in the same read request (due to some pages are already mapped and we cannot expose the decompression process to userspace or some other reasons). All are in the recycle way. These temporary pages may finally go into some file page cache or recycle for several temporary uses for many time and finally free to the buddy allocator. > > It looks like this will be quite a large change to how erofs handles > compressed blocks, but if you're open to taking this on, I'd be very happy. For ->lru, it's quite small, but it sacrifices the performance. Yet I'm very glad to do if some decision of this ->lru field is determined. Thanks, Gao Xiang