From patchwork Thu Jul 4 03:07:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13723150 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 50480C31D97 for ; Thu, 4 Jul 2024 03:03:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A617E6B0093; Wed, 3 Jul 2024 23:03:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 99BB76B0095; Wed, 3 Jul 2024 23:03:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 815126B0096; Wed, 3 Jul 2024 23:03:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 5F27E6B0093 for ; Wed, 3 Jul 2024 23:03:35 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C9B40409E9 for ; Thu, 4 Jul 2024 03:03:34 +0000 (UTC) X-FDA: 82300574748.03.4FD31EE Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf20.hostedemail.com (Postfix) with ESMTP id 5D3841C000F for ; Thu, 4 Jul 2024 03:03:31 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf20.hostedemail.com: domain of lihongbo22@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=lihongbo22@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720062189; 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=FfltBuXnpGuM70FoeXZHSR/l8omPP0/L/1rTvQX5ovw=; b=ajDaNZYUZjGbHnHt4jLUIhf4Bz0M+UrcqIoQEh8pQNyavllPYnv+hvoBROKpjkd9VoYENf LG9NX8QQDv0gafMorTQmJB4h3ugqoNMe5xe7np2Zmi7fLC0FRopg1gn+r9+cVBxySJPImm 8EmNAOVseH5aUSFvgVWW0XtUqaquWL8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720062189; a=rsa-sha256; cv=none; b=OhSydZLCkZ18ofZqP8EVpY/LIthWRwznuyEadribmF+CgbsY7poECC7JrmwNbsjmooYyJe uIktWqSOCXGzUdAFq9PWa0ZaeiNkNp+lKDbuhvULvT3Wat9juHUkxdh3ej9gSqRq0dBima YRU7qp8f7353eBjBEFhCuoM09cT9XxE= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf20.hostedemail.com: domain of lihongbo22@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=lihongbo22@huawei.com Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WF1ZC6VKXzxTN5; Thu, 4 Jul 2024 10:58:59 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 2BBD814011A; Thu, 4 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; Thu, 4 Jul 2024 11:03:27 +0800 From: Hongbo Li To: , , , CC: , , , Subject: [PATCH v2 1/2] hugetlbfs: support tracepoint Date: Thu, 4 Jul 2024 11:07:03 +0800 Message-ID: <20240704030704.2289667-2-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240704030704.2289667-1-lihongbo22@huawei.com> References: <20240704030704.2289667-1-lihongbo22@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500022.china.huawei.com (7.185.36.66) X-Rspamd-Queue-Id: 5D3841C000F X-Stat-Signature: souqq1aoempfa9xjoanjegracpo9qeku X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1720062211-673908 X-HE-Meta: U2FsdGVkX19f+cWZ+sHXb4T2enhlA8FyhVSR0jBnx/SC+L3f++HQdsq6mzJ4gD7tYbMhQHH/+oTAieMbSIri1IgrCFNGGj025U5hJaduBrVrdSvuOBVXLyOm+60dzQeBDug7DY8kSzn380PyV5YI4R8hrIC1ltCgh+uKiN0iGEnDl9jAu79YGRzON0LkrLisBY6nkPbh9veu0du1xJOiTVS9DmVpBjiSuv5GK0yaEhuzNl42vAfudRNQpHLVp8ga0UzfLyHAB+86IAa8jf98OoFdJlytY+QCl+6ng5zm2IPskZXRYgJHbDv4+cNqT90lO0V6kW8RBmq5P7MoWT1vIKScsOcDXFfGjOdLBqA3G/RRACv8tk6ow3gLR5UH8T2mBQLgUaFtczU0l7nhk9GmMkVbZDf9zdhe6ImKbnXSIS7W0jp8/Se0WmHPuY+H/dQCU83AQ3ljyKTGFvoUqnHizwRO4B062+atuhF2iJRJbKIEs9C6hrj/0iLD5z6CwoEFCfRwATfXMlKSbDk6xPOreEUJf9y2M+C4GqerYC04l2AYE7Uw3OrWLGO9czk4waOg9n1jI0CncbEKKb/r4mnA3KI/N+ZDC+MF8RVi3HJ5JuylZZF9OZblkY9dFjTeOGEFiQyCxnz0KsBnM7BQA6uWTsNDfdlnLXvGe5nD6qZPJy70DNf0zowPE8XqG+NDl6pKY75usy7ser28pykQanCnczPOCRqYg7SQbmRRuCLUblj40S+NOKFWAR/6FJPozzP567Q06appwgN4G3qzSRXs1P7KnZe4UzvzpfJegtryuUMYXvIIZYLooMh1Pjsw9YRMSZtzHd+F7mGsvEbO8rRCxxtIhlr2nsBTFMqu+WQgofn3JlQKlbT1zKV3wSTxG5p6FpL4R9/VdsQXU9jMJbDPe6ToYgIssI2E2YShJwntQde63fowkx+SdsAPqugttT/7kttnUpWiZd2nrjJ/t3N 24sL0kIm J1DhgE/qPTqPI8Q8pCUR0hnkBvjLchGUJqBm66C/wg4n3+mRhYZv7VHSZYJJ1nTfvkwI85Qtb/Kk3g1KcszIUW1cLEThrMbLV58dY/o1kBbn8cpsweN0iE/1UMn+XMohTIMLygtZm+NMcsY+nbVfiHk2x8Q== 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: Add basic tracepoints for {alloc, evict, free}_inode, setattr and fallocate. These can help users to debug hugetlbfs more conveniently. Signed-off-by: Hongbo Li --- MAINTAINERS | 1 + include/trace/events/hugetlbfs.h | 160 +++++++++++++++++++++++++++++++ 2 files changed, 161 insertions(+) create mode 100644 include/trace/events/hugetlbfs.h diff --git a/MAINTAINERS b/MAINTAINERS index cd2ca0c3158e..865c48e92d40 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10188,6 +10188,7 @@ F: Documentation/mm/hugetlbfs_reserv.rst F: Documentation/mm/vmemmap_dedup.rst F: fs/hugetlbfs/ F: include/linux/hugetlb.h +F: include/trace/events/hugetlbfs.h F: mm/hugetlb.c F: mm/hugetlb_vmemmap.c F: mm/hugetlb_vmemmap.h diff --git a/include/trace/events/hugetlbfs.h b/include/trace/events/hugetlbfs.h new file mode 100644 index 000000000000..975f584f6f51 --- /dev/null +++ b/include/trace/events/hugetlbfs.h @@ -0,0 +1,160 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM hugetlbfs + +#if !defined(_TRACE_HUGETLBFS_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HUGETLBFS_H + +#include + +TRACE_EVENT(hugetlbfs_alloc_inode, + + TP_PROTO(struct inode *inode, struct inode *dir, int mode), + + TP_ARGS(inode, dir, mode), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(ino_t, dir) + __field(__u16, mode) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->dir = dir->i_ino; + __entry->mode = mode; + ), + + TP_printk("dev = (%d,%d), ino = %lu, dir = %lu, mode = 0%o", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, + (unsigned long) __entry->dir, __entry->mode) +); + +DECLARE_EVENT_CLASS(hugetlbfs__inode, + + TP_PROTO(struct inode *inode), + + TP_ARGS(inode), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(__u16, mode) + __field(loff_t, size) + __field(unsigned int, nlink) + __field(unsigned int, seals) + __field(blkcnt_t, blocks) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->mode = inode->i_mode; + __entry->size = inode->i_size; + __entry->nlink = inode->i_nlink; + __entry->seals = HUGETLBFS_I(inode)->seals; + __entry->blocks = inode->i_blocks; + ), + + TP_printk("dev = (%d,%d), ino = %lu, i_mode = 0%o, i_size = %lld, i_nlink = %u, seals = %u, i_blocks = %llu", + MAJOR(__entry->dev), MINOR(__entry->dev), (unsigned long) __entry->ino, + __entry->mode, __entry->size, __entry->nlink, __entry->seals, + (unsigned long long)__entry->blocks) +); + +DEFINE_EVENT(hugetlbfs__inode, hugetlbfs_evict_inode, + + TP_PROTO(struct inode *inode), + + TP_ARGS(inode) +); + +DEFINE_EVENT(hugetlbfs__inode, hugetlbfs_free_inode, + + TP_PROTO(struct inode *inode), + + TP_ARGS(inode) +); + +TRACE_EVENT(hugetlbfs_setattr, + + TP_PROTO(struct inode *inode, struct dentry *dentry, + struct iattr *attr), + + TP_ARGS(inode, dentry, attr), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(unsigned int, d_len) + __string(d_name, dentry->d_name.name) + __field(unsigned int, ia_valid) + __field(unsigned int, ia_mode) + __field(unsigned int, ia_uid) + __field(unsigned int, ia_gid) + __field(loff_t, old_size) + __field(loff_t, ia_size) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->d_len = dentry->d_name.len; + __assign_str(d_name); + __entry->ia_valid = attr->ia_valid; + __entry->ia_mode = attr->ia_mode; + __entry->ia_uid = from_kuid_munged(current_user_ns(), attr->ia_uid); + __entry->ia_gid = from_kgid_munged(current_user_ns(), attr->ia_gid); + __entry->old_size = inode->i_size; + __entry->ia_size = attr->ia_size; + ), + + TP_printk("dev = (%d,%d), ino = %lu, name = %.*s, ia_valid = %u, ia_mode = 0%o, ia_uid = %u, ia_gid = %u, old_size = %lld, ia_size = %lld", + MAJOR(__entry->dev), MINOR(__entry->dev), (unsigned long)__entry->ino, + __entry->d_len, __get_str(d_name), __entry->ia_valid, __entry->ia_mode, + __entry->ia_uid, __entry->ia_gid, __entry->old_size, __entry->ia_size) +); + +TRACE_EVENT(hugetlbfs_fallocate, + + TP_PROTO(struct inode *inode, int mode, + loff_t offset, loff_t len, int ret), + + TP_ARGS(inode, mode, offset, len, ret), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(int, mode) + __field(loff_t, offset) + __field(loff_t, len) + __field(loff_t, size) + __field(int, ret) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->mode = mode; + __entry->offset = offset; + __entry->len = len; + __entry->size = inode->i_size; + __entry->ret = ret; + ), + + TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, len = %lld, i_size = %lld, ret = %d", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long)__entry->ino, __entry->mode, + (unsigned long long)__entry->offset, + (unsigned long long)__entry->len, + (unsigned long long)__entry->size, + __entry->ret) +); + +#endif /* _TRACE_HUGETLBFS_H */ + + /* This part must be outside protection */ +#include From patchwork Thu Jul 4 03:07:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13723151 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 A3A35C2BD09 for ; Thu, 4 Jul 2024 03:03:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2BFE66B0095; Wed, 3 Jul 2024 23:03:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 26F746B0096; Wed, 3 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 0E8B76B0098; Wed, 3 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 E0F266B0095 for ; Wed, 3 Jul 2024 23:03:35 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 8DBDD1A0D1A for ; Thu, 4 Jul 2024 03:03:35 +0000 (UTC) X-FDA: 82300574790.11.7935899 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf14.hostedemail.com (Postfix) with ESMTP id EC011100012 for ; Thu, 4 Jul 2024 03:03:32 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of lihongbo22@huawei.com designates 45.249.212.190 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=1720062201; 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=DPjtRhAtgk4/K9nJhlAFyN73kMwsHaj4Nd49IiHJHB4=; b=2vvFF2cq2i9eQxOzFr4I0PUg7kSw7nlG6taslGj4FrvcmDi4271d/JW95B9/cBt6vG+aG6 3Zn3S+MiPh6ga18W42K6ZPHsfE/Z8SR714OaS9zWxhAaGp1OsfP+MPS34qS2O624mWIKXx vCUnFNVhDMT/2f38I134/rn0iAw38Wg= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of lihongbo22@huawei.com designates 45.249.212.190 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=1720062201; a=rsa-sha256; cv=none; b=muLmL+O2at5jgtFboc044sZn4NSrvAQ/46MOFQgZHJ7Q51pcCna6STgwi9miiHm7aU2+rF EssGcyYsQuJThLiHyUErjeIyokai0FOgZQ0vOH2Ej9iQrt3ce/5/g1PK54c0r0OuByyH/B G2X9pj4qN2F9N3k7MHuamlhSN47HQBA= Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4WF1b0689Vz1yv4x; Thu, 4 Jul 2024 10:59:40 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 503501402CD; Thu, 4 Jul 2024 11:03:29 +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; Thu, 4 Jul 2024 11:03:29 +0800 From: Hongbo Li To: , , , CC: , , , Subject: [PATCH v2 2/2] hugetlbfs: use tracepoints in hugetlbfs functions. Date: Thu, 4 Jul 2024 11:07:04 +0800 Message-ID: <20240704030704.2289667-3-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240704030704.2289667-1-lihongbo22@huawei.com> References: <20240704030704.2289667-1-lihongbo22@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500022.china.huawei.com (7.185.36.66) X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: EC011100012 X-Stat-Signature: 4j7b3ew4px8fwmb7c9y18ja5m95ijg7j X-HE-Tag: 1720062212-783933 X-HE-Meta: U2FsdGVkX19O+pojbGxptV2DE43OXvislV8dSWkloMWVEvx09qsRC/QsKWtfWOYghxBfaeUrr6IDAFa9++9rHqs0ZmuIEeQsyZ1PahDejWKLIWYoVyfjWrEAAa1x+H3beMyM2+cBgkIaJ2qsItKiHot4tvgYtRhayXna0SNSWGghye9Zv5JYV6ZJjLP2lPE9MMB4lU8ZRyQ98N+ClRNol01kwo8rk/3cuJy/IdzyT2NGB5EIDZ/JPcSupkz4Sh0dKTH4BlxCJ0XoEgTulQ5okSwWYmZcO6dJ2GEBTJGdrWJFWaxbILeL/NJ1h8r2Ovhy/qFF9qjngSS77R5hruSwe52QdH2t8Bq5AVfNoyZDJboxcAxPzib1HdsnKnIQ3oyrxpq5ShOCvvuVxLjcAxpATNzNQeKpUl2S5LsIbm76n52gEo6jQ3Yinm+akLd++tjQAR/3bJPpMUT2trZLBPB6/eWEST4IlybuMSM3MY5upJHEoME6SwnZxXzawa27ls4xEzgTM0vYahdqyp1jqSaPXgdPKhjzgZknSHeyPDfGn5yWigDgecoGIJESXX/fGGPP1gCCezTQUQEerUgdDEhla7y8o2ivgodnf/2Zt+XRuIHHe/RgpBnmkkpIJflepYeVwrNoM4aPUK1qmb/mPx8aMg1sVQ9D2+fF13X08Dp2oFHQOdxyA4Mn3zhSvTkeglT8e+nRCmgkcqwAsd7KNzVVivBSmOw8ubD5T328MJzo4Uys3RpnuZaYAcKjuVe/D/6EJGNB/lmcfvXgt7iUj9MW3qvJ72PPiANk5KignH9qZkeMoJ3arfEVNG5Jj7kGmMidfHjCoCNxEAF9RRD20LRd6Jqr1M6uifk4n5M/HStrd4c/utAH4KVNWaJjANsWAoLn/a3UHIOcMSSQtNXXaN2sDsPm8KOXMCXH4lNMe1Wt1nl6M5fq+RQRZJfRzaUTI+KnYYxvp9mJJRczbjUk68R KGyVFmrj Fgq4UpKrKDcM1/ZjjIr19qeionYdE/CsrwseWL6Xt/f2s608KSimqRs6aA1bF/tCSpAwD1WkaxxEOqqBMW0oZWNT+6NN6CJmt+IAie90gc8Ac8u3vW2+w7costAddU52Nk8cZlG8xtkfUImfwigPtYiJ0ACRXTHAlCrRi3XOSEC/388Roq9qIzVH/zw== 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-5250 [002] ..... 123.557640: hugetlbfs_alloc_inode: dev = (0,49), ino = 29897, dir = 24079, mode = 0100644 touch-5250 [002] ..... 123.557650: hugetlbfs_setattr: dev = (0,49), ino = 29897, name = test1, ia_valid = 131184, ia_mode = 036720, ia_uid = 2544251907, ia_gid = 65534, old_size = 0, ia_size = 4064 truncate-5251 [002] ..... 142.939424: hugetlbfs_setattr: dev = (0,49), ino = 29897, name = test1, ia_valid = 8296, ia_mode = 00, ia_uid = 0, ia_gid = 0, old_size = 0, ia_size = 2097152 rm-5273 [002] ..... 412.618383: hugetlbfs_evict_inode: dev = (0,49), ino = 29897, i_mode = 0100644, i_size = 2097152, i_nlink = 0, seals = 1, i_blocks = 0 -0 [002] ..s1. 412.634518: hugetlbfs_free_inode: dev = (0,49), ino = 29897, i_mode = 0100644, i_size = 2097152, i_nlink = 0, seals = 1, i_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 412f295acebe..2e826bbcb6ed 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; @@ -686,6 +689,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); /* @@ -813,8 +817,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. @@ -918,6 +924,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; } @@ -934,6 +943,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; @@ -1032,6 +1043,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); @@ -1274,6 +1286,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)); }