Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4277775pxb; Mon, 27 Sep 2021 13:18:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8uqxrXvCNzrvVCeAcPEg5hF4UoyJE+6zoSVApjZTXrhSM02L5Oxp9OzCe8pJefU+Zq1XB X-Received: by 2002:a05:6402:14c4:: with SMTP id f4mr2567740edx.358.1632773912967; Mon, 27 Sep 2021 13:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632773912; cv=none; d=google.com; s=arc-20160816; b=n0Rbj1busonUN+R70q5FraYr3Bsn/BuzlOuIanURY8LmIdqEdk6hS3xEvbrxMyfp1m Q0GzOYC2OcwtouWaw5XfW0zgpR8q6yblOrzGskFWmW9KBw6Ez8c8ZzBN+LtI0EeaC4ai GjwMzVQCHBkp1xXcc2s+Ka7rgt4dlhpoL3EXRIhVXJM4JpfQSxwwBIdbfAzBKo1bWcn9 WZ3QPqXWrdQ1td2keIKowBbbozTqox/9+D6gMJ+fZDQzaFABZrAGu/0kypnDhE8Z/Dd6 EIQ52W+2YXBAdfX1mUvi7ksIYBp8AYYC+JfR2ZO++cbepYRhydIuzeW8gI1+VRdLTAfS Jz5g== 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=dhNnXoM4/kD5Ud9oMMKJyEm+bWRWXvGwSSto7Gxhiho=; b=EXn+nOSHquM8orvTlLWGxY4ZnH0w7YHoW67bLv8FaDvO/lInpvtuL8WbykyJ1wVK7L os7X8au0jwxQpsOLNflfP4ZiDN5otrmt0zuGQ3XW1lLGzq/kwaxdtQwLbUi0QIIuxbba vN5e1KmDf9hfAel5LJO/55nYiN8Syc/DwJ3WsTQh0f9xDM+f58cfjw9jP0KlcGYvmz2B 8tG3O6r+yErtsPoyZTl+0sfdeuXR1f6VD8kfQUa/zSW0f9w41iDL4F6P8OuWyCQ4/1UK 8NRaGFPH+BPfy9VwuNyjTQabNT4V/uqVmoDZoccRw9kbXkd12N6UjE5MghgJcO8+vELZ ccpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aTv822IQ; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m8si4411248ejl.340.2021.09.27.13.18.08; Mon, 27 Sep 2021 13:18:32 -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=@gmail.com header.s=20210112 header.b=aTv822IQ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236942AbhI0UPt (ORCPT + 99 others); Mon, 27 Sep 2021 16:15:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236763AbhI0UPs (ORCPT ); Mon, 27 Sep 2021 16:15:48 -0400 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24F6CC061575; Mon, 27 Sep 2021 13:14:10 -0700 (PDT) Received: by mail-qk1-x735.google.com with SMTP id b65so37865056qkc.13; Mon, 27 Sep 2021 13:14:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=dhNnXoM4/kD5Ud9oMMKJyEm+bWRWXvGwSSto7Gxhiho=; b=aTv822IQ2e0pZ2pxXxky0UTQdahhhbjP/V6fwFenhlv1ZZ3Wq5FjDa/aDGaZCiWj1F Pdwc8lVSon0UCQfNi/fPqmCMRNsVpXE0cRKBW2IBb3gmQXf2s1fZDKkl2LO5oEQYzhz3 Znv9OEEqWXNzQfkqZDLepum3CD+uq16RsQxCtlFUK4GrZOMulM8fq0Y+Q+DaNRr5W0Zg T5NpZCNfsLTKaBMosjjSd9eciABpZ0AhK6N04bvSga2DqQoFK2OFrXyW150k6Vh5s1ks MBXlUJuKKo7tud+tE5KMhm07che6oUuqokvAQuUxdMdQbdVLPXDnB0cVNo7arQe6THXu 9S1g== 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=dhNnXoM4/kD5Ud9oMMKJyEm+bWRWXvGwSSto7Gxhiho=; b=qDRQFoEjK02h9O44lsTgYgsbpDBJBkzHo2uTNeEkmhJBNf2HhpIdOqHmJH7ZRRY3dk JRYYgVvbzE/zhRiOzOSld9dfBIWLTaDUyEi6+J9rBZ+dvecDXnFCOWhq8wyyZ5Nupstu fAmYJGHXza5vIjRk2ahe3r8KUuCqlYnA0lbomD4KaoRAnVlX55Xj8DjUDeQ1bLMdgQqJ FYeqrevgnQgI2UXLnLempyTEnz1Wh0tt32fwSyTCshNUkuUoRAniENC+Ep4TgP08lMNc X/LOkAExWFBn0bIVeAdHJBPZDqxh2hBjbmD/0Ot3iFgV7u97/qBRe/6Q9OJ0IaFmc3Gq XmSw== X-Gm-Message-State: AOAM530oBJc5yRYk40NzA4qohmpZ6SdUOjU7jP0z1QqpWfHrnocnsqID teG7SK2TaJ2NNDna0jBF9g== X-Received: by 2002:a37:6487:: with SMTP id y129mr1859019qkb.419.1632773649193; Mon, 27 Sep 2021 13:14:09 -0700 (PDT) Received: from moria.home.lan (c-73-219-103-14.hsd1.vt.comcast.net. [73.219.103.14]) by smtp.gmail.com with ESMTPSA id 14sm11299016qty.93.2021.09.27.13.14.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Sep 2021 13:14:08 -0700 (PDT) Date: Mon, 27 Sep 2021 16:14:06 -0400 From: Kent Overstreet To: Vlastimil Babka Cc: Matthew Wilcox , 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: References: <751358b2-aec2-43a3-cbbe-1f8c4469b6d3@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <751358b2-aec2-43a3-cbbe-1f8c4469b6d3@suse.cz> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 27, 2021 at 09:07:21PM +0200, Vlastimil Babka wrote: > On 9/27/2021 8:09 PM, Kent Overstreet wrote: > > 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: > >>> 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? > > > > The issue is where to stick the state for free pages. If that doesn't fit in two > > ulongs, then we'd need a separate allocation, which means slab needs to be up > > and running before free pages are initialized. > > So that's what I meant by the funny bootstrap problems - slab allocates pages > from the buddy allocator. And well, not just bootstrap, imagine free memory > becomes low, we need to reclaim pages, and in order to turn full pages to free > buddy pages we need to allocate these slab structures, and the slab is full too > and needs to allocate more backing pages... > > By "major redesign" I meant e.g. something along - bitmaps of free pages per > each order? (instead of the free lists) Hm but I guess no, the worst case times > searching for free pages would just suck... We can have arrays of pointers to free pages - then within struct page we'd keep the index of that page in the freelist array. To take a page off the middle of the freelist we'd just swap it with the one at the end. And instead of using a literal array, we'd want to use a simple radix tree.