Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp303795pxb; Mon, 25 Oct 2021 08:37:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9LxnBuw7urJhKlNBpAXSKoaKm1qcQY8sG8/19w67tB0oe4reYdaoDzibHScDiGC9QKVqP X-Received: by 2002:a65:5382:: with SMTP id x2mr14286122pgq.176.1635176229953; Mon, 25 Oct 2021 08:37:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635176229; cv=none; d=google.com; s=arc-20160816; b=lrSbGUyaPpAjOv2cnHqib78Qe6gpUph1IY40jts7yc2jNwpwD0cRbl2CNDFurZajML gid/Trtjw2XPNoKF8M+/oe2cNkWn83Jf5CiA3880mTVLdl9pr+onre9m986eeSKrL6zp K4Dw8lRLFKJcLhECq8PZ+naMbPm9XGjsqz5rurTIEOrwqbfZz/gvwlc7x1qQxnNJF/Li PFdw5op3CMKfo7L1IVeBnMgG30aX2NHwmgifi8VFbncdLIkGZaMQjCBUVXkZDFtEDITP PxMLL9KO5uncyCXwC37NjtWIcj8FNPPNBk3CE5XcZgBhZSqumDBszCOlwJ6p3yyNMO/s KBNQ== 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=APD+8v+yzG8mONZt5PB1dtOtV91cn6z6YYGiPhcEgzo=; b=OIY4PulahACkC05ojYXT2gynKBW+hEBoMdqg+cmXbzxVT6NriLsO5CrzYTRHsJDyHI B9SxEl9YykTJavsJoVvUxeyLviyc6vY8isJOAqumOCA5NVQ/fUK8L1BNlbScWadSLn8z O+S4lB4JgEGprTURv4jBt3DI7rlqHArBl/apzeT9IcP9GLRAlZtcqIdIQzOTadp/dzuF +NL5Y2ZEYHKXrapKsE7y4K4xgdqh9xBl6HWGzclw5qq/E+jgmYroqvfGz14zD+MVvcsO W4ou557klfhveuBKoC50toe1dctrmigtO7fsru14fh6qvDV4TgmWwg+cQF2A5d+Zuw4Q f0iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=CZaXqzxg; 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 c12si24465900pgv.89.2021.10.25.08.36.54; Mon, 25 Oct 2021 08:37:09 -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.20210112.gappssmtp.com header.s=20210112 header.b=CZaXqzxg; 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 S232887AbhJYPhv (ORCPT + 99 others); Mon, 25 Oct 2021 11:37:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230348AbhJYPhu (ORCPT ); Mon, 25 Oct 2021 11:37:50 -0400 Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C5DFC061745 for ; Mon, 25 Oct 2021 08:35:28 -0700 (PDT) Received: by mail-qk1-x731.google.com with SMTP id j12so12166127qkk.5 for ; Mon, 25 Oct 2021 08:35:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=APD+8v+yzG8mONZt5PB1dtOtV91cn6z6YYGiPhcEgzo=; b=CZaXqzxgV/rFXwcgME6NqnXsQ2goBIjelkXHFJWnQcpvj8y/TgAuRvl1PplMgFMRk9 3NeQRqG0cgoeOAyt4otEEMtnupURSPQnffElUrBbakcf5GHNQRYYjEBbBh7per+4WjTd 5mcpx+8Y7OSDPjwvdaGXaDiF0A4jDQ+V+Nuo+Y98Saezte+NRxzJpqwnOQ65PsL5mB4u 3A9AIUTPKaNLCUotpFMISOnVrGrM9f1u0qTDIGNxDl++B8T2DUETdBLlXg0QBGqzKRlU g1vSkVFXOWF7o8DFyVZRhOW4UXcgnoGA3T1niASsvcEk4BFF2zKLow7cl/6i0sBXErcM DdCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=APD+8v+yzG8mONZt5PB1dtOtV91cn6z6YYGiPhcEgzo=; b=A0R2juAOJ4a3u1iKBHdKL+Q0StOhlN/b0IntS475dDn/Z00A6vohp1mI/ZtJwrGqZy 6F4DlS6E5ReR8PrF3z4HRmnyx5z9KWuljSJWxa2IwQZjJMrAwXFACylzrEvbxC5PsQU3 Lk3TqcXRfQgrJKmk3eaDT5L+mbQXsgDWXgba+R43zpvMogOnFGDq5SpIla26+BsNsUpq 675rcRiuRiAQ+BnENxkTyAqEG/+lSVsCXa5q1yoKDrmP+JkogE1odi6QjhVDiazMEBJm 7Y+Du22uxOxpzSoiDz0jSPDHbad40w42b7KXOyYRxg9lfB86JWcS1Mb4nIO6pq15K5+l 2bqg== X-Gm-Message-State: AOAM531Jj56ODZ7cokaO1ce3PHtCVTiKUY+ll9dmYSUTuKApMpwocr6P Yz4R0CXiyJ1gjhxBUL9RlWg00w== X-Received: by 2002:a37:aa43:: with SMTP id t64mr13450043qke.233.1635176127558; Mon, 25 Oct 2021 08:35:27 -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 t26sm8649908qtq.77.2021.10.25.08.35.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 08:35:26 -0700 (PDT) Date: Mon, 25 Oct 2021 11:35:25 -0400 From: Johannes Weiner To: Matthew Wilcox Cc: Kent Overstreet , "Kirill A. Shutemov" , 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 , Hugh Dickins Subject: Re: Folios for 5.15 request - Was: re: Folio discussion recap - Message-ID: References: <20211018231627.kqrnalsi74bgpoxu@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 22, 2021 at 02:52:31AM +0100, Matthew Wilcox wrote: > > Anyway. I can even be convinved that we can figure out the exact fault > > lines along which we split the page down the road. > > > > My worry is more about 2). A shared type and generic code is likely to > > emerge regardless of how we split it. Think about it, the only world > > in which that isn't true would be one in which either > > > > a) page subtypes are all the same, or > > b) the subtypes have nothing in common > > > > and both are clearly bogus. > > Amen! > > I'm convinced that pgtable, slab and zsmalloc uses of struct page can all > be split out into their own types instead of being folios. They have > little-to-nothing in common with anon+file; they can't be mapped into > userspace and they can't be on the LRU. The only situation you can find > them in is something like compaction which walks PFNs. They can all be accounted to a cgroup. pgtables are tracked the same as other __GFP_ACCOUNT pages (pipe buffers and kernel stacks right now from a quick grep, but as you can guess that's open-ended). So if those all aren't folios, the generic type and the interfacing object for memcg and accounting would continue to be the page. > Perhaps you could comment on how you'd see separate anon_mem and > file_mem types working for the memcg code? Would you want to have > separate lock_anon_memcg() and lock_file_memcg(), or would you want > them to be cast to a common type like lock_folio_memcg()? That should be lock__memcg() since it actually serializes and protects the same thing for all subtypes (unlike lock_page()!). The memcg interface is fully type agnostic nowadays, but it also needs to be able to handle any subtype. It should continue to interface with the broadest, most generic definition of "chunk of memory". Notably it does not do tailpages (and I don't see how it ever would), so it could in theory use the folio - but only if the folio is really the systematic replacement of absolutely *everything* that isn't a tailpage - including pgtables, kernel stack, pipe buffers, and all other random alloc_page() calls spread throughout the code base. Not just conceptually, but an actual wholesale replacement of struct page throughout allocation sites. I'm not sure that's realistic. So I'm thinking struct page will likely be the interfacing object for memcg for the foreseeable future.