Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4205357pxb; Mon, 27 Sep 2021 11:35:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRx+8vn2S6Y53eNwowmVxMNK/wJ/chbzluyeLANMBp8nmXpg2tBhz+xja9XR6P7wSlnb54 X-Received: by 2002:a50:e14c:: with SMTP id i12mr1805584edl.125.1632767740066; Mon, 27 Sep 2021 11:35:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632767740; cv=none; d=google.com; s=arc-20160816; b=0TFDo5kNsv/3jUgCSwOHRLM2uGiiJX1i/S6mzhBq5AJ/+JR5tv6Z59gGyKuzDe0n/3 +QGrQGbNe3EYTz/ZwguSsy7FEDYojrYzgGWBlgFHkMJk95Jk1Z1Kq5XaRne6YFrn4d1U ja3g3mujoQlBaS+6PDhUB+YyFBXMNoqTOoDE7d3QIhPjzAjnXFYt1/3eJ1F9ZqPmKWae 08hmVM7TOWNeJR1hFJtZN6H4khIVHkUMrCoCUHGW2AOQ2+YgGy/lv5KXbctMJ2QJ7kiM eeWB/B44BpZsKlwcHDKEHru9LQjAjY9VShGO3HGUWNwgnUGtU2gcbVED80lvjDP49ZdL XTiQ== 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=OkJDRTajjBYXZ9Lg7Znrw7BKNW4OCn6XI+sAVpYq6QI=; b=BmivRXs9yCioBHoTvAchoRKRRb+8Kg/3ShSoK3nAg7jiG+t67dmOm23fav1PLsN00u IWxlfNZjHxM83udKbEKFKamCVtzZRR6oEvsmqRs4jFJpBGxiCO78x5xIM1bRQzxaYsm2 n0VtYw9e4WdK8ghriDSdcE9/Lnj+azV+/ZdGUgfQ01DeFc0BhkF+qk6nWeAloLjiIlHT 8Ge9Kga5rVgGCXZE1vwv0UpnEYyg5EqFkDtVjZZJCrgfMPF4D0anN6jHuN32G6F+NtOB uT0pWiAKMbgqTuQJ9f+9ZpwIFLoVc+iarrZ8eOZO1qGkfy2qhnWOGR5waI0944wBS86Z QLuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20210112.gappssmtp.com header.s=20210112 header.b=qdXZo0VK; 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 u10si19353536edp.443.2021.09.27.11.35.15; Mon, 27 Sep 2021 11:35:40 -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=@shutemov-name.20210112.gappssmtp.com header.s=20210112 header.b=qdXZo0VK; 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 S236274AbhI0Sfd (ORCPT + 99 others); Mon, 27 Sep 2021 14:35:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236129AbhI0Sfc (ORCPT ); Mon, 27 Sep 2021 14:35:32 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 679F8C061604 for ; Mon, 27 Sep 2021 11:33:53 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id i25so81930402lfg.6 for ; Mon, 27 Sep 2021 11:33:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=OkJDRTajjBYXZ9Lg7Znrw7BKNW4OCn6XI+sAVpYq6QI=; b=qdXZo0VKKvGxILef7JmwcenBcQKasiE54pz+WtZ2c1nuNKo0FWwkU4SAgC8IVJn75f mjCpRzf2uF1ul1E1lLRt6og0U0UE8lupicpoy8MsJhx87RW7ZRF2/IiAQk3X1EUkad/H SVS+td1Hcckzl3bVIQ07SGPH73T8NApdeMk8LCcoF2OmE1LvJCngQws8nZxjbVLviqFi MxSH0Z+tnuLGIuvHGzZCKU2j4H7he35g2cRq+JBRytRejIalREMLXhS8wizSW8YBtCx5 yBzTEMlPIXVM4MsxAAcqg2DzUqMznWk6dIwbo5IJOFQPk0OMFQy66/jsTIEPNfLt13Kq kzEA== 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=OkJDRTajjBYXZ9Lg7Znrw7BKNW4OCn6XI+sAVpYq6QI=; b=z+lpo0qd+EjUXlnVHwTiIQG5NExrU37Hy4tkK6ubcvS6rn3SB3yVlSh8qarU1SHXNU T11CQxBkxYK6cl9urhswnGjU8Z/sq0GenjVEe6glvWno3CHStWURiMzC7bbZfyUj7jRH RqtojvlLTPYG8dcBNbeQ6OKdCFvcJpUhJ+bGNC0bFbVi9AQ5JJkC6vpULgiFZb4+jcPs tEvCP3n8wXyaqrSGzLRI8i0fd1QN4W7y/sgVLknGphBB1gg9Xqov9tT8EbXdd0yLzwg0 qsFZTK+VkZj8q9fAJZ+t+RwM/+4JRbP2Q++xEZwsR78FSIySeUiipYydowZcFcFEY2GD AZwA== X-Gm-Message-State: AOAM533DiAYZx2yeOhwxiNrJ/N3LvrOeHRAqKY2wdsZ30ikTq/bphXxh feK7p3u6iqn/vhuq3WlNED5IVA== X-Received: by 2002:ac2:561c:: with SMTP id v28mr1153727lfd.457.1632767631753; Mon, 27 Sep 2021 11:33:51 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id n9sm1672309lfu.88.2021.09.27.11.33.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Sep 2021 11:33:51 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id E89C5102FE0; Mon, 27 Sep 2021 21:33:50 +0300 (+03) Date: Mon, 27 Sep 2021 21:33:50 +0300 From: "Kirill A. Shutemov" To: Matthew Wilcox Cc: Vlastimil Babka , Kent Overstreet , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Johannes Weiner , Linus Torvalds , Andrew Morton , "Darrick J. Wong" , Christoph Hellwig , David Howells Subject: Re: Struct page proposal Message-ID: <20210927183350.obd756wnsctukf63@box.shutemov.name> References: 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 Mon, Sep 27, 2021 at 07:05:26PM +0100, Matthew Wilcox wrote: > On Mon, Sep 27, 2021 at 07:48:15PM +0200, Vlastimil Babka wrote: > > On 9/23/21 03:21, Kent Overstreet wrote: > > > So if we have this: > > > > > > struct page { > > > unsigned long allocator; > > > unsigned long allocatee; > > > }; > > > > > > The allocator field would be used for either a pointer to slab/slub's state, if > > > it's a slab page, or if it's a buddy allocator page it'd encode the order of the > > > allocation - like compound order today, and probably whether or not the > > > (compound group of) pages is free. > > > > The "free page in buddy allocator" case will be interesting to implement. > > What the buddy allocator uses today is: > > > > - PageBuddy - determine if page is free; a page_type (part of mapcount > > field) today, could be a bit in "allocator" field that would have to be 0 in > > all other "page is allocated" contexts. > > - nid/zid - to prevent merging accross node/zone boundaries, now part of > > page flags > > - buddy order > > - a list_head (reusing the "lru") to hold the struct page on the appropriate > > free list, which has to be double-linked so page can be taken from the > > middle of the list instantly > > > > Won't be easy to cram all that into two unsigned long's, or even a single > > one. We should avoid storing anything in the free page itself. Allocating > > some external structures to track free pages is going to have funny > > bootstrap problems. Probably a major redesign would be needed... > > Wait, why do we want to avoid using the memory that we're allocating? Intel TDX and AMD-SEV have concept of unaccpeted memory. You cannot use the memory until it got "accepted". The acceptance is costly and I made a patchset[1] to pospone the accaptance until the first allocation. So pages are on free list, but page type indicate that it has to go though additional step on allocation. [1] https://lore.kernel.org/all/20210810062626.1012-1-kirill.shutemov@linux.intel.com/ -- Kirill A. Shutemov