From patchwork Mon Feb 8 10:14:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 12074775 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=-8.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,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 EDCBBC433DB for ; Mon, 8 Feb 2021 10:15:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7DECA64E54 for ; Mon, 8 Feb 2021 10:15:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DECA64E54 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C7EC36B0006; Mon, 8 Feb 2021 05:15:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C54DC6B006C; Mon, 8 Feb 2021 05:15:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B52736B006E; Mon, 8 Feb 2021 05:15:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id 9E2B96B0006 for ; Mon, 8 Feb 2021 05:15:04 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 66F8A3620 for ; Mon, 8 Feb 2021 10:15:04 +0000 (UTC) X-FDA: 77794692528.02.cat80_35115fd275fd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 4F3ED10097AA1 for ; Mon, 8 Feb 2021 10:15:04 +0000 (UTC) X-HE-Tag: cat80_35115fd275fd X-Filterd-Recvd-Size: 5380 Received: from mail-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.47]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Mon, 8 Feb 2021 10:15:03 +0000 (UTC) Received: by mail-oo1-f47.google.com with SMTP id n19so3304593ooj.11 for ; Mon, 08 Feb 2021 02:15:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vCMmRzeRUvjiDoTmyzXxUn/Korqg8Etx51tp2C17oVg=; b=F3iTrEZ3iULk4I5TLTDKE5hqXWLowDwwMZ0ds6BMCd7y/FP0OCH4Jk4FuxzeoTEf3J xSpol477x+ZB9VMfjXkKz0PrImqS619nJi+pHochlvZk2coeDmsJAkAKDHr+2dxuAXso BjXIJhNrSrmzBncmBgvh9kJZnmiz4bJSX48lSeRiQlLHYmosCZVjQCldwvIIcUnzTVIv Kk2sDbrCau/ygmncrLr57RJEa61sPn7Cz2Uej26Xl8eWuACqQrG5b1wF66AeoYe9jTx9 O6UGmSdA6uDMlKzL7ED1fWvvEJro8l4OqvD5qkNZEdMFTNLwiQxOnybapylmPQqjaxys VENQ== 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:mime-version :content-transfer-encoding; bh=vCMmRzeRUvjiDoTmyzXxUn/Korqg8Etx51tp2C17oVg=; b=QcRK2rSMRzf3nS1xZVx/pkJATDBpZPEjCCHjFk9hd1UOnkIAq+fVzV01w9/cmpFj2A FgC1LAXC5uB0+dmXjYFYgmqPFbjwaMj5QB4UlCQKJS3LYIEZWoijFUMH0v1BXi0+QQjI OTlCqblYkXGIFEcm5U6nq2JsCGgG9ovGLR9rcCTNgLEJR4KC5AzHWcwEh1EASzPafYwe /OktIg/9U8CyF96H1VpyJygQ1OtNFYfa8uFPBk+RHQBKRFaBvF9Ro3uu65eoXF1cbOto y7YzendsAZZiw/XcW9lnb8DQsqnrlPwJms8Yo8g+KeY94WWbVo01v7qlTs3lLvTnqf5t R8vg== X-Gm-Message-State: AOAM530Cviu6sQxuRX/3vMYbshXukUHmz5ZxpL1ULGlq6RAAfyCbSw8I 9WCoc0FtV8xw3QGDtNDuCro= X-Google-Smtp-Source: ABdhPJy+b0GzW0jKEOCa0mciq9BdyBuax03BFKIo4Gkibq1omDLr8z/86pN0zQH4MLZZs0C9upYXZg== X-Received: by 2002:a4a:8555:: with SMTP id l21mr12150459ooh.27.1612779303251; Mon, 08 Feb 2021 02:15:03 -0800 (PST) Received: from localhost.localdomain ([50.236.19.102]) by smtp.gmail.com with ESMTPSA id t3sm607226otb.36.2021.02.08.02.14.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Feb 2021 02:15:02 -0800 (PST) From: Yafang Shao To: andriy.shevchenko@linux.intel.com, david@redhat.com, vbabka@suse.cz, willy@infradead.org, cl@linux.com, linmiaohe@huawei.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, pmladek@suse.com, rostedt@goodmis.org, sergey.senozhatsky@gmail.com, joe@perches.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yafang Shao Subject: [PATCH v3 0/3] mm, vsprintf: introduce new format to dump full information of page flags Date: Mon, 8 Feb 2021 18:14:36 +0800 Message-Id: <20210208101439.55474-1-laoar.shao@gmail.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 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: The existed pGp shows the names of page flags only, rather than the full information including section, node, zone, last cpuipid and kasan tag. While it is not easy to parse these information manually because there are so many flavors. We'd better interpret them in printf. To avoid breaking some tools which parsing pGp via debugfs or affecting the printf buffer, other new formats are introduced, so the user can choose what and in which order they want, suggested by Andy. These new introduced format as follows, pGpb: print other information first and then the names of page flags pGpl: print the names of page flags first and then the other info The differece between them looks like the difference between big-endian and little-endian, that's why they are named like that. The examples of the output as follows, %pGpb 0x17ffffc0010200(node=0|zone=2|lastcpupid=0x1fffff|slab|head) %pGpl 0x17ffffc0010200(slab|head|node=0|zone=2|lastcpupid=0x1fffff) To be compitable with the existed format of pGp, the new introduced ones also use '|' as the separator, then the user tools parsing pGp won't need to make change, suggested by Matthew. The doc and test cases are also updated. Below is the output of the test cases, [ 4299.847655] test_printf: loaded. [ 4299.848301] test_printf: all 404 tests passed [ 4299.850371] test_printf: unloaded. This patchset also includes some code cleanup in mm/slub.c. v3: - coding improvement, per Joe and Andy - the possible impact on debugfs and the fix of it, per Joe and Matthew - introduce new format instead of changing pGp, per Andy v2: - various coding improvement, per Joe, Miaohe, Vlastimil and Andy - remove the prefix completely in patch #2, per Vlastimil - Update the test cases, per Andy Yafang Shao (3): mm, slub: use pGp to print page flags mm, slub: don't combine pr_err with INFO vsprintf: introduce new format to dump full information of page flags Documentation/core-api/printk-formats.rst | 2 + lib/test_printf.c | 126 +++++++++++++++++++--- lib/vsprintf.c | 115 +++++++++++++++++++- mm/slub.c | 13 +-- 4 files changed, 233 insertions(+), 23 deletions(-)