From patchwork Tue Jul 23 03:08:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13739290 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 4218CC3DA7F for ; Tue, 23 Jul 2024 03:03:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C91756B0089; Mon, 22 Jul 2024 23:03:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BF5A46B008A; Mon, 22 Jul 2024 23:03:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F9A66B008C; Mon, 22 Jul 2024 23:03:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 818DD6B0089 for ; Mon, 22 Jul 2024 23:03:36 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id F0B23121B94 for ; Tue, 23 Jul 2024 03:03:35 +0000 (UTC) X-FDA: 82369521990.26.D554E13 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by imf09.hostedemail.com (Postfix) with ESMTP id 98658140008 for ; Tue, 23 Jul 2024 03:03:33 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of lihongbo22@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=lihongbo22@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721703752; 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; bh=aI0Y34PQLxRn1vGBSbRhSuI4l+X92FpSqRn9JIXV2eI=; b=OOMZKYigno4bYgBPb9QJXCSYEbCTsJUpFuZRp/pxTczcLDflx30R/ROH1P6fti2uj9zMsP nIeJaLPGAlsHxQEjaZeUQoKK6huD/xwVGkfVHWhzhdVzmqv18aI7lk0+FYlunZ8SA0/kby j0v9in4pRKy7VMG8OBc9ZWUOOLYcwOw= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of lihongbo22@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=lihongbo22@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721703752; a=rsa-sha256; cv=none; b=Muelk1riFzwTPEWWmO9SKlNgP8Dv2PWOyUQyYUKyJ+THRL+1odCiWc1QEuWSMFNOkpZUsH 1uUH+MWnSFEVwNfF4UfHrXbYxsDi1KLBIE9rKskLFUMA2BSmzmJ0Z7h00SUk5Q0VmGhzI+ 4loimfsDYwaRIMdnYHUikDC3D8PKm+c= Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4WShkg26Wvz20lWB; Tue, 23 Jul 2024 11:01:47 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id B548318001B; Tue, 23 Jul 2024 11:03:28 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 23 Jul 2024 11:03:28 +0800 From: Hongbo Li To: , , , CC: , , , , Subject: [PATCH v3 2/2] hugetlbfs: use tracepoints in hugetlbfs functions. Date: Tue, 23 Jul 2024 11:08:34 +0800 Message-ID: <20240723030834.213012-3-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240723030834.213012-1-lihongbo22@huawei.com> References: <20240723030834.213012-1-lihongbo22@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500022.china.huawei.com (7.185.36.66) X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 98658140008 X-Stat-Signature: gb46agtcbkspswkij39gp1bn38495kwb X-Rspam-User: X-HE-Tag: 1721703813-751860 X-HE-Meta: U2FsdGVkX1/lkoIcGJkgSZn/80KyGJO2UADHFeL3yAk1HqolRyy2jbvFFxnQrONCLnSO3ElIca1XMIuLGoMH2o2KJAjU04CNCay9fZR0Y/KCB4xsaUoPdHnInlwmD/4eJVyTf/YRbK3VOeJyzrJK9fQfnWliI+6WN4fCX2rTPhkUAq+041H+QsbSEBpbumBOQ4wbPTwJrn+NsiMXBRWrRl5Cbhj+XwvAOXQOL++p/nuPAW0SCc9iFK8O9uFzxZF3S1ezSOPbixR/XMy7nVYmkshy3cEspDO1JDq1vo4fyI8C0ulvbeV3uf5wEvFvjjdCZ3jGHrT1SYMaHfUfgRuZPGOcCwQGjrABtzC9S7iSiovJzspFAxhVD5m44/72P1EVW1hdsTIdSgdW2G4RiTli9HQ9KjPY+QIlxOr0Eg4TvSvJ5AtVx5v4UkT60jpwDUYn0anjbQIh7RTbHJTBLAO1QPGB93/IcNS7ckFSaCbw1He6OYpQB3uoQK0pMAypug/0wdqpELrLhMkwW3W4wtvNQhJt4JgEQ6hKAo5CzsuRNJtglagow+S2OLO2fA318QoOm3eLqvvnVyJMdELYs4+uLU0we7vL9DDeNoKDt1j3vkWCDh39O1rpEvt9OQt7tY5k4HFCkhvkvU6/fAS3ImpVgTdzfGL+skwItYEucdH6oZ3WEtW241Dl9eZZVbojqXQCYSH/HgNsJFixyFew+hWVcq1hJKz92mR+Hlo0RsNTmm2fbrpRQWefZQcuL8hM+E/FpzPqP/6b0ZbkqRCc/U3ZkUohE4Pjzz6ugh/DCWS1OxeyzQd0dqghhMNQsDxabb3lzlzmFhv+PaBRN6lpGr2UpX7ABgmQla6y+fTkKRbVC9Eqzw1d2pdODZ4AuSuhABWx46VJ6wVgo0fklhyeZUs80P0AAL5SxN7eQXgCkthwfQ9X3I+k7P/6jLt/xYtT9SAGS7E78u6hAkp2Po7k9W0 eiikLFGh HIQg8Gz1b9jVrAxuoX+grJz/VEvDcqCi1+GnIBVOdE+9TS/QROngZkc4e28kRwOKJdxDTDTSU6Dg7XPtFbEQwxbd6hEfCymEjuu5liG34NBLMOSvloGKXry1kDl9lGISXoips8/4mJ3Eu6NORa+04zzxRmwtoZYfTyeJ7wEztKiUMDoA= 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: Here we use the hugetlbfs tracepoint to track the call stack. And the output in trace is as follows: ``` touch-5265 [005] ..... 43.246550: hugetlbfs_alloc_inode: dev 0,51 ino 24621 dir 21959 mode 0100644 touch-5265 [005] ..... 43.246638: hugetlbfs_setattr: dev 0,51 ino 24621 name testfile valid 0x20070 mode 0177777 old_size 0 size -51622648042749952 truncate-5266 [005] ..... 45.590890: hugetlbfs_setattr: dev 0,51 ino 24621 name testfile valid 0x2068 mode 00 old_size 0 size 2097152 rm-5273 [007] ..... 110.052783: hugetlbfs_evict_inode: dev 0,51 ino 24621 mode 0100644 size 2097152 nlink 0 seals 1 blocks 0 -0 [007] ..s1. 110.059441: hugetlbfs_free_inode: dev 0,51 ino 24621 mode 0100644 size 2097152 nlink 0 seals 1 blocks 0 ``` Signed-off-by: Hongbo Li --- fs/hugetlbfs/inode.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 9f6cff356796..1689c01a11a0 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -39,6 +39,9 @@ #include #include +#define CREATE_TRACE_POINTS +#include + static const struct address_space_operations hugetlbfs_aops; static const struct file_operations hugetlbfs_file_operations; static const struct inode_operations hugetlbfs_dir_inode_operations; @@ -687,6 +690,7 @@ static void hugetlbfs_evict_inode(struct inode *inode) { struct resv_map *resv_map; + trace_hugetlbfs_evict_inode(inode); remove_inode_hugepages(inode, 0, LLONG_MAX); /* @@ -814,8 +818,10 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) return -EOPNOTSUPP; - if (mode & FALLOC_FL_PUNCH_HOLE) - return hugetlbfs_punch_hole(inode, offset, len); + if (mode & FALLOC_FL_PUNCH_HOLE) { + error = hugetlbfs_punch_hole(inode, offset, len); + goto out_nolock; + } /* * Default preallocate case. @@ -919,6 +925,9 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, inode_set_ctime_current(inode); out: inode_unlock(inode); + +out_nolock: + trace_hugetlbfs_fallocate(inode, mode, offset, len, error); return error; } @@ -935,6 +944,8 @@ static int hugetlbfs_setattr(struct mnt_idmap *idmap, if (error) return error; + trace_hugetlbfs_setattr(inode, dentry, attr); + if (ia_valid & ATTR_SIZE) { loff_t oldsize = inode->i_size; loff_t newsize = attr->ia_size; @@ -1033,6 +1044,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, break; } lockdep_annotate_inode_mutex_key(inode); + trace_hugetlbfs_alloc_inode(inode, dir, mode); } else { if (resv_map) kref_put(&resv_map->refs, resv_map_release); @@ -1272,6 +1284,7 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) static void hugetlbfs_free_inode(struct inode *inode) { + trace_hugetlbfs_free_inode(inode); kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode)); }