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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 460AFC433F5 for ; Wed, 9 Mar 2022 22:08:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DAA418D0002; Wed, 9 Mar 2022 17:08:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D59E18D0001; Wed, 9 Mar 2022 17:08:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C21B58D0002; Wed, 9 Mar 2022 17:08:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0235.hostedemail.com [216.40.44.235]) by kanga.kvack.org (Postfix) with ESMTP id B39D68D0001 for ; Wed, 9 Mar 2022 17:08:10 -0500 (EST) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 6BF54181CAC7D for ; Wed, 9 Mar 2022 22:08:10 +0000 (UTC) X-FDA: 79226236740.31.DC6D9E4 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) by imf25.hostedemail.com (Postfix) with ESMTP id D8B62A0015 for ; Wed, 9 Mar 2022 22:08:09 +0000 (UTC) Received: by mail-lf1-f43.google.com with SMTP id bt26so6239207lfb.3 for ; Wed, 09 Mar 2022 14:08:09 -0800 (PST) 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=vrzRO7DmEsu3cOettTYwW7UCWoPESsH1sMNrUtKi/nA=; b=D6wVcBiWwb900bMY/FETws43aV7d/ko8szzVk+WS/1DR8zDMaY02pV3MC0tbljgnh0 WzWCdAtyOwpv/1w8DCR8AZ6HTvBBoLgi0tmfvoHNHVgaE0PG1ZMJdGiaE0dVMTR2N5Iq kSr/dWbefbXW+jTenAzDyNmg7qSGnPTV6OdpU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vrzRO7DmEsu3cOettTYwW7UCWoPESsH1sMNrUtKi/nA=; b=kw+JGlN6BKq65Mj/+UhXkZ0XSe42uhUEvI/sAmikgMucFFDY2QV/baS0nOHnXbHfnT TJYwlhO/v8NQlRKO+FOtKh/6MWaMfawc0G5CjV1xpfLFbgbjtNy9IrSkTybvu3WK8QWo h2xLlpRsGkjUB2xMV4cmGfQg1TMl6QawpNBE9NUYhUhGoabdaafbAjbrDh3JHsFPiSSa EaNHWovqYy+7wuu0JG4Gz0N7gM2xg7rgJukMFBGFdIz5K6rklU5jxLFufmnBplZ1060b tJKxDcthuA/m01tef14SExwrAGgm8ARMPJtDMOFknoG28gw1grtl2m2zTarg2xocy6ou ylvw== X-Gm-Message-State: AOAM531fyT7OshYw0D37+V7xgGt99fF87mlDBi9JS4Z7PIYP2tfOoUkb /sVeeezDQ4ISiilsE51tkjLy9RTKQHHJDjrT4tQ= X-Google-Smtp-Source: ABdhPJxiF6urGG3Vuj06FW+6UxJLZiUwv+mx5TDvg7ZdxM9tAFZd7OurNKCIZBOnTuv2vTMBUaq4bw== X-Received: by 2002:ac2:4ac2:0:b0:448:373b:dca5 with SMTP id m2-20020ac24ac2000000b00448373bdca5mr1077358lfp.568.1646863687946; Wed, 09 Mar 2022 14:08:07 -0800 (PST) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com. [209.85.208.171]) by smtp.gmail.com with ESMTPSA id z4-20020a0565120c0400b00443823361d0sm606421lfu.243.2022.03.09.14.08.07 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Mar 2022 14:08:07 -0800 (PST) Received: by mail-lj1-f171.google.com with SMTP id v28so5167663ljv.9 for ; Wed, 09 Mar 2022 14:08:07 -0800 (PST) X-Received: by 2002:a05:651c:1213:b0:247:e2d9:cdda with SMTP id i19-20020a05651c121300b00247e2d9cddamr1025987lja.443.1646863686763; Wed, 09 Mar 2022 14:08:06 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Wed, 9 Mar 2022 14:07:50 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC] Free up a page flag To: Matthew Wilcox Cc: Linux-MM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam10 X-Rspam-User: X-Stat-Signature: frnqbqyi3tw4gwb3xgohet48mcte8mn7 Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=D6wVcBiW; spf=pass (imf25.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.167.43 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none X-Rspamd-Queue-Id: D8B62A0015 X-HE-Tag: 1646863689-69316 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 Wed, Mar 9, 2022 at 12:50 PM Matthew Wilcox wrote: > > We're always running out of page flags. Here's an attempt to free one > up for the next time somebody wants one. Ugh. This is too ugly for words. I wouldn't mind something along the conceptual lines of "these bits are only used for this type", but I think it would need to be much more organized and explicit, not this kind of randomness. For example, quite a few of the page bits really only make sense for the "page cache and anonymous pages" kind. I think this includes some really fundamental bits like the lock bit (and the associated waiters bit), along with a lot of the "owner" aka "this can be used by the filesystem" bits. I think it _also_ includes all the LRU and workingset bits etc. So if we consider that kind of case the "normal" case, the not-normal case is likely (a) slab, (b) reserved pages and (c) zspages., Which is pretty close to your "xyzzy" bit (I think you came to the same list of "slab or reserved" conclusion because of the fundamental issues above), but my point is that I think this approach is acceptable if we make it much less random, and make it a lot more explicit and thought through. And we'd probably need to actually *verify* that we don't do things like lock (or LRU) those non-normal pages. We already have some page flag bits that are only used for those kinds of odd pages: the page_flags field is used only for zspages, but other pages can (misuse) that field for PG_buddy/offline/etc. That whole thing is particularly ugly in how it tries to make sure there are is no mapcount use of it. So I do think something like your "xyzzy" bit can work, but I'd really want it to be a lot more explicit and a lot less random than "let's encode two special bits this way". Linus