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 X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39E4EC4320A for ; Tue, 24 Aug 2021 19:00:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D305F613B1 for ; Tue, 24 Aug 2021 19:00:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D305F613B1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 77AF7900002; Tue, 24 Aug 2021 15:00:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 72B9A6B0071; Tue, 24 Aug 2021 15:00:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F3CC900002; Tue, 24 Aug 2021 15:00:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0199.hostedemail.com [216.40.44.199]) by kanga.kvack.org (Postfix) with ESMTP id 466E56B006C for ; Tue, 24 Aug 2021 15:00:12 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E4281181AC537 for ; Tue, 24 Aug 2021 19:00:11 +0000 (UTC) X-FDA: 78510889422.20.468DB4A Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) by imf27.hostedemail.com (Postfix) with ESMTP id 7E32270000B7 for ; Tue, 24 Aug 2021 19:00:11 +0000 (UTC) Received: by mail-lj1-f170.google.com with SMTP id s12so14191140ljg.0 for ; Tue, 24 Aug 2021 12:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=y8GMAuZs3SF8G+2KitM/POFRgnyCkDTcN34+zOcLvgc=; b=aH6CPYiXxnGWOs0D+02Zg2N/IGvBu9mHmNR0D/J0PG92yW1XDHpw2xOFhxWZSK3zTn uydZvilXdZqJMGTtIQeufhHszHnba5FqFkcLSZ2sO8WPBh7xw3FVtx/KxdJbQbMuwp3Y DPkzbmfpvKe+X0kNdcEXYpRqTcu4VNMDQhRFA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=y8GMAuZs3SF8G+2KitM/POFRgnyCkDTcN34+zOcLvgc=; b=pKr9hMPq2ksbz93H4VZmiQou4U15gigau+kN/Z42tuKmWyCkNEkhhgA0sJZUlrSRzB XQQQbGlILTChoiigrnjyQxTV1b1Xki9iASBys4oAgj55ycQgGCBpckb0Z2aJW/o6Kva2 8qCzFk6c+lSFRa9qgPv5x0Deodu2xPGnLjwb8mHpOGM2GGpNQ0WhDXt0VJsFl+hVZCWw 31iZRUX3Y5LVxeTSQZmJ0oymxqjXYwwyCyYTsi8NSLqSexv6NbMxs7iIEC/isSHkIYPO 39svHuIg7HlKxbSvhdJYu2xK0u3kE47ZIiZt02q11L+nuL2mxfGiklv0xZxrNLx6+WgJ bn8A== X-Gm-Message-State: AOAM5304BcvkNvJrSXmVf7tWmddqP20T4wKLI8vnMsgqzBA/rAhVRe2j 94TIkjXcZFVWyuPpwYks9hACBxUn/9UJIWPb X-Google-Smtp-Source: ABdhPJyY8lBuJmxE8OGA7F7xPx2yG9nccp7ziSPX3zyo8LerzSJWMNYhnfd7z3rAC4VvfI1B+dLFcw== X-Received: by 2002:a05:651c:985:: with SMTP id b5mr33053590ljq.78.1629831609823; Tue, 24 Aug 2021 12:00:09 -0700 (PDT) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com. [209.85.167.49]) by smtp.gmail.com with ESMTPSA id t14sm34181lfk.215.2021.08.24.12.00.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Aug 2021 12:00:09 -0700 (PDT) Received: by mail-lf1-f49.google.com with SMTP id v19so22354144lfo.7 for ; Tue, 24 Aug 2021 12:00:08 -0700 (PDT) X-Received: by 2002:a05:6512:104b:: with SMTP id c11mr26021753lfb.201.1629831608481; Tue, 24 Aug 2021 12:00:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Tue, 24 Aug 2021 11:59:52 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] Memory folios for v5.15 To: Johannes Weiner Cc: Matthew Wilcox , Linux-MM , linux-fsdevel , Linux Kernel Mailing List , Andrew Morton Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=aH6CPYiX; dmarc=none; spf=pass (imf27.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.208.170 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 7E32270000B7 X-Stat-Signature: pgmiuso4fwn4utziyagi1y8ocxjbrnu7 X-HE-Tag: 1629831611-370946 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 Tue, Aug 24, 2021 at 11:31 AM Johannes Weiner wrote: > > Unlike the filesystem side, this seems like a lot of churn for very > little tangible value. And leaves us with an end result that nobody > appears to be terribly excited about. Well, there is actually some fairly well documented tangible value: our page accessor helper functions spend an absolutely insane amount of effort and time on just checking "is this a head page", and following the "compound_head" pointer etc. Functions that *used* to be trivial - and are still used as if they were - generate nasty complex code. I'm thinking things like "get_page()" - it increments the reference count to the page. It's just a single atomic increment, right. Wrong.. It's still inlined, but it generates these incredible gyrations with testing the low bit of a field, doing two very different things based on whether it is set, and now we have that "is it close to overflow" test too (ok, that one is dependent on VM_DEBUG), so it actually generates two conditional branches, odd bit tests, lots of extra calls etc etc, So "get_page()" should probably not be an inline function any more. And that's just the first thing I happened to look at. I think we have those "head = compound_head(page)" all over the VM code, And no, that "look up the compound page header" is not necessarily the biggest part of it, but it's definitely one part of it. And if we had a "we know this page is a head page" that all just goes away. And in a lot of cases, we *do* know that. Which is exactly the kind of static knowledge that the folio patches expose. But it is a lot of churn. And it basically duplicates all our page functions, just to have those simplified versions. And It's very core code, and while I appreciate the cleverness of the "folio" name, I do think it makes the end result perhaps subtler than it needs to be. The one thing I do like about it is how it uses the type system to be incremental. So I don't hate the patches. I think they are clever, I think they are likely worthwhile, but I also certainly don't love them. Linus