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 X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 D26E9C4338F for ; Tue, 27 Jul 2021 07:07:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B98BA61132 for ; Tue, 27 Jul 2021 07:07:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235846AbhG0HHI (ORCPT ); Tue, 27 Jul 2021 03:07:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235827AbhG0HHF (ORCPT ); Tue, 27 Jul 2021 03:07:05 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BB62C061757 for ; Tue, 27 Jul 2021 00:07:05 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id e2-20020a17090a4a02b029016f3020d867so3597674pjh.3 for ; Tue, 27 Jul 2021 00:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gRjmuFZcr1eSBhne8H1SLkdS9f3pbpxDfvMvPpPvFP0=; b=QVKjfGbnR32GQUbYrb6/qb02GRpzHi9VNov+FPkEVRqZbbTln2gnlOjt/KDtwrgpmY gIidgwAaLE031GY6D8OFlM0j6U2Tf2sgXS0Piy4FXlomGU9Ya80l1TYPpDFrPtXkTI/W 85YIrUuynRlJLHxRXZBjbUjpN46eZ5i4rWaZYCn9C7SzdAYsHC5MAvE6rkmwODO4dFzZ ue5LVdvewkWM4k/MoHyDebVQYTAhgS/raO1/5MgHNVMJQiniyIhGaHqmUPkwFtA6hY5F gHxeVmKuafAmtwW7BcV0yJgnMD+49AeuMOmI0tJ9Iud9pkJXF5OP368UOMpW8N8eD3KZ 2wrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gRjmuFZcr1eSBhne8H1SLkdS9f3pbpxDfvMvPpPvFP0=; b=ZrdJOds/E9UP6hETL6GhjD/Wb2nDQzB7Om3A1/y/tOSgQ5VGJMMSK5jRkxDaB47r4A QLZ1+ohuPHmeKnseAGUzFQzpPZivp9keJ91DjJQtR/SYGdBPB8/DG5yNPNHNJByY/7Mw cYriN93MTqRWO61PVxYzhEwtA3EbUYGT8jGILyRAYKvHUixJxiv2ybeVvqYd0LkhbNi6 S2G2jEOF+b2xfZE6gDhQCJ+fKl2ErS799zxaXjThYiUgqzEI7YeBp2bhSK7Sr/IzekQn N+en/onCcp7rYeNbawm3oXJ3kTMhzUK6ZgYbGLofL7eqOJ9YNuGJ+oEyknUAVvM7P57l CoPw== X-Gm-Message-State: AOAM5302LitgQVBjGC48DrdBeQIQ/NrFWjV/GGch1MMV+VbfC7E8T2HG G8M3/C2gJNPuIBxyS5V6d+5z5SKc3px7HoRzXfmVqA== X-Google-Smtp-Source: ABdhPJy8do4w5yZuxEKWkVW2eIwgAICsoVJlX2vijoDLzxx/qmuCAGdDgTq3YZ45HD/oPkf72lUMiVSB1BGuPgiLwdw= X-Received: by 2002:a17:90a:4894:: with SMTP id b20mr1818416pjh.13.1627369624969; Tue, 27 Jul 2021 00:07:04 -0700 (PDT) MIME-Version: 1.0 References: <20210714091800.42645-1-songmuchun@bytedance.com> <20210714091800.42645-3-songmuchun@bytedance.com> In-Reply-To: From: Muchun Song Date: Tue, 27 Jul 2021 15:06:28 +0800 Message-ID: Subject: Re: [PATCH 2/5] mm: introduce save_page_flags to cooperate with show_page_flags To: Mike Kravetz Cc: Andrew Morton , Oscar Salvador , Michal Hocko , "Song Bao Hua (Barry Song)" , David Hildenbrand , Chen Huang , "Bodeddula, Balasubramaniam" , Jonathan Corbet , Xiongchun duan , fam.zheng@bytedance.com, linux-doc@vger.kernel.org, LKML , Linux Memory Management List , Qi Zheng Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 27, 2021 at 7:18 AM Mike Kravetz wrote: > > On 7/14/21 2:17 AM, Muchun Song wrote: > > 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)) > > + > > Looking ahead to the next patch, this is changed to hide the PG_head > flag for 'fake' head pages. > > IIRC, all vmemmap pages except the first will be mapped read only. So, > all vmemmap pages with 'fake' head pages will be read only. > > It seems that all the modified trace events below are associated with > updates to page structs. Therefore, it seems these events will never > experience a 'fake' head page. Am I missing something? Totally right. I didn't realize this point before. We cannot see a fake page struct in page refcount tracing. So this patch is definitely pointless. I'll drop it in the next version. Thanks Mike. > > -- > Mike Kravetz 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 X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 0E912C432BE for ; Tue, 27 Jul 2021 07:07:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7D5A761132 for ; Tue, 27 Jul 2021 07:07:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7D5A761132 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 01D9B6B0036; Tue, 27 Jul 2021 03:07:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EE9118D0001; Tue, 27 Jul 2021 03:07:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D894A6B006C; Tue, 27 Jul 2021 03:07:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0096.hostedemail.com [216.40.44.96]) by kanga.kvack.org (Postfix) with ESMTP id BB6436B0036 for ; Tue, 27 Jul 2021 03:07:07 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6E4F58249980 for ; Tue, 27 Jul 2021 07:07:07 +0000 (UTC) X-FDA: 78407486094.07.C92CD20 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by imf18.hostedemail.com (Postfix) with ESMTP id 5CAD3400504E for ; Tue, 27 Jul 2021 07:07:06 +0000 (UTC) Received: by mail-pj1-f48.google.com with SMTP id g23-20020a17090a5797b02901765d605e14so3576561pji.5 for ; Tue, 27 Jul 2021 00:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gRjmuFZcr1eSBhne8H1SLkdS9f3pbpxDfvMvPpPvFP0=; b=QVKjfGbnR32GQUbYrb6/qb02GRpzHi9VNov+FPkEVRqZbbTln2gnlOjt/KDtwrgpmY gIidgwAaLE031GY6D8OFlM0j6U2Tf2sgXS0Piy4FXlomGU9Ya80l1TYPpDFrPtXkTI/W 85YIrUuynRlJLHxRXZBjbUjpN46eZ5i4rWaZYCn9C7SzdAYsHC5MAvE6rkmwODO4dFzZ ue5LVdvewkWM4k/MoHyDebVQYTAhgS/raO1/5MgHNVMJQiniyIhGaHqmUPkwFtA6hY5F gHxeVmKuafAmtwW7BcV0yJgnMD+49AeuMOmI0tJ9Iud9pkJXF5OP368UOMpW8N8eD3KZ 2wrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gRjmuFZcr1eSBhne8H1SLkdS9f3pbpxDfvMvPpPvFP0=; b=hJvMNWvXpsEq8YQbt1B/2rXXzw09ld4kujcxKneUcr6PejxWCJcnxunI3Y0NFmcREF 9DtzhVi/j6P3Obe0Xv6q2XjvWXE6DYYpe041oRPSBSmJLJcSq5EOxNHEfCFdiE/0lIN/ S4l+p8KHrONvvLlB0flUCJucTgXKPggucoK1Qd3IcfvQqKYU4GXoYiYCWPv2bjBEgIj+ 9APUbYTNH8OLz3E42HeZG7ZKQbzI64YLAa8xgV868XQpBnuNqqWn4lFnMOidjbZmrCgL lJAaj0RfAbSLQPpsIHxfHqPUbvsueQ5713/sFt892aBKmuxFHcPKNtNsGgXO4m5jE0dj 5qEA== X-Gm-Message-State: AOAM532bsP59wvdglVDeW5V3FogCa4GgiQ0isU0jZ/ovxvWJRLVypcK9 N4J0oZQP+VNLbYesgInDA35ANIbBTpVRAP7dxuqBfw== X-Google-Smtp-Source: ABdhPJy8do4w5yZuxEKWkVW2eIwgAICsoVJlX2vijoDLzxx/qmuCAGdDgTq3YZ45HD/oPkf72lUMiVSB1BGuPgiLwdw= X-Received: by 2002:a17:90a:4894:: with SMTP id b20mr1818416pjh.13.1627369624969; Tue, 27 Jul 2021 00:07:04 -0700 (PDT) MIME-Version: 1.0 References: <20210714091800.42645-1-songmuchun@bytedance.com> <20210714091800.42645-3-songmuchun@bytedance.com> In-Reply-To: From: Muchun Song Date: Tue, 27 Jul 2021 15:06:28 +0800 Message-ID: Subject: Re: [PATCH 2/5] mm: introduce save_page_flags to cooperate with show_page_flags To: Mike Kravetz Cc: Andrew Morton , Oscar Salvador , Michal Hocko , "Song Bao Hua (Barry Song)" , David Hildenbrand , Chen Huang , "Bodeddula, Balasubramaniam" , Jonathan Corbet , Xiongchun duan , fam.zheng@bytedance.com, linux-doc@vger.kernel.org, LKML , Linux Memory Management List , Qi Zheng Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=QVKjfGbn; spf=pass (imf18.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.216.48 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 5CAD3400504E X-Stat-Signature: e6dtmw5ghgipsisu6j8ix7nqkhwktkh3 X-HE-Tag: 1627369626-38137 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: On Tue, Jul 27, 2021 at 7:18 AM Mike Kravetz wrote: > > On 7/14/21 2:17 AM, Muchun Song wrote: > > 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)) > > + > > Looking ahead to the next patch, this is changed to hide the PG_head > flag for 'fake' head pages. > > IIRC, all vmemmap pages except the first will be mapped read only. So, > all vmemmap pages with 'fake' head pages will be read only. > > It seems that all the modified trace events below are associated with > updates to page structs. Therefore, it seems these events will never > experience a 'fake' head page. Am I missing something? Totally right. I didn't realize this point before. We cannot see a fake page struct in page refcount tracing. So this patch is definitely pointless. I'll drop it in the next version. Thanks Mike. > > -- > Mike Kravetz