Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1176437pxb; Fri, 27 Aug 2021 03:05:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyP0+6zS/jfOlBEOBdjH7PWFsOkHDx6GOhcQ+RXph17eRWjHWRhemjjT5DxWYC5RJQIQKv X-Received: by 2002:a17:906:585a:: with SMTP id h26mr9329140ejs.31.1630058750825; Fri, 27 Aug 2021 03:05:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630058750; cv=none; d=google.com; s=arc-20160816; b=OWrwSXBGQ1sauNwTkT3yRiI9loBzoxcXUTRnkrfgDDGYUS0W01ozJJIUtIt5x4QQCf Xlsvk7pQAKbXcgozF30aom28RsP7mQuOh5lPGqoA931nzFgq5x0Le7R4w9o4zrURfhTY RC9OvFQZIypzQwMmpz38st/RgocVn78+owQ3hzM6YBhMIo3E/prOCeUUtGByovHeIsn1 S/Q9DMjBsM7ovUDpsIV++joe3L1lwM83xuZxFIFBqiRx1Z9HPnxYW467tCXKG/XUU3nV EF4fSmHO2GjsHTAfy44YJ9Fo3KkjoZP0Zjq2P2H3cPdXVuAC3XuT7R7/X3ET2kLR3rZm 5zyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rQfDhKdyv4fg+r/Y8tJRlauQXOHaMeoAScvmzQy4FHs=; b=HbOMMiHOaZCdcs+X24BGj430H4p2+YjVWu4P/w3Q38/Y4kSyrPbZ75qCheDrjwR6Cb RFBJoTJtosFTRCQLEDR+HpScv6S867GmnGHtiUwVsWLdLDgpjgNDNckmCWaBnaZHBrMA 25dJr+1DDhhRqMZGMW1M8VWbtW1KrITp0jlAY07OG4KRH6NexdQZCImf8JRvQvd2+ZyQ HX8ckD7Xi3YTzHcEjdX9KQAyiYnAIwl4RZM4BnxHNygy33CYRluCTDyoVE2PM3EJ0lML KwnSiwc/bGW7JpUwhYLt5YKbRBSiZTuTgNfrFN+oH77upYfPI9rrxQuaCIub1P7NpuPQ g68g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=RTLv6h70; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gs41si601114ejc.326.2021.08.27.03.05.26; Fri, 27 Aug 2021 03:05:50 -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=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=RTLv6h70; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244753AbhH0KCc (ORCPT + 99 others); Fri, 27 Aug 2021 06:02:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244755AbhH0KCb (ORCPT ); Fri, 27 Aug 2021 06:02:31 -0400 Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEF7EC0613CF for ; Fri, 27 Aug 2021 03:01:42 -0700 (PDT) Received: by mail-qt1-x829.google.com with SMTP id g11so4876289qtk.5 for ; Fri, 27 Aug 2021 03:01:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=rQfDhKdyv4fg+r/Y8tJRlauQXOHaMeoAScvmzQy4FHs=; b=RTLv6h70dh2KQII/tDH9L9yJ8miO9zpfOpvNplcUXADClA/t4d04/dUTNNJuQ3shw7 cizitKFTo0u79Z/fmo8Ln2MzW97bK94RB1e0dJizK4fFMqJTyT1WYhAiMn6IIshUXs3p NBvDuATr9/eQf0W6A8AsuNdaLBwYcklIw9yWyR5a9Dj90sit/Oa4s2DBKB9XcaJyj3X9 tfzrB1/Rqbb2/O8RwETIUQVk9gSJ2brJd9NkuFvst0k7e1vSxkdoqC+jEz7KI691SSv9 pJqiEDWUJI5KjpFTHzOkrKEWPpUebnJ/6n6TJrckDM/JI2+cwSxa0AAmXl3iSIUoj7fm PUFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=rQfDhKdyv4fg+r/Y8tJRlauQXOHaMeoAScvmzQy4FHs=; b=bP6f0cGgJes9GafWEzATMqIobbuFAqUvww9OVuhTg9FuaYcaBBR2hLy7CKeqg6pTqe dxjjHiDpcIRHQm6J7rNYUiwAYW4/8+qbZbDMKtAwzkgP19Imv2VqZSvYlQilnYoHW0NA mgzk2Rogu5gtECbc+J7iEZ7Qe1KgChcV9lfnoC1/HWXB6K61pCuPo+pEHCR3KeJPBLXM Y6uL6CDDM6Yp2B4X/ImWt4tOoKFx2Xafg/6fBVt3RKkEP7kjxJjTBKo6yQEuswCaPsnk uIhKE7uzIDADrx2/QBEGPGay8ImQJIBxC/fIXRdYRAHKogShLX6YWi2tVjFbWhl+udrV IuSg== X-Gm-Message-State: AOAM5320peTLUTa3WriPsvumXqJa9H3s+Jd/Yhz3F5ZtIiXvhHSLvn6C Cq+Hk1QBaECwD+Jsa1vSxRTUiQ== X-Received: by 2002:a05:622a:13d3:: with SMTP id p19mr3218319qtk.61.1630058501778; Fri, 27 Aug 2021 03:01:41 -0700 (PDT) Received: from localhost (cpe-98-15-154-102.hvc.res.rr.com. [98.15.154.102]) by smtp.gmail.com with ESMTPSA id c11sm3330069qth.29.2021.08.27.03.01.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Aug 2021 03:01:40 -0700 (PDT) Date: Fri, 27 Aug 2021 06:03:25 -0400 From: Johannes Weiner To: David Howells Cc: Matthew Wilcox , Linus Torvalds , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Morton Subject: Re: [GIT PULL] Memory folios for v5.15 Message-ID: References: <2101397.1629968286@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2101397.1629968286@warthog.procyon.org.uk> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 26, 2021 at 09:58:06AM +0100, David Howells wrote: > One thing I like about Willy's folio concept is that, as long as everyone uses > the proper accessor functions and macros, we can mostly ignore the fact that > they're 2^N sized/aligned and they're composed of exact multiples of pages. > What really matters are the correspondences between folio size/alignment and > medium/IO size/alignment, so you could look on the folio as being a tool to > disconnect the filesystem from the concept of pages. > > We could, in the future, in theory, allow the internal implementation of a > folio to shift from being a page array to being a kmalloc'd page list or > allow higher order units to be mixed in. The main thing we have to stop > people from doing is directly accessing the members of the struct. In the current state of the folio patches, I agree with you. But conceptually, folios are not disconnecting from the page beyond PAGE_SIZE -> PAGE_SIZE * (1 << folio_order()). This is why I asked what the intended endgame is. And I wonder if there is a bit of an alignment issue between FS and MM people about the exact nature and identity of this data structure. At the current stage of conversion, folio is a more clearly delineated API of what can be safely used from the FS for the interaction with the page cache and memory management. And it looks still flexible to make all sorts of changes, including how it's backed by memory. Compared with the page, where parts of the API are for the FS, but there are tons of members, functions, constants, and restrictions due to the page's role inside MM core code. Things you shouldn't be using, things you shouldn't be assuming from the fs side, but it's hard to tell which is which, because struct page is a lot of things. However, the MM narrative for folios is that they're an abstraction for regular vs compound pages. This is rather generic. Conceptually, it applies very broadly and deeply to MM core code: anonymous memory handling, reclaim, swapping, even the slab allocator uses them. If we follow through on this concept from the MM side - and that seems to be the plan - it's inevitable that the folio API will grow more MM-internal members, methods, as well as restrictions again in the process. Except for the tail page bits, I don't see too much in struct page that would not conceptually fit into this version of the folio. The cache_entry idea is really just to codify and retain that domain-specific minimalism and clarity from the filesystem side. As well as the flexibility around how backing memory is implemented, which I think could come in handy soon, but isn't the sole reason.