From patchwork Sun Nov 6 14:03:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyeonggon Yoo <42.hyeyoo@gmail.com> X-Patchwork-Id: 13033410 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 D4382C4332F for ; Sun, 6 Nov 2022 14:05:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3678F8E0002; Sun, 6 Nov 2022 09:05:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F18C8E0001; Sun, 6 Nov 2022 09:05:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B7E08E0002; Sun, 6 Nov 2022 09:05:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 08DED8E0001 for ; Sun, 6 Nov 2022 09:05:39 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id CA46240D1A for ; Sun, 6 Nov 2022 14:05:38 +0000 (UTC) X-FDA: 80103190356.04.DCC314B Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by imf05.hostedemail.com (Postfix) with ESMTP id 57336100003 for ; Sun, 6 Nov 2022 14:05:38 +0000 (UTC) Received: by mail-pj1-f44.google.com with SMTP id d13-20020a17090a3b0d00b00213519dfe4aso8206377pjc.2 for ; Sun, 06 Nov 2022 06:05:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=BEgjyTTbdqTAtDQuRDtObBdn0lRUBz6nJAulvPdjLfg=; b=TQa0G/4Ed3kco18x5GIOOaGrfAaPKsHDdcfHNh3X/X5rqowj5BHihgsxp/17BtzV0m ZgdN3J5BMfmj79WZ9M5qsjGU3Oug2QjXzLJoO6vyV5V4PZLab2wqo2pJCHNmbNDHqnFI qXUsmkOZGSHtRNrOcwpZX+I2rMCEILypEfkhG0WtPrWHAZX/miF2KRJ16SAg4jV0hKwi i3SIf4ZlqWJAq8x6wKVckXJ/zHlKAkxwUaHMuz+T78Kx1TXje4tz0xMPg75sX3Yj88Os /N7GUkJHhIzO99MCBnzcok8aq58vwbX9SXsNlf38g/YwcFEOMWuKaQQCkVjAIzuraP33 IaBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BEgjyTTbdqTAtDQuRDtObBdn0lRUBz6nJAulvPdjLfg=; b=6Mhq1aSwlv4pOLrNRUYueTeZAEKG99rDf8eU0egr/YrL4s+si9BDjpC53He/p2lNoV WooJboYhbrM/PhcRxowOfPpHCs/4Vs30poMleE0ybJvD+TeflVILz9u1VIeNiNAshyhe vOxwWEgX+jxdAwI2UUDY9cprcqEXNX6QNYwKkSutQ3g3sIpVwKT3bvQFTaulvK5QtKaz gKSYJCKENsDzcshg9gkWKD21+t9JZZari8CFdVFDoqSZyLCBHLa9TuiWySVCeeDLOjBQ TQkfeCnVrsGjiwBr/VIAsCPdwb4QY0aZCYoWjJvbhZ/NlJgY66LyHurUELJxHIwMiMXw MYhA== X-Gm-Message-State: ACrzQf3d/rvZmdADVgFNnYIUEYXxcLzo71lNrQEO6nlnOzIXizhTjURQ K8m6ZLsKedIbU/XeM+mNQIbq8rtfxIOKzw== X-Google-Smtp-Source: AMsMyM5oow6+eY6zOTd82Cu/ybsufWjKPiW3YZaNR8TJjDCRJDvJaFdYBhvqWjlu7AHLCKtSq/ZEeQ== X-Received: by 2002:a17:90a:71ca:b0:213:c03a:1b07 with SMTP id m10-20020a17090a71ca00b00213c03a1b07mr42808264pjs.67.1667743536714; Sun, 06 Nov 2022 06:05:36 -0800 (PST) Received: from hyeyoo.. ([114.29.91.56]) by smtp.gmail.com with ESMTPSA id d14-20020a170902654e00b00172f6726d8esm3156197pln.277.2022.11.06.06.05.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Nov 2022 06:05:35 -0800 (PST) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: linux-mm@kvack.org Cc: Andrew Morton , Christoph Lameter , Pekka Enberg , David Rientjes , Vlastimil Babka , Naoya Horiguchi , Miaohe Lin , Matthew Wilcox , Minchan Kim , Mel Gorman , Andrea Arcangeli , Dan Williams , Hugh Dickins , Muchun Song , David Hildenbrand , Hyeonggon Yoo <42.hyeyoo@gmail.com> Subject: [RFC v2 0/3] move PG_slab to page_type Date: Sun, 6 Nov 2022 23:03:52 +0900 Message-Id: <20221106140355.294845-1-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="TQa0G/4E"; spf=pass (imf05.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667743538; a=rsa-sha256; cv=none; b=okOf850C2c0QJnpStyZcGIuigcRuaqq2pKjurnfEaUgdMz8pC828HG6O0pto8VRvKKrMri WixOzAmurPdp0pnTaRfKsYJr+61BnbiTI0J+LIKAyu7ZoPLG0yZ4yZaj+TKqXGJZvgoufT NDD5N06B5yGieA7y8iE4Mdeyqxr+ROo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667743538; 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=BEgjyTTbdqTAtDQuRDtObBdn0lRUBz6nJAulvPdjLfg=; b=w5HOmjmFVtBKJuzqd0cjVTSua9b3pxBu9okqnH4fF9+wgRNVqKv+9E/ziT6E0elsAwwMr4 pL3v4hfr/yJA9t3Q6xFk7Gl+nn9OTQfbitaG7CqCPVUjcjIGpRZcEeRE6Ier2ucbydKv7Y 8gDSmi3HuQxIMzt9v9TmmMealrCVkYw= X-Rspam-User: Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="TQa0G/4E"; spf=pass (imf05.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 57336100003 X-Stat-Signature: e1iy1fuo1zjtrgwqz1i5xor375e5fis8 X-HE-Tag: 1667743538-289529 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: RFC v1: https://lore.kernel.org/all/Y0BpuxUb+Y8BKHIM@casper.infradead.org/T/ This series moves PG_slab from page->flags to page->page_type. as page_type field is also used number of active objects in slab, upper half (16 bits) are used as page type and lower half (16 bits) are used as slab->active. It simplifies checking page_mapped() and folio_mapped() and frees a bit in page->flags. This also adds new %pGt printf format that prints human-readable page_type, and show_page_flags() (for tracepoints). More tests are still needed, but I think it's worth to get some early feedbacks. TO HWPOISON DEVELOPERS: I think it would be best to add a code that identifies a type of page from page_type like page flags. but I'm not sure how to properly test it. v1 -> v2: - use page flag policy for pages that uses page_type (PF_NO_TAIL for slab and PF_ANY for others) (Matthew WilCox) - store slab->active in negative form and use helpers to access/modify it (Matthew WilCox) - Fix logical errors and some cleanup in fs/proc/page.c and kernel/crash_core.c - add show_page_flags() (patch 2) and %pGt format (patch 3) Any feedbacks are appreciated. Hyeonggon Yoo (3): mm: move PG_slab flag to page_type mm: introduce show_page_types() to provide human-readable page_type mm, printk: introduce new format %pGt for page_type Documentation/core-api/printk-formats.rst | 3 +- fs/proc/page.c | 13 ++-- include/linux/mm_types.h | 11 ++-- include/linux/page-flags.h | 77 ++++++++++++++++------- include/trace/events/mmflags.h | 13 +++- include/trace/events/page_ref.h | 10 ++- kernel/crash_core.c | 3 +- lib/test_printf.c | 23 +++++++ lib/vsprintf.c | 24 +++++++ mm/debug.c | 7 +++ mm/internal.h | 1 + mm/memory-failure.c | 8 --- mm/slab.c | 44 ++++++++----- mm/slab.h | 3 +- 14 files changed, 175 insertions(+), 65 deletions(-)