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 843A7C30658 for ; Tue, 2 Jul 2024 13:30:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 10BA46B00A1; Tue, 2 Jul 2024 09:30:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0BBC86B00A3; Tue, 2 Jul 2024 09:30:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EC48C6B00A4; Tue, 2 Jul 2024 09:30:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C7B226B00A1 for ; Tue, 2 Jul 2024 09:30:13 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2525AA00AE for ; Tue, 2 Jul 2024 13:30:13 +0000 (UTC) X-FDA: 82294896306.19.54BE319 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf01.hostedemail.com (Postfix) with ESMTP id 346CF40016 for ; Tue, 2 Jul 2024 13:30:10 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=KZaCKKWd; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf01.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719926994; a=rsa-sha256; cv=none; b=RS5AMqU1io/NY4/ZUX8JSXDQHw3RfdtXTU1PEsAWmojiZzDt2DrS2Z1wtJyzyZyXPmxdvu aGpKEKgycQsiWVloB1T4YZGI/sJSbv7qlRBX51GDSoHAEl6IlBF7sK7wndrR9Qs1Mzjstz tFXxbgT7Gzo46NSP2zjvAAs4OadCS4U= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=KZaCKKWd; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf01.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719926994; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=vAwer3Esikqht6Ueu66dJ+czFvoJlQpAFqOtbNNGIUA=; b=Jqqx4DnydCA5hFuUY8x3ZN2o+hjyptvohcWZsn1ehEMTdhxNrfWO8JSQxZwqkPsxjGUYZA 1iBNr4z+wNwoi5vRCgtmQKLfvjjN/yk4Db0tYAJulFWN8AWpfv8VF7VsNlCwVlmPVo2HiR dYmx5Qh1aEF5aO+nrfAUIgsLs2Su8uk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1719927009; bh=07wJLNcwr+baGCJCP/F1XaeLBINuK7arxryuHcuoQZo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=KZaCKKWdch3pNxrVCWDa7yvlE7UQYrYmA7qiMog304SXH+ChN7hdn7Lm4sZFyrMdT U17gpRn8BFdTpRULsxRe+jB55vrZKQnxkbCUybDvenRF/FLjDSmp38dK5TCy//m486 mmN/tuxAkMOuwBuePXqTsYyqRCPqxJ/KXuNvpKCM8oidbyPaYcqvlZJcTs+ss9uSLX /AqDhWbUbY92AwOIhPUlFH323mgVa/fgEQz8xb/AngSCHm2/xAsLPEXpTPOmDan3zs aPRNUnEKPoFAH2QRnX7AOkIR/ykU+9EuPH3xEfTVg+Fhr3mdWBk4XvrRJHmzbP4Q4B 0+dTeqleJuVhw== Received: from [172.16.0.134] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4WD3gP5sHbz1879; Tue, 2 Jul 2024 09:30:09 -0400 (EDT) Message-ID: <8015a0bf-39e2-406c-8f61-db87a40a71a3@efficios.com> Date: Tue, 2 Jul 2024 09:30:30 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] hugetlbfs: use tracepoints in hugetlbfs functions. To: Hongbo Li , Steven Rostedt Cc: muchun.song@linux.dev, mhiramat@kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org References: <20240612011156.2891254-1-lihongbo22@huawei.com> <20240612011156.2891254-3-lihongbo22@huawei.com> <20240701194906.3a9b6765@gandalf.local.home> <1eca1fcd-5479-47b2-b7ba-eb4027135af2@huawei.com> Content-Language: en-US From: Mathieu Desnoyers In-Reply-To: <1eca1fcd-5479-47b2-b7ba-eb4027135af2@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 346CF40016 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: pmzrqyjiyxbgo6zfopg57x4bd4a8imsk X-HE-Tag: 1719927010-362094 X-HE-Meta: U2FsdGVkX1/u7GvAbJkGNlJBDQONhDNvCLXCsP4c9WAaLossIdnAPvxBzvajOouJZlbS5f3PZxFxPfca1ZycSVPLj1oEGVHYmVy+aVvNt96Usoi7SmcXxdFDpTL+urr58meaeQYtwTKmWWz30vzqu17cptwZi7q12lLFqFakwFqb6avHeJduEQXaPG/ZDUesHweBiu8LulJkYphPXWavR5DyaHcn7vFIzJgpjAv+o2ezJ5zcYody5359C9sUVmAhjqAJGZCev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F0QFEdCXG/OC/ld6 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: List-Subscribe: List-Unsubscribe: On 2024-07-02 07:55, Hongbo Li wrote: > > > On 2024/7/2 7:49, Steven Rostedt wrote: >> On Wed, 12 Jun 2024 09:11:56 +0800 >> Hongbo Li wrote: >> >>> @@ -934,6 +943,12 @@ static int hugetlbfs_setattr(struct mnt_idmap >>> *idmap, >>>       if (error) >>>           return error; >>> +    trace_hugetlbfs_setattr(inode, dentry->d_name.len, >>> dentry->d_name.name, >>> +            attr->ia_valid, attr->ia_mode, >>> +            from_kuid(&init_user_ns, attr->ia_uid), >>> +            from_kgid(&init_user_ns, attr->ia_gid), >>> +            inode->i_size, attr->ia_size); >>> + >> >> That's a lot of parameters to pass to a tracepoint. Why not just pass the >> dentry and attr and do the above in the TP_fast_assign() logic? That >> would >> put less pressure on the icache for the code part. > > Thanks for reviewing! > > Some logic such as kuid_t --> uid_t might be reasonable obtained in > filesystem layer. Passing the dentry and attr will let trace know the > meaning of structure, perhaps tracepoint should not be aware of the > members of these structures as much as possible. As maintainer of the LTTng out-of-tree kernel tracer, I appreciate the effort to decouple instrumentation from the subsystem instrumentation, but as long as the structure sits in public headers and the global variables used within the TP_fast_assign() logic (e.g. init_user_ns) are export-gpl, this is enough to make it easy for tracer integration and it keeps the tracepoint caller code footprint to a minimum. The TRACE_EVENT definitions are specific to the subsystem anyway, so I don't think it matters that the TRACE_EVENT() need to access the dentry and attr structures. So I agree with Steven's suggestion. However, just as a precision, I suspect it will have mainly an impact on code size, but not necessarily on icache footprint, because it will shrink the code size within the tracepoint unlikely branch (cold instructions). Thanks, Mathieu > > Thanks, > Hongbo > >> >> -- Steve >> -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com