Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4192871pxb; Mon, 27 Sep 2021 11:17:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDySXl2ZEucZjOERanXkky6tn4xZx7oMVSy4K9ixP4i55urWb8KIsOKtHxHNeXTsv9ybA7 X-Received: by 2002:a05:6a00:1481:b0:43d:275b:7ba4 with SMTP id v1-20020a056a00148100b0043d275b7ba4mr1354874pfu.63.1632766678581; Mon, 27 Sep 2021 11:17:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632766678; cv=none; d=google.com; s=arc-20160816; b=qD1xgXKYykJROZwks3P85DTgnuAMLBbiLOqHlc7YpToYW8Kvi+Ifu28W2jl4P4uHJp 5BLPZ2G9FnsAp0JcsKb47rRPoV9tpfOLMDvnb6cOSEeiEwDkm8r0XWqiG8OYXZmGFjSl wgAd7krz/p9Lj7grazEQ2Kny1nEkj2A6o0LuNPNrQGleAbt9bWt95D6LrqI5p+yUosKR QspzNFW/JWL/mjMo89I+ySFELk5prqK/zTH2fzNHA95NEkC9QILSmSPZo29BmapLwuKI yxI3d+8Ek9fJnhBodBam6i16I5JkiRzPFYKtoZiLrRJH2N8dnFdGdv8mqdGytRBeUk8/ B5Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=jS5GOWeYO/PMnGFwElUXmol7i16a0IRUl5OnPrJSSw8=; b=j9zQoI/eKxCHYUgPJgdcjVhZs39zKNjmmU69YlPq+wGsQUnpL4tVGLT78uiNT1vuJt lQgXCL85hyEGHjR6VAmYYcpherYTi35fsMxZvkA5pIYnU7K8KE8FHm7tIC8ABrpUUNkt 2bHbgFZYrqSJ6dYhFWfwMht+QTOJ2zxkNl/W8u8BYKBvgGl1dyKjVirv+qVwjlAfdXgK c7oIh/ECWc6LoeIYLrTVGQYox7qiQ73jzWIfezk1XVs5uKLpy8/cVahchL+t25rbENj6 a8LPshOnZbbsN0tK1uXj0iiN3Jkw5brbe8ofsMrdrKnSqpQpcan/HCV4cBQRxh1q9T/i hikQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Drufaud5; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 22si243766pjr.173.2021.09.27.11.17.44; Mon, 27 Sep 2021 11:17:58 -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=@redhat.com header.s=mimecast20190719 header.b=Drufaud5; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235974AbhI0SR7 (ORCPT + 99 others); Mon, 27 Sep 2021 14:17:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32033 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235832AbhI0SR6 (ORCPT ); Mon, 27 Sep 2021 14:17:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632766580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jS5GOWeYO/PMnGFwElUXmol7i16a0IRUl5OnPrJSSw8=; b=Drufaud5rL3Zwihag5YgZoxHT7+EYRnG1JYSvMKx+RZPinMtfRTI9iUCHedv/VgFyG4Wq5 0kE7ksMGNSCdHgYs1XnyC3mg+GLU3rrjU4SiriD/6WZuAjLhjUfXmTiY8R2yMQG7vAH6k7 zLAwE2yDhL7aH6MSc/Q8qn/5pWyHFRU= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-185-rZd28iMJPzKe9FkhF-dulw-1; Mon, 27 Sep 2021 14:16:18 -0400 X-MC-Unique: rZd28iMJPzKe9FkhF-dulw-1 Received: by mail-wr1-f69.google.com with SMTP id e12-20020a056000178c00b001606927de88so1268205wrg.10 for ; Mon, 27 Sep 2021 11:16:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=jS5GOWeYO/PMnGFwElUXmol7i16a0IRUl5OnPrJSSw8=; b=SDkknNOPY628OqmxDsOZmENMWlXdygEUIrMrAcMU48qv74/nuFjznkXc7rdzL1qdzZ +4KcdGBELae1ZFJObHa/xVQirRmdstpGk9cEPVfl3fTORJGntjNiPWpUr78bRAOVwIQp qIyqxJTdQsubhYJ9tXVCJ8/ejb8kngexGctvQJCIw7aSjEtqrb3iyCc4mlvSYg4UjFsc 5sDMYZBhQY97yDegg5+BpRyF71PK8VtKAgIani/rTtKC6VW3EWkP0gY87SurjCKdioQq uFR3KNqURXGIQJkNLeOmdVvWbZaUb2c66HtSbIhuR1ALMJrasaG8rwsswWWWp3i8HVNx b+WA== X-Gm-Message-State: AOAM531qZEkOZDp0vJUNk6lU4A8UksyzYxNmFfMUxqL63Mq0VBlHIQqw 2HxhkCRXLCW8LGnak1ceA3wtIHSgsfJPI0yglTU5cEbmX2xwT911EvZAtfnQvsBjDPp84Bz5d6C vnZPrvovmVyJNtggYbledjMu0 X-Received: by 2002:a05:6000:1103:: with SMTP id z3mr1529643wrw.312.1632766577622; Mon, 27 Sep 2021 11:16:17 -0700 (PDT) X-Received: by 2002:a05:6000:1103:: with SMTP id z3mr1529627wrw.312.1632766577439; Mon, 27 Sep 2021 11:16:17 -0700 (PDT) Received: from [192.168.3.132] (p5b0c654d.dip0.t-ipconnect.de. [91.12.101.77]) by smtp.gmail.com with ESMTPSA id n15sm17686984wrg.58.2021.09.27.11.16.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Sep 2021 11:16:16 -0700 (PDT) Subject: Re: Struct page proposal To: Matthew Wilcox , Kent Overstreet Cc: Vlastimil Babka , 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 References: From: David Hildenbrand Organization: Red Hat Message-ID: Date: Mon, 27 Sep 2021 20:16:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27.09.21 20:12, Matthew Wilcox wrote: > On Mon, Sep 27, 2021 at 02:09:49PM -0400, 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: >>>> 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? >> >> 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. > > But the thing we're allocating is at least PAGE_SIZE bytes in size. > Why is "We should avoid storing anything in the free page itself" true? > Immediately comes to mind: * Free page reporting via virtio-balloon * CMA on s390x (see arch_free_page()) * Free page poisoning * init_on_free -- Thanks, David / dhildenb