Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1543308iob; Thu, 19 May 2022 08:44:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIDpuOfUmTEwm9KT5OKIW/mLsokn7KVwpjuINOyzwjt9BCu99jCk2LnGzOuWvuqvpoHSZ1 X-Received: by 2002:aa7:d488:0:b0:42a:b7be:893b with SMTP id b8-20020aa7d488000000b0042ab7be893bmr5927744edr.399.1652975065440; Thu, 19 May 2022 08:44:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652975065; cv=none; d=google.com; s=arc-20160816; b=BxCM4g2l70u9D2EUJf1Xvh5LD7agwjLdDAveMFMZUdUPDetPlJvJeP57/JiTuy09hq FkcIn40rw6msp/A2kZSO8Zq7h1GmAxBdL1h58edfKce4mMQgzkltHgH5DdE85g6bJbBf gtsuTNKon8JhyrqJ/x+siHZRlo6u2ktMpSof8AoV4Den4AKyuimVWpANNh3L2XUGVjmv J31EhISwN2Gek4v9zf3y3oIqP6j3WWPE5SVYortOXyrNcaqushpIU/vW4Nw1M5fVS94H T3THIVmwAtgl0GZglQ2FAB+NqFAd3SuuxfHwGU3U0KWcXLityQYftikYShq3ZzZWGDUM VrJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=oxibleWjg5piZBF2UIB37tPZ8A10UXKI4apmU+0ZgSE=; b=Gu333bXHaIPsXHCqNhkGi1JywMODU1ts/zZeMhIBmcnBdloY75kHTAELiSFrSerXcb LmUpYhUxM7LyrJ6NqwPvM6W7lff6G9CPfYOmNVj/PSsY8Fxo7+1BZzSnQLfk0IJIft++ uANzquKbxTKyVr9koiuIEaZPqsTAHIU4I2sMnLJeLE0UaBMqeKD2cZdlDV23/dfutmMb ZHvQD6QJ/7mEMOBMFeawo4hRAvAxWQsYSmpF+o3vwoWo4wSHpdvkniXLLsj1YQtFo/Ak mFUkvlqhSfVes4jsOJ1BcSyhbVdlPgAE/yBc6IeaRkXp1LyJrNiDTAQORekNY/CM2gyZ 7VqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=8EB4pJ5d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvz.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fy12-20020a1709069f0c00b006f4fc3b8b6esi4542751ejc.21.2022.05.19.08.43.57; Thu, 19 May 2022 08:44:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=8EB4pJ5d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvz.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237446AbiESLf6 (ORCPT + 99 others); Thu, 19 May 2022 07:35:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237452AbiESLfz (ORCPT ); Thu, 19 May 2022 07:35:55 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B228CDDE for ; Thu, 19 May 2022 04:35:51 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id w14so8543061lfl.13 for ; Thu, 19 May 2022 04:35:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz-org.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=oxibleWjg5piZBF2UIB37tPZ8A10UXKI4apmU+0ZgSE=; b=8EB4pJ5d6ls+vf8cvcPsR22q2RxCetm5Iw2kafSsbt/+95CKUc0uKp5QkBhyrST1rt 6lHoRg71vpeaZsk1OKWJUv5oDbc4vDrSGqQayY++4QB2v5fjP99+fSXmZImkVJclh3kD S1+iwmP44Yu9mSMNikOkMHFLdC3dG6TZF/UUW33LiEmsmu7kReeJyjxE4ExaolC+/IpH eH7yaRloZsgKADBBLdppr1XLrzBvtgj/QwFOf1FheHSdwvtFkYTpryFD3a22LKiRtgsl X3bN8EENiOaDuYZghe5I9Doa8KS82H/H0bFJUhUloRLebbtVRhn8zx7Rx4i4I3udKAvb vEVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=oxibleWjg5piZBF2UIB37tPZ8A10UXKI4apmU+0ZgSE=; b=DDipmUYK3/fgkl2TLerYKGIB8yF0y1PcwdiBSuWHkPUHkZ+LH2H7nqvH6x0BZgopxN eSdCrNMhqJiq8wGoW40CfhOlSpKfLUHQBejJCviAS+Qf/J0JSsS/lbGOhwuA3P3753/G IemrgUOmsFCI5bGozL00QYtqcBA+5JiJGOycPaFma+fThnMsLAgckXcV5kRWPqIyfbBV fEnQ84qYI66EbAMFm2WNTgBT9oKZGg80hTOYu//h4sTjzYC6Mfj2m1GfE8gw2PJDyrvy mT97+7LVKf5qcMeRDujfoaURHPQ7cwRuT6j2TOhIJ9ZQ9xwG3ZnSDrqVGoV1n4qBw0JL 6/tQ== X-Gm-Message-State: AOAM5335Zbi4PuPZeKroTwKTC2kSLDM2vyGXONPe2RdYid+ieylfhO0N FQZEtZeU4pryJFgSVEhpfFctXA== X-Received: by 2002:a05:6512:686:b0:473:9d94:372d with SMTP id t6-20020a056512068600b004739d94372dmr3000734lfe.623.1652960150032; Thu, 19 May 2022 04:35:50 -0700 (PDT) Received: from [192.168.43.196] ([185.174.128.243]) by smtp.gmail.com with ESMTPSA id j5-20020ac253a5000000b0047255d21163sm260922lfh.146.2022.05.19.04.35.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 May 2022 04:35:49 -0700 (PDT) Message-ID: Date: Thu, 19 May 2022 14:35:46 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v3] tracing: add 'accounted' entry into output of allocation tracepoints Content-Language: en-US To: Steven Rostedt Cc: YoPOhRctb8wwbmY5@carbon, Shakeel Butt , Roman Gushchin , Vlastimil Babka , Matthew Wilcox , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Muchun Song , kernel@openvz.org, linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , linux-mm@kvack.org, Joonsoo Kim , David Rientjes , Pekka Enberg , Christoph Lameter , Michal Hocko References: <20220518160447.20a7b96f@gandalf.local.home> From: Vasily Averin In-Reply-To: <20220518160447.20a7b96f@gandalf.local.home> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/18/22 23:04, Steven Rostedt wrote: > On Wed, 18 May 2022 09:24:51 +0300 > Vasily Averin wrote: > > FYI, the subject should be something like: mm/tracing: > Because "tracing:" is reserved for tracing infrastructure updates. Thank you for noticing. >> @@ -33,42 +35,46 @@ DECLARE_EVENT_CLASS(kmem_alloc, >> __entry->bytes_req = bytes_req; >> __entry->bytes_alloc = bytes_alloc; >> __entry->gfp_flags = (__force unsigned long)gfp_flags; >> + __entry->accounted = (gfp_flags & __GFP_ACCOUNT) || >> + (s && s->flags & SLAB_ACCOUNT); > > Now you could make this even faster in the fast path and save just the > s->flags. > > __entry->sflags = s ? s->flags : 0; > >> ), >> >> - TP_printk("call_site=%pS ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s", >> + TP_printk("call_site=%pS ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s accounted=%s", >> (void *)__entry->call_site, >> __entry->ptr, >> __entry->bytes_req, >> __entry->bytes_alloc, >> - show_gfp_flags(__entry->gfp_flags)) >> + show_gfp_flags(__entry->gfp_flags), >> + __entry->accounted ? "true" : "false") > > And then have: "accounted=%s": > > (__entry->gfp_flags & __GFP_ACCOUNT) || > (__entry->sflags & SLAB_ACCOUNT) ? "true" : "false" Unfortunately this returns back sparse warnings about bitwise gfp_t and slab_flags_t casts. Could you please explain why your variant is faster? Thank you, Vasily Averin