From patchwork Sun Nov 6 14:03:54 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: 13033412 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 76B4EC4332F for ; Sun, 6 Nov 2022 14:05:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 192368E0006; Sun, 6 Nov 2022 09:05:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 143378E0001; Sun, 6 Nov 2022 09:05:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 00A488E0006; Sun, 6 Nov 2022 09:05:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E52928E0001 for ; Sun, 6 Nov 2022 09:05:50 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B359DA0565 for ; Sun, 6 Nov 2022 14:05:50 +0000 (UTC) X-FDA: 80103190860.04.86E22D2 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by imf15.hostedemail.com (Postfix) with ESMTP id 4562AA000A for ; Sun, 6 Nov 2022 14:05:50 +0000 (UTC) Received: by mail-pg1-f169.google.com with SMTP id b62so8325437pgc.0 for ; Sun, 06 Nov 2022 06:05:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t8vuXRR2q0PXI51qIeJ1ea3Gf25G2oUdKx9V5FzmI1s=; b=OlxHZfQAqgsuCoT68wC88NFnxrimfiTVtjIXWHeUGtmfL+mra7xwOMN/vDJo4h4on+ OaHX3IOelEuuYMoUVshYgIkc+zWLvHa50BhgnniWjh7WOWlPWnDkzyg3SGQXj6ypgjKn ckuzFSKppkjjPxt5JQSTkkVJqDugpO3+j/AvXHJcNZWSLpNT7RX3nssomwxg9mhPLt6i yy8aA26gddslG/eSCZcYhWnUzYKMz1r7pJLV3WdyT7allxBai3+AWC+ZZr3eamsHXRUP nP9FuER05SSHNlJz3cvIgX+4gioMzwbgxNkSQTSCURUZGolHXZMI+EmMeGzSewfO+jKp af1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t8vuXRR2q0PXI51qIeJ1ea3Gf25G2oUdKx9V5FzmI1s=; b=b5IzXduIVAKi7j2WcU3w7J9Pn1V14kUUg6AjiBUiFqykd1Puj1UocREv9xSiRiZLP4 JfDlf93Tn6gm310L80+vfeElXJC8Z6RTxMAJEpFEVQjX4txMzt1W487dzOrQ0SafDi/f JYvkJqqEW2mQ5VziWp4NwfPZwxUtUGbBq6Aq8klo/aXp+fV68MlXVoUuDk/7DcxXwJ64 9ht6uekaoWnX5YfLYgNqoBzORAj1MDhptJnSqjKB60C6zS+8nTBaPTThXo/0PTlYnD9Y dNiK6iW5Iql9BoLtn5KZdcrm/akumUx2DVJApSanBoGFzU257hmxA8+Aq1EC7fB0VmLm heUw== X-Gm-Message-State: ACrzQf29mucQuHnaU+kZJ70sK0JZsKOypf340NSuNTB/X5t/ikbHFSsu 1ZQpuUDuLi3LgwpMw67QVxOOqDPbe0Jp/g== X-Google-Smtp-Source: AMsMyM51WYOiFNo7EUlD+Ow/kV7EYt5hT1dzuuGXxsLrYodLqv5cdg/K/NUDN9h5as0hg/s0ufJ6uw== X-Received: by 2002:a63:5761:0:b0:46e:b96b:e76 with SMTP id h33-20020a635761000000b0046eb96b0e76mr39782931pgm.534.1667743548721; Sun, 06 Nov 2022 06:05:48 -0800 (PST) Received: from hyeyoo.. ([114.29.91.56]) by smtp.gmail.com with ESMTPSA id d14-20020a170902654e00b00172f6726d8esm3156197pln.277.2022.11.06.06.05.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Nov 2022 06:05:47 -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>, Steven Rostedt , Masami Hiramatsu , Andrey Konovalov , Marco Elver , Vasily Averin , NeilBrown Subject: [RFC v2 2/3] mm: introduce show_page_types() to provide human-readable page_type Date: Sun, 6 Nov 2022 23:03:54 +0900 Message-Id: <20221106140355.294845-3-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20221106140355.294845-1-42.hyeyoo@gmail.com> References: <20221106140355.294845-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=OlxHZfQA; spf=pass (imf15.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.215.169 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=1667743550; a=rsa-sha256; cv=none; b=gt3/f6xQLtogdRDPajoNtEsC7xGWuipYPR54zmSIRX4PcG05EyDmSDGz3YBCMaAi9ahgGs kn8ouYZEOhdBkY4ePvdh8BLZUxsGr1UPc91OJWno72f85eenURz74Cl1H60tfHkhh/j5gv gwjyL0VO9gAYXwLbpV3nD6MRsOpC2Zo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667743550; 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:in-reply-to:references:references:dkim-signature; bh=t8vuXRR2q0PXI51qIeJ1ea3Gf25G2oUdKx9V5FzmI1s=; b=c/dTTaEMp+ba0VGVifxhjDTBy412NvmUXvpC7cJ+UrMGXVkf6ePUUvFuHpFAinFCpRUTTj 4+7FqKn+xDsryShnh+IUBXYzTgjHBiSEud+pWCi/G6xWryiJ5TPKPzmI8+MyLzP9hM+jeC B0iddKJPe6Jmm5qJCW/27miuj/1YdN0= X-Stat-Signature: dsuion7uixphmmz76apy17w8yu8izjdm X-Rspamd-Queue-Id: 4562AA000A Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=OlxHZfQA; spf=pass (imf15.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.215.169 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1667743550-837573 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: Some page flags are not actually set in 'flags' field. To provide better understanding of tracepoint output, introduce show_page_types() that shows page flags from page_type. Cc: Steven Rostedt Cc: Masami Hiramatsu Cc: Andrew Morton Cc: Andrey Konovalov Cc: Marco Elver Cc: Vasily Averin Cc: NeilBrown Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- include/trace/events/mmflags.h | 12 ++++++++++++ include/trace/events/page_ref.h | 10 ++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index 72c11a16f771..a8dfb98a4dd6 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -136,6 +136,18 @@ IF_HAVE_PG_SKIP_KASAN_POISON(PG_skip_kasan_poison, "skip_kasan_poison") __def_pageflag_names \ ) : "none" +#define __def_pagetype_names \ + {PG_slab, "slab" }, \ + {PG_offline, "offline" }, \ + {PG_guard, "guard" }, \ + {PG_table, "table" }, \ + {PG_buddy, "buddy" } + +#define show_page_types(page_type) \ + page_type_has_type(page_type) ? \ + __print_flags((~page_type), "|", __def_pagetype_names) \ + : "none" + #if defined(CONFIG_X86) #define __VM_ARCH_SPECIFIC_1 {VM_PAT, "pat" } #elif defined(CONFIG_PPC) diff --git a/include/trace/events/page_ref.h b/include/trace/events/page_ref.h index 8a99c1cd417b..b00d23e90e93 100644 --- a/include/trace/events/page_ref.h +++ b/include/trace/events/page_ref.h @@ -21,6 +21,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_template, __field(unsigned long, flags) __field(int, count) __field(int, mapcount) + __field(unsigned int, page_type) __field(void *, mapping) __field(int, mt) __field(int, val) @@ -31,14 +32,16 @@ DECLARE_EVENT_CLASS(page_ref_mod_template, __entry->flags = page->flags; __entry->count = page_ref_count(page); __entry->mapcount = page_mapcount(page); + __entry->page_type = page->page_type; __entry->mapping = page->mapping; __entry->mt = get_pageblock_migratetype(page); __entry->val = v; ), - TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d", + TP_printk("pfn=0x%lx flags=%s page_type=%s count=%d mapcount=%d mapping=%p mt=%d val=%d", __entry->pfn, show_page_flags(__entry->flags & PAGEFLAGS_MASK), + show_page_types(__entry->page_type & PAGE_TYPE_MASK), __entry->count, __entry->mapcount, __entry->mapping, __entry->mt, __entry->val) @@ -69,6 +72,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_and_test_template, __field(unsigned long, flags) __field(int, count) __field(int, mapcount) + __field(unsigned int, page_type) __field(void *, mapping) __field(int, mt) __field(int, val) @@ -80,15 +84,17 @@ DECLARE_EVENT_CLASS(page_ref_mod_and_test_template, __entry->flags = page->flags; __entry->count = page_ref_count(page); __entry->mapcount = page_mapcount(page); + __entry->page_type = page->page_type; __entry->mapping = page->mapping; __entry->mt = get_pageblock_migratetype(page); __entry->val = v; __entry->ret = ret; ), - TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d ret=%d", + TP_printk("pfn=0x%lx flags=%s page_type=%s count=%d mapcount=%d mapping=%p mt=%d val=%d ret=%d", __entry->pfn, show_page_flags(__entry->flags & PAGEFLAGS_MASK), + show_page_types(__entry->page_type & PAGE_TYPE_MASK), __entry->count, __entry->mapcount, __entry->mapping, __entry->mt, __entry->val, __entry->ret)