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 ECDF6C433FE for ; Wed, 9 Nov 2022 20:02:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C69E6B0072; Wed, 9 Nov 2022 15:02:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 876466B0073; Wed, 9 Nov 2022 15:02:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 73E8E6B0074; Wed, 9 Nov 2022 15:02:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 6117C6B0072 for ; Wed, 9 Nov 2022 15:02:41 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3B91180B9E for ; Wed, 9 Nov 2022 20:02:41 +0000 (UTC) X-FDA: 80114976522.15.1BE3A9D Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) by imf29.hostedemail.com (Postfix) with ESMTP id BAD4312000C for ; Wed, 9 Nov 2022 20:02:40 +0000 (UTC) Received: by mail-qv1-f41.google.com with SMTP id o8so13052147qvw.5 for ; Wed, 09 Nov 2022 12:02:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=qUjjqGTtbizHcI9BkjA1bbaQvyi03Kds77EtaxwAMOc=; b=caxpXABKham28jkRCMVuppOgRUUTkdtrw/2Am/kpSQX8vfCvcXgzA5tN5BoA0/JAdW RQqEyP4SktRgMiJ//9sDtYoMQ/Uslxp/xDgXlr2MwLR5rtDgZT49zoYs4/0hN920RUSF VNg6OJoPEnT7C9VR5W1COo9N6mwZrZvszwL/s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qUjjqGTtbizHcI9BkjA1bbaQvyi03Kds77EtaxwAMOc=; b=bweikMzGQpZtry7k/ZtyAL063Ba/8B+k0TxyLvbmHd7luo8UfWdv9Z5HLEmSD7ljgI byo656QzSdKD30QUkLNjBLiCKiWCsMM8wxz9j31tXRQU8+WqJiWjqyFK1QiADQTMg8HZ FN61F9LHFQKT/t5CXi+GoHFfV8Ah0lBSKYeV4THsqDHYXyWb8slfJDlVzq6r3XMr6DE1 5tVWu77Ht3eQfx6WDuXFOb/WTjq7xX58yM3BZ32xs1TJ4MnoEuJ+Krh6QNz/DnwIQDsT b4GXEJv+Da9By7cn4gBo1kR3JrFTAsEwzysqF3O/89cC9xrTdHRy0Kjcl3NHBt0RAEYj j5zg== X-Gm-Message-State: ACrzQf1XMB1iYBt8zaoVKLk2foKcfGA7AehJ55un4vHMRc6vXgrOaet1 qHxpp0GCd7uhFjKDlhlRDdUViVVF3XlhFw== X-Google-Smtp-Source: AMsMyM7Itx4mrD9umJ1kg+KUDLAaf15DLReBmZlQUiRYHVwnKRbsDM/6wvEC90+L3TA262FLCeIEmA== X-Received: by 2002:a05:6214:5292:b0:4bb:634d:6505 with SMTP id kj18-20020a056214529200b004bb634d6505mr56764748qvb.61.1668024159699; Wed, 09 Nov 2022 12:02:39 -0800 (PST) Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com. [209.85.128.180]) by smtp.gmail.com with ESMTPSA id w11-20020a05620a424b00b006f474e6a715sm11223017qko.131.2022.11.09.12.02.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Nov 2022 12:02:37 -0800 (PST) Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-36ad4cf9132so172448567b3.6 for ; Wed, 09 Nov 2022 12:02:34 -0800 (PST) X-Received: by 2002:a81:8241:0:b0:370:5fad:47f0 with SMTP id s62-20020a818241000000b003705fad47f0mr51636729ywf.441.1668024154055; Wed, 09 Nov 2022 12:02:34 -0800 (PST) MIME-Version: 1.0 References: <20221108194139.57604-1-torvalds@linux-foundation.org> In-Reply-To: From: Linus Torvalds Date: Wed, 9 Nov 2022 12:02:17 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/4] mm: introduce 'encoded' page pointers with embedded extra bits To: Alexander Gordeev Cc: Hugh Dickins , Johannes Weiner , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668024160; a=rsa-sha256; cv=none; b=nC9YsDyUXsPAo89C8GxVWH5elzqM7wNFb3By1p9MxDxnlYInmEBGK1lNerG7JPmFRo1TZ8 14cvGGJyYImc6NeC9XBQltajttM1NSHbJjg3hUP/fJEN4C79E06lp2tNtOXHDmFU6fSvdS SA2VECNLex+/SWkw5C4j1TzOlduWmDE= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=caxpXABK; spf=pass (imf29.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.219.41 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668024160; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qUjjqGTtbizHcI9BkjA1bbaQvyi03Kds77EtaxwAMOc=; b=SXaoB+NSz4un4zgcr31gH/P0O4IsJ9bVT/3TVVN/1FyasDVswSx1uQawnkkyJoT47N4Bfj TpoNWmagkXVbQEywTNTg+fp+C8cPWZ3YVlpFPHzeeRlrHmY7mKHidEra+RyH6X6ah0VYnP jIs3CT6E1sqS4U/EiKow1xfTQ3gh0BU= Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=caxpXABK; spf=pass (imf29.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.219.41 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none X-Rspamd-Server: rspam12 X-Rspam-User: X-Stat-Signature: orntfd4xyi4o6ogggajrmfiun8xisqks X-Rspamd-Queue-Id: BAD4312000C X-HE-Tag: 1668024160-917586 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, Nov 9, 2022 at 10:00 AM Linus Torvalds wrote: > > But while I think a BUILD_BUG_ON() would be the right thing to do > here, I do not feel confident enough to really put that to the test. Oh, what the hell. Just writing that whole explanation out made me just go "let's try to re-organize it a bit so that we *can* inline everything, and see how well it works". And it does actually work to use BUILD_BUG_ON(), both with gcc and clang. At least that's the case with the versions of gcc and clang _I_ use, and in the configurations I tested. So now I have a slightly massaged version of the patches (I did have to move the 'encode_page()' around a bit), which has that BUILD_BUG_ON() in it, and it passes for me. And I find that I really like seeing that whole page pointer encoding be so obviously much stricter. That was obviously the point of the whole separate type system checking, now it does bit value validity checking too. So I'll walk through my patches one more time to check for it, but I'll post it as a git branch and send out a new series (and do it in a separate thread with a cover letter, to not confuse the little mind of 'b4' again). If it turns out that some other compiler version or configuration doesn't deal with the BUILD_BUG_ON() gracefully, it's easy enough to remove, and it will hopefully show up in linux-next when Andrew picks it up. Linus