From patchwork Wed Jul 14 09:17:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12376355 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 720D1C07E9A for ; Wed, 14 Jul 2021 09:21:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 025E761396 for ; Wed, 14 Jul 2021 09:21:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 025E761396 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4A6276B0088; Wed, 14 Jul 2021 05:21:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 47CCC6B008C; Wed, 14 Jul 2021 05:21:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D0AC8D0001; Wed, 14 Jul 2021 05:21:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0231.hostedemail.com [216.40.44.231]) by kanga.kvack.org (Postfix) with ESMTP id 0B4F26B0088 for ; Wed, 14 Jul 2021 05:21:07 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 058108245571 for ; Wed, 14 Jul 2021 09:21:06 +0000 (UTC) X-FDA: 78360649332.34.C0B980D Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by imf22.hostedemail.com (Postfix) with ESMTP id 58EE5192A for ; Wed, 14 Jul 2021 09:21:05 +0000 (UTC) Received: by mail-pf1-f176.google.com with SMTP id d12so1492639pfj.2 for ; Wed, 14 Jul 2021 02:21:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1wb5iN6C/r/jl8NTvJ6JTzD0t7BIT0w39tfIUzR0c+I=; b=zplQE4G7tcgmBinMSn8w4wPywLrIByLSGqitptn1ZR9FdsRi1QXv75GdAavbVA7JN4 LyVVy0vtZerXQwmXr6nlVQzQ3wBO5qAZAXBObfbOI49LsAX5QlP+g6vJsXVcdvmcZwT6 Gtv+myhlxOWU74E1cjQjT6kd3Y5OOiBtoi7kmyBlIfLms9+pQsxkmrhpzv2F7OGgj/Cg QjRJvLHu25gepnxpMVz6Q15ZrVzwLM4tpLz3sboZo42D7V6oxAwSsJmTab3xWFFXa7Ki mrOks3PQ1/lBeMR5srIeZCq9NCxEM81sIhf5bY2Hz1lS64edYvUANFsmm+YFyDWPIdhV rHaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1wb5iN6C/r/jl8NTvJ6JTzD0t7BIT0w39tfIUzR0c+I=; b=HhyLudDBAjL2LOXgIvqW1pQCGYOz7NFOq/InHgbh9gcDYfGUYv9v+DD/xyiqFXLaZM QYDS6M+BJ/vhU3AhCl1vfziR54ug49h6eb1IaoOPzEYxt2r85xKmxWtpafRPG7/tTJ+K 66gM4RPco83k8+MpzddVy4/owfADcBd8sHUj04k12jsI/j59+x7XX3JmKZjOKAnyiBfq VXJPxB2SW5Nq6tnaGCXmTGkOC462i48ch03G9Z1Znz1I19yt9L1Oy67axChNt/u+Xi1w 0vd93lSM0Su9hmuDeG5CODIKx11yVQiVdJ3XERw+BB7/+5rgsTT93HxV08dKbc5KcuAc /Odg== X-Gm-Message-State: AOAM530wxZo099hV8mnACfKRkhVOAtvfy51GCJ0HkuHyF16qBZkx1zjt 6plR/28bjEhV40TSyLyPOHTx0w== X-Google-Smtp-Source: ABdhPJzEijXZzF0Qf19GMjfpTQOk+y74uZh4grXC65z8xbeHoDsVcjqOTYZMN3z9W/kZBgak8cDqZQ== X-Received: by 2002:a65:564f:: with SMTP id m15mr8717302pgs.346.1626254464534; Wed, 14 Jul 2021 02:21:04 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.243]) by smtp.gmail.com with ESMTPSA id k19sm1742540pji.32.2021.07.14.02.20.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jul 2021 02:21:04 -0700 (PDT) From: Muchun Song To: mike.kravetz@oracle.com, akpm@linux-foundation.org, osalvador@suse.de, mhocko@suse.com, song.bao.hua@hisilicon.com, david@redhat.com, chenhuang5@huawei.com, bodeddub@amazon.com, corbet@lwn.net Cc: duanxiongchun@bytedance.com, fam.zheng@bytedance.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, zhengqi.arch@bytedance.com, Muchun Song Subject: [PATCH 2/5] mm: introduce save_page_flags to cooperate with show_page_flags Date: Wed, 14 Jul 2021 17:17:57 +0800 Message-Id: <20210714091800.42645-3-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20210714091800.42645-1-songmuchun@bytedance.com> References: <20210714091800.42645-1-songmuchun@bytedance.com> MIME-Version: 1.0 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=zplQE4G7; spf=pass (imf22.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 58EE5192A X-Stat-Signature: kg7tihpqfijwph56eydnar5ayqca3ic5 X-HE-Tag: 1626254465-51596 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: Introduce save_page_flags to return the page flags which can cooperate with show_page_flags. If we want to hihe some page flags from users, it will be useful to alter save_page_flags directly. This is a preparation for the next patch to hide some page flags from users. Signed-off-by: Muchun Song --- include/trace/events/mmflags.h | 3 +++ include/trace/events/page_ref.h | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index 390270e00a1d..69cb84b1257e 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -121,6 +121,9 @@ IF_HAVE_PG_IDLE(PG_idle, "idle" ) \ IF_HAVE_PG_ARCH_2(PG_arch_2, "arch_2" ) \ IF_HAVE_PG_SKIP_KASAN_POISON(PG_skip_kasan_poison, "skip_kasan_poison") +#define save_page_flags(page) \ + (((page)->flags & ~PAGEFLAGS_MASK)) + #define show_page_flags(flags) \ (flags) ? __print_flags(flags, "|", \ __def_pageflag_names \ diff --git a/include/trace/events/page_ref.h b/include/trace/events/page_ref.h index 643b1b4e9f27..53d303048d27 100644 --- a/include/trace/events/page_ref.h +++ b/include/trace/events/page_ref.h @@ -28,7 +28,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_template, TP_fast_assign( __entry->pfn = page_to_pfn(page); - __entry->flags = page->flags; + __entry->flags = save_page_flags(page); __entry->count = page_ref_count(page); __entry->mapcount = page_mapcount(page); __entry->mapping = page->mapping; @@ -38,7 +38,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_template, TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d", __entry->pfn, - show_page_flags(__entry->flags & ~PAGEFLAGS_MASK), + show_page_flags(__entry->flags), __entry->count, __entry->mapcount, __entry->mapping, __entry->mt, __entry->val) @@ -77,7 +77,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_and_test_template, TP_fast_assign( __entry->pfn = page_to_pfn(page); - __entry->flags = page->flags; + __entry->flags = save_page_flags(page); __entry->count = page_ref_count(page); __entry->mapcount = page_mapcount(page); __entry->mapping = page->mapping; @@ -88,7 +88,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_and_test_template, TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d ret=%d", __entry->pfn, - show_page_flags(__entry->flags & ~PAGEFLAGS_MASK), + show_page_flags(__entry->flags), __entry->count, __entry->mapcount, __entry->mapping, __entry->mt, __entry->val, __entry->ret)