Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7181629rwi; Mon, 24 Oct 2022 10:51:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM43Z5UwHds3nje/ZNmpt1fDDUP1rE/bla8DJBU/7KOuiEcOyqvAvMVxTaUwqJjenuuAg6Pc X-Received: by 2002:a17:903:22c1:b0:184:983f:11b2 with SMTP id y1-20020a17090322c100b00184983f11b2mr35253450plg.40.1666633897904; Mon, 24 Oct 2022 10:51:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666633897; cv=none; d=google.com; s=arc-20160816; b=GMlegJ4lCbswRTP6d0t6fruSODRnQsI+PhZR8iy+7rGe6syCiA/mfdLUeb8FJeLgJ+ PaFPKqf2Mtn+JBQjMh0kWshHyA3hRe3IOnMixcPI0F+lrnZIqinXEU1/zooDf3J0lPVM z2HfMdH1/tXXbqpniyB9VElqVFhRIkaIIyvZrWbFZ5rc3kaSYKTG4AZiZ6BFywQesldI HxPI2MpgLtVl9mxsIYeTgAGUng3V+lu/Q8tf+56ybymCYLZRvIQnXc7teW6M8ZWtaZk9 6ZVxlTlTjx07vJ0mSiKCIrhJUQTOKoF/bm2U7YByregVL5EeBNz5K+TuLHeOCLZEVwd8 oeWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=yC3Z9X1MrSWPaCOdrM3rQf4v4UUMlxVFsOYWBORVgdw=; b=jHVKyVJkwEXLO9Io3U21PULAqnqS4sQqSL1g5gLIXqQmdOd1b8WHOSd6a8/MJMK4nP EOqru0zBtoe7tQfYkG/HmxLH9cpPQ1yUsev+GHMrfO6yZTLqJm+AWfY6Vnotccb28fRU RvmBkR/6f8VsKjdKcuz040BKBCvQ29ekPRgbZk9wH6xM8S6GMT74JEzMhfGoFE2O3fwo OqUDq0ekpiH8nFKSdUbEx2q2iwjur+JD+v98EwmJpbuBsMwvDDt1tylyW79zxL/wzYMI Z1I21zaLsGiPN5d6PyV+fSQnJQdiNQuHSnO4yPObQSF2UoaoUc4rpUB1GlWllQDs2zI2 4gXQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q13-20020a170902f34d00b0017829e27195si73914ple.521.2022.10.24.10.51.26; Mon, 24 Oct 2022 10:51:37 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236172AbiJXQzo (ORCPT + 99 others); Mon, 24 Oct 2022 12:55:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235172AbiJXQup (ORCPT ); Mon, 24 Oct 2022 12:50:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AC522F39E for ; Mon, 24 Oct 2022 08:34:17 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id E4A8A6142A for ; Mon, 24 Oct 2022 15:16:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AAC6C433C1; Mon, 24 Oct 2022 15:16:11 +0000 (UTC) Date: Mon, 24 Oct 2022 11:16:21 -0400 From: Steven Rostedt To: Gautam Menghani Cc: akpm@linux-foundation.org, mhiramat@kernel.org, zokeefe@google.com, shy828301@gmail.com, vbabka@suse.cz, david@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/khugepaged: add tracepoint to collapse_file() Message-ID: <20221024111621.3ba17e2c@gandalf.local.home> In-Reply-To: <20221024150922.129814-1-gautammenghani201@gmail.com> References: <20221024150922.129814-1-gautammenghani201@gmail.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS 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 Mon, 24 Oct 2022 20:39:22 +0530 Gautam Menghani wrote: > +TRACE_EVENT(mm_khugepaged_collapse_file, > + TP_PROTO(struct mm_struct *mm, struct page *hpage, > + unsigned long addr, const char *filename, int nr, > + int result), > + TP_ARGS(mm, hpage, addr, filename, nr, result), > + TP_STRUCT__entry( > + __field(struct mm_struct *, mm) > + __field(unsigned long, hpfn) > + __field(unsigned long, addr) > + __string(filename, filename) > + __field(int, nr) > + __field(int, result) > + ), > + > + TP_fast_assign( > + __entry->mm = mm; > + __entry->hpfn = hpage ? page_to_pfn(hpage) : -1; > + __entry->addr = addr; > + __assign_str(filename, filename); > + __entry->nr = nr; > + __entry->result = result; > + ), > + > + TP_printk("mm=%p, hpage_pfn=0x%lx, addr=%ld, filename=%s, nr=%d, result=%s", > + __entry->mm, > + __entry->hpfn, > + __entry->addr, > + __get_str(filename), > + __entry->nr, > + __print_symbolic(__entry->result, SCAN_STATUS)) > +); > + > #endif /* __HUGE_MEMORY_H */ > #include > diff --git a/mm/khugepaged.c b/mm/khugepaged.c > index 4734315f7940..14db90e2f2ec 100644 > --- a/mm/khugepaged.c > +++ b/mm/khugepaged.c > @@ -2059,7 +2059,9 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, > mem_cgroup_uncharge(page_folio(hpage)); > put_page(hpage); > } > - /* TODO: tracepoints */ > + > + trace_mm_khugepaged_collapse_file(mm, hpage, addr, file->f_path.dentry->d_iname, I try to keep dereferences out of the calling path as much as possible (adds to I$ at the call site). Could you just pass in file, and then have: __string(filename, file->f_path.dentry->d_iname) [..] __assign_string(filename, file->f_path.dentry->d_iname); If you are paranoid, you can have the above also be: file ? file->f_path.dentry ? file->f_path.dentry->d_iname : "(null)" : "(null)") -- Steve > + nr, result); > return result;