From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DE1CC433F5 for ; Mon, 27 Sep 2021 20:14:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2C7F860EC0 for ; Mon, 27 Sep 2021 20:14:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2C7F860EC0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id A54EA6B0071; Mon, 27 Sep 2021 16:14:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A046B6B0072; Mon, 27 Sep 2021 16:14:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A5286B0073; Mon, 27 Sep 2021 16:14:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0143.hostedemail.com [216.40.44.143]) by kanga.kvack.org (Postfix) with ESMTP id 77E4A6B0071 for ; Mon, 27 Sep 2021 16:14:10 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 36D59181D75BF for ; Mon, 27 Sep 2021 20:14:10 +0000 (UTC) X-FDA: 78634455060.01.5AB4B0D Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by imf18.hostedemail.com (Postfix) with ESMTP id F06C7400208A for ; Mon, 27 Sep 2021 20:14:09 +0000 (UTC) Received: by mail-qk1-f173.google.com with SMTP id x12so4922954qkf.9 for ; Mon, 27 Sep 2021 13:14:09 -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=DbaTqnC+9kr1SnUuTdf4NUVj3vQrwlJvW6l/zpjaiUZcgJpajjoAnag1kQwoNLdd90 UwDQMwdl6/LAvWAjACUJ9bMuurzjkuCWXx0ew7EMzMVrtu4bQDQQCd5mzxXr2Z7c5vS5 8+nUqcPvRi2Fvs0L+5Kb7eUwrtVzDCiP3x8ZzEhyw9xEnKDqkgUF2K1k0J1Pry0K4n9G ydUfY5NWEAxjv39T2PAEtzdg9VJHfBP82O9MTnJdXahnhNTpXT/sOl56g8Nl//XMbJTF 6/n9r5U/FFp7zKH0Y7tsvbvU10gsZcVXeMs8Fl6Q+VcxKIMxsXVh+ckNKqhJPycTI6hX shlg== X-Gm-Message-State: AOAM53267k5E1EVnm4A28RpPxoVl8lTl+MyWWfzMYzG+y8bO1B3rRopI wIB3gMLjHpvuF67a1cYzig== X-Google-Smtp-Source: ABdhPJzu2wGNBljA0kG0GtLh/W3YGkvKnpEn3R2o7i+qb0H+dY3qQYmJHWnt75JTQp8fpXyln6LRAw== 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> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: F06C7400208A X-Stat-Signature: grcnfeb8qsoxk7owi5rx6n69h879ggou Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=aTv822IQ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of kent.overstreet@gmail.com designates 209.85.222.173 as permitted sender) smtp.mailfrom=kent.overstreet@gmail.com X-HE-Tag: 1632773649-818302 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.