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=-7.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 63B22C433DB for ; Fri, 15 Jan 2021 10:15:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C2D1E23603 for ; Fri, 15 Jan 2021 10:15:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C2D1E23603 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 04C098D0152; Fri, 15 Jan 2021 05:15:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 022898D0023; Fri, 15 Jan 2021 05:15:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E545B8D0152; Fri, 15 Jan 2021 05:15:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0048.hostedemail.com [216.40.44.48]) by kanga.kvack.org (Postfix) with ESMTP id CF4D58D0023 for ; Fri, 15 Jan 2021 05:15:33 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 933EC824556B for ; Fri, 15 Jan 2021 10:15:33 +0000 (UTC) X-FDA: 77707602546.08.snow12_11046de2752e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 7350B1819E766 for ; Fri, 15 Jan 2021 10:15:33 +0000 (UTC) X-HE-Tag: snow12_11046de2752e X-Filterd-Recvd-Size: 5564 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 Jan 2021 10:15:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610705732; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VqI/ri+aM1jkwKxc9qmJAaYBPnx09iakTRaxGw6AtVQ=; b=Csq3ushgULIoW667XO4XToJctJFrwQJLZ7cqfNsVtUJ10IQxKFx06yPZ27EmTQzStQ+4dG 8rxp2XJaTGXuHRmGAH1wxrDCIASYWCU2rX2Ap2HCVjU/TxDqrj5RT777LFqSm+AEJiAf4B d+KnaD24PruZyGIpnkuzBuwLPnr8ImI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-282-pg1zZAX-Oeax-xCbjzks_A-1; Fri, 15 Jan 2021 05:15:28 -0500 X-MC-Unique: pg1zZAX-Oeax-xCbjzks_A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4441C8042AA; Fri, 15 Jan 2021 10:15:26 +0000 (UTC) Received: from [10.36.112.11] (ovpn-112-11.ams2.redhat.com [10.36.112.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF84719C45; Fri, 15 Jan 2021 10:15:22 +0000 (UTC) Subject: Re: [PATCH 2/2] mm: introduce PAGE_FLAGS() to make output of page flags better To: Yafang Shao Cc: Christoph Lameter , penberg@kernel.org, David Rientjes , iamjoonsoo.kim@lge.com, Andrew Morton , Matthew Wilcox , Johannes Weiner , Michal Hocko , osalvador@suse.de, linmiaohe@huawei.com, steven.price@arm.com, Roman Gushchin , "Huang, Ying" , Linux MM References: <20210115061349.67386-1-laoar.shao@gmail.com> <20210115061349.67386-3-laoar.shao@gmail.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <1acfa7dd-3662-0a60-41e7-ae3ead8aeeb8@redhat.com> Date: Fri, 15 Jan 2021 11:15:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 15.01.21 11:10, Yafang Shao wrote: > On Fri, Jan 15, 2021 at 4:39 PM David Hildenbrand wrote: >> >> On 15.01.21 07:13, Yafang Shao wrote: >>> There're totally __NR_PAGEFLAGS page flags, but the type of page->flags is >>> unsigned long, that makes the value of page->flags a little misleading when >>> it is printed to the user. We'd better print the real pages flags, instead >>> of the whole 64bits including the random values in the useless high bits. >> >> No, these are *not* random values. They include the nid, zid, and >> section_nr - which are helpful to have at hand when debugging, or >> detecting that something might be messed up there. >> > > Thanks for the explanation. I just noticed the page-flags layout in > page-flags-layout.h. > >>> >>> There're two choices to achieve that, one of which is clear the useless >> >> Again, not useless. >> >>> high bits when we initlize the page->flags, the other is don't print the >>> high bits when it is showed to the user. The latter one is better because >>> it is in the slow path and the performance won't be impacted. >>> >>> Before that change, the output is, >>> [ 8846.517809] INFO: Slab 0x00000000f42a2c60 objects=33 used=3 fp=0x0000000060d32ca8 flags=0x17ffffc0010200(slab|head) >>> >>> After that change, the output is, >>> [ 8843.757770] INFO: Slab 0x00000000f0e98335 objects=33 used=3 fp=0x00000000b643c7d8 flags=0x10200(slab|head) >>> >> >> Nack to the current approach. If you're going to strip this information, >> you should expose it differently. E.g., printing page_zonenum() or >> page_to_nid(). But still, then we might lose valuable information of >> bits stored in there that shouldn't have been set. >> > > How about changing the implementation of pGp in printk() ? > In the new implementation of pGp we can dump the full information of > page->flags, rather than the flag's name only. > > For example, > 0xXXXXXXXX(node n, nid n, ..., slab|head) > > That will make it easier to understand, as it is not easy to look into > the detail of page-flags layout. Not completely opposed to this. Just keep in mind that the information stored in the high bits differs per configuration. See include/linux/page-flags-layout.h So to dump reliably, you would have to consider all different flavors, looking at SECTIONS_WIDTH, NODES_WIDTH, ZONES_WIDTH, LAST_CPUPID_WIDTH, KASAN_TAG_WIDTH Might be helpful for other users as well, like in mm/memory-failure.c -- Thanks, David / dhildenb