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 26384C27C79 for ; Mon, 17 Jun 2024 21:29:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5ED0D6B0291; Mon, 17 Jun 2024 17:29:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 59BCA6B0292; Mon, 17 Jun 2024 17:29:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 463EF6B0293; Mon, 17 Jun 2024 17:29:59 -0400 (EDT) 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 27F926B0291 for ; Mon, 17 Jun 2024 17:29:59 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 9CA5E12011A for ; Mon, 17 Jun 2024 21:29:58 +0000 (UTC) X-FDA: 82241673276.01.AAE4A11 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf18.hostedemail.com (Postfix) with ESMTP id DB1E81C0010 for ; Mon, 17 Jun 2024 21:29:55 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="zmL/tEBM"; spf=pass (imf18.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=1718659788; 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=+4yAcBUL7FXYnQ/8R+PM+wcqLgXdimcHIcH5x/Tda50=; b=RXWOECscDTmYThgPYOiC1rTd4/vVx1m0e3Qujz4RHOMw0EiphKcXvUprUXjefMmAmSAFME kGCqYKQOLCVV4oVSXoX0JI1z3lWffOlvKsNYr6avnAihcWhKrIb9JZrGJZjqObAk0zm5WJ vUD6Uio9Sk+6Hg9TEeNF//zUxBTzLvA= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="zmL/tEBM"; spf=pass (imf18.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=1718659788; a=rsa-sha256; cv=none; b=HIe/96Sb/e7mdQomFWDfjMxefqUKflnx9zD0Ao6N/+mhmwLVJXT6eU5+rO4LK7GvsfgGrz Ori+4PRlGVrSeG082eTIr9tymMDbbYtb0FH16VpVtlnzEgYac1Hjg4lWXGFZdcYx9exDBs T1RNjIwp4N4tWTecfPr7bYawfiU/rUk= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 9FEA5CE0F28; Mon, 17 Jun 2024 21:29:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC6A4C2BD10; Mon, 17 Jun 2024 21:29:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1718659792; bh=Ut0KAyrVV4smqcRV54hBWMF2hJaIfY47Llm6WJvhIYM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=zmL/tEBMrfdGilrS36BdO+Nqc6pivOT+eFsbUpD7PzogUbAj0zq+5VJPNi6yfMJtW jOd8Fi901UZR4AUlpU6QjTv0eYjG/RXPESwadqPOcurAcyoV6Tu4uaM0Hf/dgTJOJW 9Jn2l6i4fepY3sAzeD4IDhjRVN4o5gCy1azVLd9U= Date: Mon, 17 Jun 2024 14:29:51 -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: <20240617142951.08a9cdc791c8edeeca50509b@linux-foundation.org> In-Reply-To: <87bk3z1f76.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> 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: rspam06 X-Rspamd-Queue-Id: DB1E81C0010 X-Stat-Signature: zmf93srafiuryoxsp64cxibsdtw3icne X-Rspam-User: X-HE-Tag: 1718659795-357418 X-HE-Meta: U2FsdGVkX18PuUqiSdzAIncvmN35PHWwEYI7mq8NSKHOd9CgGdYRy6l096KPOJmyPe49fOc3pSB6nwS4rkOF9XZBrAQfv6daGhanIeSDrLJqoNo182Eg5PWa9p4U9AvYW8xwQ0mXXnBYDcvO+B9GEuD7ZHTMeMAZpFxSdfa26tPNzm1CVHDX749L0BuoMDuEAW5G9JrboaVYPP77+uZ/pHY2h96N6SHodro/XD8JDJOYWdWbmtfiKjZ1bEp8DxJHYr/+mid39trQvDGZQF+blevN55Sq1ZPQSy7g3o7q0gdFT6ZIEznaqs8os53dN0WD/hhtpKN9i3oKJ8jOxthiwimGz79/HqFoTzYO7yyGViCdDJ4Y/UdRvcUepx6Kkju6xfjrIiwHJYk2fDUdcrN27FW22CxLrdCQw1RWPg3uk64qLrlHxchhrCnBlBIHzTAWGQV6OvktBT5x2GGHae9+JvgUcfwNgpKXaUJ+ql3J2yZJcI73/LGkHQHvWwLt3Fo6aRvkBiQjv188qunxi7MjrDHPob1kXBdPkggrSHPtfN4YInRyPve5mldtz1y+Sh5ml+PRR6C/oULVGXMq7vxhm9FrHBIg6sJIRil1jAPZZBBjNof3mpDmrZTh1d1fvdu4AzzJZopNuKqxYTm59tn9KdakgNsQJalxPtoyoL7mgNM0l1XxtrTtVKe/zgrwd7HUezJDjLTo7viRSNUHv7E8ukwf571nC+RW3VW/2c/3YO3kVh/SUYtlVcarkfHRzC7XrvZSm2amI5M6/5w2EcBVATQ7nPgzl+5SELfmxnQ1y0gkWJ48iMucKRHbopGK33J6XO7E5KlV/eTInf6S4BC2vLhYjAvPsDTPWsdOujwpu+av9SCI669JRnT1ryw25Ket1EcjwpIPpNcHZ4yMA5Xh1YxV8Y8NeP4XVeYIMak/4udG5QGeBb2RxFPee7cQ/gFJophBQE6MBSREWIVtgiI fQp2WWa9 Uy6eOFO+wOwUtr/l3SLNNHoNn2OkPTCE3MtAptGjqmvLLdnacwjM1jf1670v4Q/JA1VB81SSJGjjKS6XH4upix1FfROLHmntwApo+QvRq51ARrsnNaUwCO4osETFlDX9b5o8oeGA08Qo87mZIi7HVGktj67ZD4HIqqB+lwGhiG4QyKtn1h0g5g1Bk5PpiKM4alfzaKV/2Jt8q1fKmvOZgbgJacnINOffB8PV4ePOORJRf8D1P3/tPyU1Fc5xfpWnCRHvc9Yj1ruskFnbSULcIbr/cI1FI4edL2hUCA0BFGcTRltvpMOGoWoSw2i5B61Gk5e3T 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 13:34:21 -0700 Stephen Brennan wrote: > >>> Fixes: 46df8e73a4a3 ("mm: free up PG_slab") > >> > >> Should we backport this into 6.9.x? > > > > Hi Andrew, > > > > Looks like commit 46df8e73a4a3 ("mm: free up PG_slab") is introduced in > > the v6.10-rc's, and not backported to 6.9. So PG_slab is still part of > > Hi Andrew, > > I saw that you've merged this into mm-unstable, thank you! > > Since 46df8e73a4a3 ("mm: free up PG_slab") is part of the current 6.10 > RC, it would be great if this patch could be part of the 6.10 release so > we don't release a kernel missing the PG_slab info. > > Can you confirm if mm-unstable will get merged in this release cycle? Or > else, would it be possible to include it in a branch that will? Turns out the patch as sent was based on David's "mm: allow reuse of the lower 16 bit of the page type with an actual type", which changed the page flags a lot, I redid this patch thusly: --- a/include/linux/page-flags.h~mm-convert-page-type-macros-to-enum +++ a/include/linux/page-flags.h @@ -944,15 +944,22 @@ PAGEFLAG_FALSE(HasHWPoisoned, has_hwpois * mistaken for a page type value. */ -#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. + */ + PG_buddy = 0x00000080, + PG_offline = 0x00000100, + PG_table = 0x00000200, + PG_guard = 0x00000400, + PG_hugetlb = 0x00000800, + PG_slab = 0x00001000, + + PAGE_TYPE_BASE = 0xf0000000, + PAGE_MAPCOUNT_RESERVE = -128, +}; #define PageType(page, flag) \ ((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) _ (please check carefully) and David's later "mm: allow reuse of the lower 16 bit of the page type with an actual type" becomes include/linux/mm_types.h | 5 +++++ include/linux/page-flags.h | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) --- a/include/linux/mm_types.h~mm-allow-reuse-of-the-lower-16-bit-of-the-page-type-with-an-actual-type +++ a/include/linux/mm_types.h @@ -157,6 +157,11 @@ struct page { * * See page-flags.h for a list of page types which are currently * stored here. + * + * Owners of typed folios may reuse the lower 16 bit of the + * head page page_type field after setting the page type, + * but must reset these 16 bit to -1 before clearing the + * page type. */ unsigned int page_type; --- a/include/linux/page-flags.h~mm-allow-reuse-of-the-lower-16-bit-of-the-page-type-with-an-actual-type +++ a/include/linux/page-flags.h @@ -951,15 +951,15 @@ enum pagetype { * allow owners that set a type to reuse the lower 16 bit for their own * purposes. */ - PG_buddy = 0x00000080, - PG_offline = 0x00000100, - PG_table = 0x00000200, - PG_guard = 0x00000400, - PG_hugetlb = 0x00000800, - PG_slab = 0x00001000, + PG_buddy = 0x40000000, + PG_offline = 0x20000000, + PG_table = 0x10000000, + PG_guard = 0x08000000, + PG_hugetlb = 0x04008000, + PG_slab = 0x02000000, - PAGE_TYPE_BASE = 0xf0000000, - PAGE_MAPCOUNT_RESERVE = -128, + PAGE_TYPE_BASE = 0x80000000, + PAGE_MAPCOUNT_RESERVE = (~0x0000ffff), }; #define PageType(page, flag) \ _ and that patch's fixup becomes --- a/include/linux/page-flags.h~mm-allow-reuse-of-the-lower-16-bit-of-the-page-type-with-an-actual-type-fix +++ a/include/linux/page-flags.h @@ -955,7 +955,7 @@ enum pagetype { PG_offline = 0x20000000, PG_table = 0x10000000, PG_guard = 0x08000000, - PG_hugetlb = 0x04008000, + PG_hugetlb = 0x04000000, PG_slab = 0x02000000, PAGE_TYPE_BASE = 0x80000000, _ and "mm/zsmalloc: use a proper page type" becomes, in part, --- a/include/linux/page-flags.h~mm-zsmalloc-use-a-proper-page-type +++ a/include/linux/page-flags.h @@ -957,6 +957,7 @@ enum pagetype { PG_guard = 0x08000000, PG_hugetlb = 0x04000000, PG_slab = 0x02000000, + PG_zsmalloc = 0x01000000, PAGE_TYPE_BASE = 0x80000000, PAGE_MAPCOUNT_RESERVE = (~0x0000ffff), and the end result is identical to yesterday's mm-everything so that's all good. However I wouldn't want to send the altered version of "mm: convert page type macros to enum" into 6.10-rcX because it gets so altered by David's mm-unstable changes for the next merge window. The new version of the hotfixes patch won't have had any valid testing on its own. So I'll temporarily drop David's "mm: page_type, zsmalloc and page_mapcount_reset()" series from mm-unstable. To permit the new "mm: convert page type macros to enum" to get some linux-next exposure. David, please remind me to restore that series in a week or so?