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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DEB7C43334 for ; Thu, 23 Jun 2022 13:12:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0BEFF8E0150; Thu, 23 Jun 2022 09:12:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 06F728E0144; Thu, 23 Jun 2022 09:12:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA0E18E0150; Thu, 23 Jun 2022 09:12:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id DAA0B8E0144 for ; Thu, 23 Jun 2022 09:12:07 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id A86868071C for ; Thu, 23 Jun 2022 13:12:07 +0000 (UTC) X-FDA: 79609538694.09.01DEE6A Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf10.hostedemail.com (Postfix) with ESMTP id DD05DC00A8 for ; Thu, 23 Jun 2022 13:12:06 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 65796B82260; Thu, 23 Jun 2022 13:12:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A79B6C341C4; Thu, 23 Jun 2022 13:12:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655989924; bh=sWU7+dd307nQGUnzb6uKj2OthuxZU5W3/b2rzE5N0ug=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BChn9z2TUPL4JLdXi+NDA7/fD21l8o5jU7WMuDLBUisqEBdb7rRifLGmEVQWsOC/9 cG6M0E/JD0nyATUorGurHsVjy57BrxB547Echya1QmmmP8kCVMR/vgcBbftAuQSrse Dh7C7jBGdefOjq4V15ZABrrf28HeLdfCg9RzwXd2bZBIhF/6grhGgm+poZd6W6filO rziSqd5V3OUNbBqi+27+hEudbaLemWIqD/pcdqFe4vBzMtxqlsWx41Oh05BqCb92pR iXtXunPyi5oZx64+GWCAbbDRVEtCm7fngA5VUZeYC3IHiMhs2dP6nMb3NJeKAQquzt 9pVvHVe3vSUfw== Date: Thu, 23 Jun 2022 08:11:58 -0500 From: Mike Rapoport To: Rebecca Mckeever Cc: "Huang, Shaoqin" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand Subject: Re: [PATCH v3 2/4] memblock tests: add verbose output to memblock tests Message-ID: References: <004e021cc3cb7be8749361b3b1cb324459b9cb9f.1655889641.git.remckee0@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655989927; a=rsa-sha256; cv=none; b=oKyxQvQXJc+VqrK47P6mZzn8Uv7RjmsfPDmlrCuSQ+vKDoxax4Te4np5vcDFNbUXrMqFE7 1XZwwcYVK6YnU0VbpR7IBTcVP6r1yueDTgXlNGT78x3XjUKAvOKrEIhfUmnrYBYO2MdH9W unlJMDIM0lFizM1jy+XDwQOu3Ut2A2k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655989927; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LwpUm9vNK4s2MnKdH4YqPCsnEgYwq8qwW9Rm/fRnt64=; b=bFdP2Q+L6aIenRE4tJoeIMvD8WHFXm4wWJ/Yaxz/T88lmevXZ9ZyHsmTrLmgRdo+T0EB6e teZ4nvkIEOra8mlXZgN/HAStrONVSCEOMDtUGaVangJ1m/MB1u5G9M3V1T96kBn22giexw wdkpL5rDMV7jUPzXivrXbg8zUfUenhw= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=BChn9z2T; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf10.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org X-Rspam-User: X-Rspamd-Queue-Id: DD05DC00A8 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=BChn9z2T; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf10.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org X-Stat-Signature: f6kqgto4j7m1q6nw4ju1n8meccum33a7 X-Rspamd-Server: rspam09 X-HE-Tag: 1655989926-366302 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 Thu, Jun 23, 2022 at 02:57:30AM -0500, Rebecca Mckeever wrote: > On Thu, Jun 23, 2022 at 12:04:33AM -0500, Mike Rapoport wrote: > > On Wed, Jun 22, 2022 at 11:56:30PM -0500, Rebecca Mckeever wrote: > > > On Wed, Jun 22, 2022 at 11:05:27PM -0500, Mike Rapoport wrote: > > > > On Thu, Jun 23, 2022 at 09:29:05AM +0800, Huang, Shaoqin wrote: > > > > > > > > > > > > > > > On 6/23/2022 8:45 AM, Rebecca Mckeever wrote: > > > > > > On Wed, Jun 22, 2022 at 06:32:04PM +0800, Huang, Shaoqin wrote: > > > > > > > Just test it and everything works fine. And I think there are some thing can > > > > > > > improve: > > > > > > > > > > > > > > The prefix_push() and prefix_pop() are used in so many functions and > > > > > > > almost of them just put the prefix_push(__func__) begin in the head and the > > > > > > > prefix_pop() in the end. > > > > > > > May be you can define some macro that when you output something and > > > > > > > automatically push the __func__ as prefix. And when leave the function, > > > > > > > automatically pop it. And only in some special place, you call it manually. > > > > > > > > > > > > > Thank you for your review. I'm not sure how you would automatically push > > > > > > __func__ since you have to be inside the function to access that > > > > > > variable. Let me know if you have any suggestions. I am thinking about > > > > > > adding another function in common.c that just calls test_pass() followed > > > > > > by prefix_pop() since those are called together so often. > > > > > > > > > > Just like: > > > > > #define test_pass_macro() \ > > > > > do { \ > > > > > prefix_push(__func__); \ > > > > > test_pass(); \ > > > > > prefix_pop(); \ > > > > > } while (0) > > > > > > > > This will not print the name of the failing test, e.g. instead of > > > > > > > > not ok 28 : memblock_alloc: alloc_bottom_up_disjoint_check: failed > > > > > > > > with Rebecca's implementation it'll print > > > > > > > > not ok 28 : memblock_alloc: failed > > > > > > > Oh yeah, prefix_push() needs to be called before the asserts. > > > > > > > How about > > > > > > > > #define PREFIX_PUSH() prefix_push(__func__)? > > > > > > > Good idea. What about > > > > > > #define TEST_PASS() do { \ > > > test_pass(); \ > > > prefix_pop(); \ > > > } while (0) > > > > > > ? Or would it be better to make a function? > > > > static inline function would be better. > > > Would there be any advantage to defining a different version for each > side of #ifdef VERBOSE? No, a single version will do. For !VERBOSE builds it will be optimized out anyway. > > Thanks, > Rebecca -- Sincerely yours, Mike.