summaryrefslogtreecommitdiffstats
path: root/fs/hugetlbfs
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2024-09-17 11:07:49 +0200
committerChristian Brauner <brauner@kernel.org>2024-10-02 07:52:11 +0200
commit2b2b1a20db83cf0c3892dac2a6b2a7292c9607d8 (patch)
treeda7a0897a60f10cf3b22ec354f338fccac859e78 /fs/hugetlbfs
parentMerge patch series "Fixup NLM and kNFSD file lock callbacks" (diff)
parenthugetlbfs: use tracepoints in hugetlbfs functions. (diff)
downloadlinux-2b2b1a20db83cf0c3892dac2a6b2a7292c9607d8.tar.xz
linux-2b2b1a20db83cf0c3892dac2a6b2a7292c9607d8.zip
Merge patch series "Introduce tracepoint for hugetlbfs"
Hongbo Li <lihongbo22@huawei.com> says: Add some basic tracepoints for debugging hugetlbfs: {alloc, free, evict}_inode, setattr and fallocate. * patches from https://lore.kernel.org/r/20240829064110.67884-1-lihongbo22@huawei.com: hugetlbfs: use tracepoints in hugetlbfs functions. hugetlbfs: support tracepoint Link: https://lore.kernel.org/r/20240829064110.67884-1-lihongbo22@huawei.com Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/hugetlbfs')
-rw-r--r--fs/hugetlbfs/inode.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 5cf327337e22..2dea122e5b93 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -39,6 +39,9 @@
#include <linux/uaccess.h>
#include <linux/sched/mm.h>
+#define CREATE_TRACE_POINTS
+#include <trace/events/hugetlbfs.h>
+
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));
}