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 B1438C433EF for ; Mon, 27 Sep 2021 18:16:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 46EB160F6C for ; Mon, 27 Sep 2021 18:16:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 46EB160F6C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id C85386B006C; Mon, 27 Sep 2021 14:16:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C34576B0071; Mon, 27 Sep 2021 14:16:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AFBD6900002; Mon, 27 Sep 2021 14:16:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0006.hostedemail.com [216.40.44.6]) by kanga.kvack.org (Postfix) with ESMTP id A15A06B006C for ; Mon, 27 Sep 2021 14:16:21 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3ACF0274D2 for ; Mon, 27 Sep 2021 18:16:21 +0000 (UTC) X-FDA: 78634158162.20.498F6B7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf14.hostedemail.com (Postfix) with ESMTP id B78736001992 for ; Mon, 27 Sep 2021 18:16:20 +0000 (UTC) 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-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-28-Npczc5ZzNnGwg9xxnPvkTw-1; Mon, 27 Sep 2021 14:16:18 -0400 X-MC-Unique: Npczc5ZzNnGwg9xxnPvkTw-1 Received: by mail-wm1-f71.google.com with SMTP id 75-20020a1c004e000000b00307b9b32cc9so255144wma.1 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=ZPgDedkjUFLK3MEtghQdvg5exJjIJuKq1JecTG8gng10SJFhRccc7ZVnD+pjlAP8ya vJ/DQE+piUpNQ8n3lFZ7XdslPW2jhgkazi/9fQOWWYuuaGFrh446yjUruaKdWfpTe+Vc wp1IWZt4gwkMDr0tuvS+JgztFf7DTPUoTId6OIlIKrMVd/pUt2do5a0USCnhas3r7Cmd nfkDNwDDtMy17xWECtT/sGeDW750qVWBg5D5zviibT+rC+N9H8GJNRyo/E7VuEIfMZFH vc2M/O/5BuHwPRSqGM8e+hb+D0l93vA6E60Ye6kNp957+yUWaqCf2ocNYk7AiKGBmpH5 bYww== X-Gm-Message-State: AOAM531zG9pIWFE/2bRSQUobtm6UinJ5ywN6TXzeUjjlmX+CQdWnj3Kg vkT6wRxcHpIaYST11f/dZyGbW1nCD6jFbMbTQ7sbBCxBJny7vSw7OCYk483yHt4SeF19Wdb0Rok sTjQq/eJJ11c= X-Received: by 2002:a05:6000:1103:: with SMTP id z3mr1529653wrw.312.1632766577659; Mon, 27 Sep 2021 11:16:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxde2berEnif/kOAuNLM3Hq9ossbeVALJbBhinBf8mTyIIPx9GSxH9wvRZbz1S2MpTYzK7rA== 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: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: B78736001992 X-Stat-Signature: 7e43931w7hdhgbzwqpmrt3d157mb6tcc Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Drufaud5; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf14.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-HE-Tag: 1632766580-149152 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 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