From patchwork Tue Feb 27 19:23:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13574333 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 E68C3C54798 for ; Tue, 27 Feb 2024 19:23:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 27A2B6B010B; Tue, 27 Feb 2024 14:23:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 200856B010E; Tue, 27 Feb 2024 14:23:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA8D06B0107; Tue, 27 Feb 2024 14:23:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id D306A6B0103 for ; Tue, 27 Feb 2024 14:23:45 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8C1AC40857 for ; Tue, 27 Feb 2024 19:23:45 +0000 (UTC) X-FDA: 81838558410.24.C2829BA Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf18.hostedemail.com (Postfix) with ESMTP id 2D11F1C000C for ; Tue, 27 Feb 2024 19:23:43 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="YS8/+31+"; dmarc=none; spf=none (imf18.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709061824; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=QTc8Wv0Vg76n62K96RIOqfP+UjoW9n6ZYNbCSTh2Dmo=; b=AuIEluDvBsKvCoVJrwSXoFaUrfHJ2m1A25894vi9wqkwRXToDb3k4YKn0kn5Sn+vIjm7xk mGI050XlNxUsKCijqmzEhKfBXxoI09snNuGc3+MaBBRhrJOfciNL4iEtjXDGDjfMErwW+F hkZYRfYsna5h2O4h82ejxx4/gZNpssc= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="YS8/+31+"; dmarc=none; spf=none (imf18.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709061824; a=rsa-sha256; cv=none; b=HKVoV14jFZzfT2iINBMaoIi2dw4Y4K4CZ/7zne3hzT0UHQCgh8ufDvjVCVATJN8zrzuZDW L3ZtmrQIqkC6jC/m85l6PyeroQ/fpYTePCbYUg/727XRlpmQi3Fn61hByULCCZJEHR2FoQ horuoH5zP9EtS+G8N3GoJCs2Iac12co= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=QTc8Wv0Vg76n62K96RIOqfP+UjoW9n6ZYNbCSTh2Dmo=; b=YS8/+31+cjk44meiGxZALzMKmt QKYDz8UjcyqMHifwvi3JdVaESn28O3mXsVBwK8kAZqC7c9mWw5so05QBnPcbMB7hmQgcebvJZf9tb FyYPRczWbc+LQD6QZBv8PLzw1/NCPENEw36e2BztrO6GLFkTJNCJ0LqZl1fxNxTW36coAMSOf41nZ vYXgdtl2GczmgGB2vq9FIy0XfU5FmqM3Q1gF9ETtrfyUgOEqCUn/XNjbfW1lpI76IYDKXv9jiHHbq Wi/A9M1EvxQjWPdL6HPsLGIQs53he/R5u3XBUTTWQlQRWFff3cmRXfdhAUQz/FsSpaS6hde3qeogb XMrjNevQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf33C-00000003B0w-3ORs; Tue, 27 Feb 2024 19:23:38 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 0/8] PageFlags cleanups Date: Tue, 27 Feb 2024 19:23:27 +0000 Message-ID: <20240227192337.757313-1-willy@infradead.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 2D11F1C000C X-Stat-Signature: fn5tmxym9xrgq9ih8f3si3uwqeoaprs3 X-Rspam-User: X-HE-Tag: 1709061823-105667 X-HE-Meta: U2FsdGVkX1/yolPKajQNuRBND7sh+L5sKO6k95qDope39x1tJHWWA/M6mto2kqQZ9KP41IJ9ICJ5C2qJ0KuQ+zEUaio53s/wSfuQs7r5Fg4o8Oc6upfXo1jxcyRvq590mSaVdJJ/V9GPDP6mvwZdHoKq7mAjh8tuzwtYkBmKfcVVaqFtFqxaLDzHXWjht1W+VMiqYUMr+PA59Hkn0mp0bFs64/HYjV/mRfK4gqe+594sFGfGrJPgK0DVIjepZa4R4TPxHamvUR+WYgD8E/7veW8y/El0MR1bqx5nYlXfuzbKY0v5z48XM4aDPLYyRb139WWdw3l04k8V7aoLjyPK7BecQzPeO3vPLPb/1taJROPxwXcM+ONOc9W01RmRxmCx5u2AlCbkd3XboYgxajLSC+jdaI2AjsUw0svtKbEpxLZBJuvJljS+zvRkAlGnKfViPJkMG/BM73TU6rpzXaVXL/xaIBnjC8uSgkLACkFYzddsBEtIRA88a5Y+Jf3uOYfbqq5EDTIIiCdQpPhep5/rEjl3LecKYZMQWVXhplEiNCYMqB/Mhz9lB03cyKjVTxAfJ1DFH82y7TcI+e/Gmzd38EaWVDndYD4GL3boiuHlsekAZVlDYXUUexHpKYeasHqazR0hmSO13pqYg6F/oKUbQKyerWfpeWtCIl9kF2NxGF3e4pLmEQ/BsDQnnY8I5j5e/MjWs0lj83PCgA9IItX24lZY7CCTdxxO+DWLRn+jay1nk9k6Xr2OXcUP3RtfnapzLB9Gdl43ySND/DyJzq5tZ9ehKW6dOlERbw32/bvhb8rLqLrvgpp6wken4iVgRwJp/4oLTwlueT7VOU5PdTL+FPDuDNLAFgDsUrG4s7eVHqoMbiYZEcU5NQ== 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: We have now successfully removed all of the uses of some of the PageFlags from the kernel, but there's nothing to stop somebody reintroducing them. By splitting out FOLIO_FLAGS from PAGEFLAGS, we can stop defining the old flags; and we do that in some of the later patches. After doing this, I realised that dump_page() was living dangerously; we could end up calling folio_test_foo() on a pointer which no longer pointed to a folio (as dump_page() is not necessarily called when the caller has a reference to the page). So I fixed that up. And then I realised that this was the key to making dump_page() take a const argument, which means we can constify the page flags testing, which means we can remove more cast-away-the-const bad code. And here's where I ended up. Matthew Wilcox (Oracle) (8): mm: Separate out FOLIO_FLAGS from PAGEFLAGS mm: Remove PageWaiters, PageSetWaiters and PageClearWaiters mm: Remove PageYoung and PageIdle definitions mm: Add __dump_folio() mm: Make dump_page() take a const argument mm: Constify testing page/folio flags mm: Constify more page/folio tests mm: Remove cast from page_to_nid() include/linux/mm.h | 6 +- include/linux/mmdebug.h | 2 +- include/linux/page-flags.h | 153 +++++++++++++++++++++---------------- mm/debug.c | 122 ++++++++++++++++------------- mm/hugetlb.c | 4 +- 5 files changed, 161 insertions(+), 126 deletions(-)