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 BC114C2BA15 for ; Tue, 18 Jun 2024 21:14:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 175AA8D0060; Tue, 18 Jun 2024 17:14:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 086D98D005C; Tue, 18 Jun 2024 17:14:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E90378D0060; Tue, 18 Jun 2024 17:14:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id CB28F8D005C for ; Tue, 18 Jun 2024 17:14:32 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 7C5EBC0B74 for ; Tue, 18 Jun 2024 21:14:32 +0000 (UTC) X-FDA: 82245263184.18.F448F9E Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf30.hostedemail.com (Postfix) with ESMTP id DD86D80005 for ; Tue, 18 Jun 2024 21:14:29 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=Rw5MiVuX; spf=pass (imf30.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718745267; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=uaYIO9mOzR45LjD20KsbSPwu0brJfS1NXeu0Lqvq4Tw=; b=3pAQP0zVTBNOHJ/IrAL4ZSgR4rMPcU8ZsX8I4jNmYabceHkNErMy9Ge3fk+n59OTNWUG5j DOHqPSr/YSrASQETGJBlHdHipoJQUDcCByNv4h8X1oM/N2e7D2Kbh/8ZzFmTKIYAfmuH4+ 8lpLwnF3ufgiCbEqbTNZrc6+uHbbqO4= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=Rw5MiVuX; spf=pass (imf30.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718745267; a=rsa-sha256; cv=none; b=JZroWatZMhd5A7tzfveaAeepsRlUhhvAbrN8Sg0yhcW02kvDxy0ujHM1vju5PyrhYYHNXF 6EeBzu48jNal0r9ldArylWqDywNw2lYs2ueJUBpc1Tgn9nPbBoTEHk62aLc4TkSHQhX3AT B/4cjfictiKphkN53BeZHIb7U9sZc9A= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id BCEE6CE1B9D; Tue, 18 Jun 2024 21:14:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A933EC32786; Tue, 18 Jun 2024 21:14:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1718745265; bh=z9XvycQfjh13D3iusq5+A1VVeBIk2Ofyo59g4rSmQHU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Rw5MiVuX3wIP8cGngGfu7tr1Y2f8+/hZRIv3MFq9Hhbk683v6sG0QeBYio9TQfq6e dFsmxt1OzzToGd+ZDSGKrY5A9KIM25NvyeghgRwMCdjd9kB6zF6jcGvBT2xG+jjpl5 csStnF0f/UZsBOGt4DmcsL3ckzZ6HxbzD6wxLzCs= Date: Tue, 18 Jun 2024 14:14:24 -0700 From: Andrew Morton To: Stephen Brennan Cc: linux-mm@kvack.org, Vlastimil Babka , "Vishal Moola (Oracle)" , Omar Sandoval , David Hildenbrand , "Matthew Wilcox (Oracle)" , Hao Ge , linux-debuggers@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] mm: convert page type macros to enum Message-Id: <20240618141424.0bd414c8fcc537e7709eadcd@linux-foundation.org> In-Reply-To: <878qz31ajh.fsf@oracle.com> References: <20240607202954.1198180-1-stephen.s.brennan@oracle.com> <20240607212738.bf55318aebd7172fadaa11c5@linux-foundation.org> <87ikygo1yb.fsf@oracle.com> <87bk3z1f76.fsf@oracle.com> <20240617142951.08a9cdc791c8edeeca50509b@linux-foundation.org> <878qz31ajh.fsf@oracle.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: DD86D80005 X-Stat-Signature: u6tc1xrkmtn98r7cz4k4uz37wahcx5qa X-HE-Tag: 1718745269-667963 X-HE-Meta: U2FsdGVkX1+RAk+dtw1KjSJqXS5XvOGz+4HcMoOyF0MKu61pe4yQj8W6MJddhKW0QHRRhPrkxvDwVAWfd3ScZk9Zt2BegY5oEAxZiYuDVn1HvS/OtUNFcnLTtTxmIkAiwgBXdp5hWaKbXO6DSihOwAVX/VC2Bs5cA1cHTvfYAng525e5Pc58e9paPATLDnqqMr8DaR3ADLEwkb7uL0DKU6QoJMaDNyNPjfITN2iQs1TP/VND77LlWpd5Z/2/7SEWWsYGFhZgE1Xkoc4EDo568wZ7wNdx4oi3qlw/OCzCVQHWEMf9BMKXVRdgCPYv5nqu0J1uvN4uMAwRpF6Sm4f1g0uo636taY0C0YoLzOyAI3oy2R5/hNGhqdz7nVGOPvopGL4EgtAfULUoR7LRU/pjb1fl3UhJBp2h2P1jATbqUv9K/Katp8KHS3zJ0i6/tukC7nNt8qBgFbaO3FOQViglNbkRSzUJRGrfaVDS6GGERI3pUgr63df74uDoOCHyvpNzSuvQy7o44cuU91ef14c3bxLV7hwz4NuOMCx48hfDl3J7NROVyTuRMatQPdH/5oiL/97j3NKEjH0LacAcfqVMjCwqlg0RJXsc/nh9DVmUn/VP8yaGhguMQUkXTUDUtvIOewnfKkwTV3oUQXWId9rgXNxevKVqmeagw0lMQ2bxIfd0ae2Z908sRey8WpLkGfObKAaV+hmyLq5O/axLbBmvfri7DGeC7Ci7BaQdF0AngEHN/EPVStilDZoWK5dYxTSe9MuAba29r8ckEPdI5y7KLuV4a5EGFau7/mFgJGjO+71z5NSQOrHma2eOognXaVDpow8/cmoR03tCNwbQM03oNwoJKcOxDIG5p4R3loeUynLX8mX3CE053zdh2vbXe8Rmw/77vSut4mIN0ZBq0Z3NVCxaAQ4vaLV71oRqmxgKaBx98n5iHuo8Xx7nAkG79vswGmE33GCSctP2XprSDdl GzrhrIv4 QrAtvCGBKadO+dVz73mWiAzMD1fnJG7OZOwoZU0WiB1c7j4pGsYVjVwLZsWP6pj5FoXmXlr4xDpw/J4LVpiuqQ0rktdDiZIadkNDxz6c1nOqq2mkohWMxzwyLjZflD4dIy+iEXLJb30hGvR45fUxD9cpQcmWvZVf4MNXifzjZ0KHXECQoK0XrIrlx4q6MDhxvSHC9XiqOGs/HV3c4qjjEINUmI3n69NTqtv2eD0d/VLKkDvX/oDGnSyvYXcC03DV2edC0Fb4JMQO9ZiIuTYrakWs1vBcvROZf7mREGBLHMIhbCJbPq6xn1fmxLrB1gbxmY0aV 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: List-Subscribe: List-Unsubscribe: On Mon, 17 Jun 2024 15:14:58 -0700 Stephen Brennan wrote: > > -#define PAGE_TYPE_BASE 0xf0000000 > > -/* Reserve 0x0000007f to catch underflows of _mapcount */ > > -#define PAGE_MAPCOUNT_RESERVE -128 > > -#define PG_buddy 0x00000080 > > -#define PG_offline 0x00000100 > > -#define PG_table 0x00000200 > > -#define PG_guard 0x00000400 > > -#define PG_hugetlb 0x00000800 > > -#define PG_slab 0x00001000 > > +enum pagetype { > > + /* > > + * Reserve 0xffff0000 - 0xfffffffe to catch _mapcount underflows and > > + * allow owners that set a type to reuse the lower 16 bit for their own > > + * purposes. > > + */ > > This comment is a bit out of place now, because it refers to David's > change which has not yet been applied. Maybe it should continue to read > > "Reserve 0x0000007f to catch underflows of _mapcount" > > until "mm: allow reuse of the lower 16 bit of the page type with an > actual type" changes it? Updated, thanks. The post-Stephen code is now /* * For pages that are never mapped to userspace, * page_type may be used. Because it is initialised to -1, we invert the * sense of the bit, so __SetPageFoo *clears* the bit used for PageFoo, and * __ClearPageFoo *sets* the bit used for PageFoo. We reserve a few high and * low bits so that an underflow or overflow of _mapcount won't be * mistaken for a page type value. */ enum pagetype { PG_buddy = 0x00000080, PG_offline = 0x00000100, PG_table = 0x00000200, PG_guard = 0x00000400, PG_hugetlb = 0x00000800, PG_slab = 0x00001000, PAGE_TYPE_BASE = 0xf0000000, /* Reserve 0x0000007f to catch underflows of _mapcount */ PAGE_MAPCOUNT_RESERVE = -128, }; And the post-David code is now: /* * For pages that are never mapped to userspace, * page_type may be used. Because it is initialised to -1, we invert the * sense of the bit, so __SetPageFoo *clears* the bit used for PageFoo, and * __ClearPageFoo *sets* the bit used for PageFoo. We reserve a few high and * low bits so that an underflow or overflow of _mapcount won't be * mistaken for a page type value. */ enum pagetype { PG_buddy = 0x40000000, PG_offline = 0x20000000, PG_table = 0x10000000, PG_guard = 0x08000000, PG_hugetlb = 0x04008000, PG_slab = 0x02000000, PAGE_TYPE_BASE = 0x80000000, /* * Reserve 0xffff0000 - 0xfffffffe to catch _mapcount underflows and * allow owners that set a type to reuse the lower 16 bit for their own * purposes. */ PAGE_MAPCOUNT_RESERVE = ~0x0000ffff, };