From patchwork Thu Aug 29 06:41:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13782627 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 02AEFC761AE for ; Thu, 29 Aug 2024 06:33:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 00C726B00B3; Thu, 29 Aug 2024 02:33:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EAF656B00B5; Thu, 29 Aug 2024 02:33:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C6BCD6B00B7; Thu, 29 Aug 2024 02:33:20 -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 7931F6B00B3 for ; Thu, 29 Aug 2024 02:33:20 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 32A3780910 for ; Thu, 29 Aug 2024 06:33:20 +0000 (UTC) X-FDA: 82504316160.02.3FD7796 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf13.hostedemail.com (Postfix) with ESMTP id CBC412001A for ; Thu, 29 Aug 2024 06:33:16 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; spf=pass (imf13.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=1724913108; 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=s1bZp+zVwIacj0TD7z/Jb2sn3BvFjOvztj11zOImrwk=; b=tXMbWp9y+sVOcy9PrA/x2dtQ/G+w4UCH5XUDYHi78B9pN2H5vrhNCUdRjauZwTTy8CYIpd Ua9EG9fpluGDxIbtEtoX/4SLtAh9Qnnffcdph1HT0SAp8kRJVkETevrETHSoUbG6bwSc/e w1rrGbdrn0XUjKbE7PNYfGtb/HIU60Y= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724913108; a=rsa-sha256; cv=none; b=0SZshDkNMgso67IUE34rovXtl0Me5z3nJE2kfxpII6KxK821fsIjSQhMAs9INAhUKBoBBq J3lJQP+Erp4g5zkneADAUDGv88v15x1Y+9rzcy++5hfw+R6ErPRm06qVnFYqzHpDj3kDOm vTReaC7AKCV4b5FzwCtPDAQIDRw/WDg= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; spf=pass (imf13.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 Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4WvWYz21wXz20n5b; Thu, 29 Aug 2024 14:28:23 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 8BA5C1A0188; Thu, 29 Aug 2024 14:33:13 +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, 29 Aug 2024 14:33:13 +0800 From: Hongbo Li To: , , , , , CC: , , Subject: [PATCH RESEND v3 1/2] hugetlbfs: support tracepoint Date: Thu, 29 Aug 2024 14:41:09 +0800 Message-ID: <20240829064110.67884-2-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829064110.67884-1-lihongbo22@huawei.com> References: <20240829064110.67884-1-lihongbo22@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500022.china.huawei.com (7.185.36.66) X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: CBC412001A X-Stat-Signature: ko8or7czt1qo3z5m1o8y7co47z7cpf6z X-HE-Tag: 1724913196-206159 X-HE-Meta: U2FsdGVkX1/ZwalEQFVsm2792hz2molS2b55l/kOEIzfsYJhFEoukLycE/Zo9edamnE99NKN5f6feArTvBG8ewes5vYUXVJyq3MRBRhqpJuQR63yRPQtW6AZyHGLNbSTdi+YfczVou2N5nEd8zz9quBqNW8tpBBPdawDi+7kcyR4IuH+R966DZLv3Cuw7jTDgeymcyPK33Nl8c4NwkfhK619dhqBUd7FIA5aBlVYmBFRe8YZ58wMCsn4tCp+g3mdO5MFFji56aIufuZg9oMYrGh/QeGXGFeUyI3AOZjFCM36F2CuIlztTYNl64XhFPh7xkov9aymRjZKuNS0EWn7nv5hVtVckSQ7FMUm4y+Ar6/lk8MuEbJYtBjyz28IuJGxPIfJu5fvVh0VmTMV8VG1/VOdyysuusJYLMS1Y8Ac2txy3w2weEmi9uxYehThKRyol9oB0fDXiFr7lBfRXY6A4U7VwFkmit6bgBVOyDBWPkR3g0eI0wi6y1MsAKvRKFcLz6RZzShBR/6rtYxbbfdmDTbfX6OQ8W12q0CoHNKgtPM9CuOoRop+ZMeVl/Toc6pNo6ncyi8vSC3S1ukTO0/YiLtH+tmStaIm+wTwlaTHQziL/iHHojuFqTqL6sleh1r4ydKyOFGJ+6EqGiWGb2GyfZDGJigCKWXXUrT6Dh5EHR0J7+S1NZteXzZf51t+PUzTEFBS4MMftWjH9Jd5+7qQotvz4fYyxZBtuduXwELb2H30jUnlmTDeOdArFiP3qJ2q7NeuLT706gkWNUu1gYTVWJzhSV5bChuFR0+pDrL/2da828cXW+J81R/SKhNy2UiRNpSZ2I6Xo1aE2pevIPtVhLPyWOEtNjSVzWMotiaY9BN3FE7gktXUVk/+ks4RVIl0dBWrS7Odn3vixmZrNky23Y0VsDrS+mgswkSGD5WgDhCIncQnB/Dx/7ZXp4Rb0gKGCqZWbRB/nDB3GOl+iI9 ly2GB2Kg DF6sp5vIoFYbve8ST0PLOr7CfJKtWZJ9RTRJ07g/+EC23wsXDe5b8s/9cCgEEhKMcV6w8hReTO4wph+APnSBJKBioBXhNi+iIOjyKoodeRtci2lGyeRfDwCUVXwBrd7AXJXs5oTGOl9BvG9O+/pdVl2oh3Q== 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 Reviewed-by: Steven Rostedt (Google) --- MAINTAINERS | 1 + include/trace/events/hugetlbfs.h | 156 +++++++++++++++++++++++++++++++ 2 files changed, 157 insertions(+) create mode 100644 include/trace/events/hugetlbfs.h diff --git a/MAINTAINERS b/MAINTAINERS index a70b7c9c3533..f7d90c090961 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10367,6 +10367,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..8331c904a9ba --- /dev/null +++ b/include/trace/events/hugetlbfs.h @@ -0,0 +1,156 @@ +/* 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 mode 0%o size %lld nlink %u seals %u 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(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->old_size = inode->i_size; + __entry->ia_size = attr->ia_size; + ), + + TP_printk("dev %d,%d ino %lu name %.*s valid %#x mode 0%o old_size %lld 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->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 0%o offset %lld len %lld 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 Aug 29 06:41:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13782626 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 78171C77B7C for ; Thu, 29 Aug 2024 06:33:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A3ED86B00B1; Thu, 29 Aug 2024 02:33:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 964BA6B00B8; Thu, 29 Aug 2024 02:33:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 671936B00B7; Thu, 29 Aug 2024 02:33:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 381806B00B1 for ; Thu, 29 Aug 2024 02:33:20 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id EC4EE1A0A0F for ; Thu, 29 Aug 2024 06:33:19 +0000 (UTC) X-FDA: 82504316118.17.F5CB34D Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf19.hostedemail.com (Postfix) with ESMTP id 926281A0014 for ; Thu, 29 Aug 2024 06:33:17 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=none; spf=pass (imf19.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=1724913128; 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=Tnv/8pzWokEKyg428gcfNf1vz3eTpD0oZD2FayivXgO8ospLOMZbu24Gw/f6O5T+WyOXIJ ITJizQxi+FQSmo7xXJlO0jm3x2sS/S8hey0Jro+fGqpT2q2fhpDkzll4nQ87yb5MEDsDB2 dU1Z6ON6y0UkpTpck634qz8hcVVkU5g= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; spf=pass (imf19.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=1724913128; a=rsa-sha256; cv=none; b=abwpc3BQaE816lkwKU4M+Q13f1OlIqZMhbgJUaQ181s7iT3IlK0CKNgRG0riQ8NNivOHm9 8FLMWoCM4n80vKlSIDDHB4y6YFBmY/BNjd8AigvBj9k0XkoqHTt2WWkQ7+bDF2Lr/uAl3W SwgADDDF7PFWES7hkChzWntp6C6vkV0= Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4WvWYz39XFz20n5c; Thu, 29 Aug 2024 14:28:23 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id B2B73180019; Thu, 29 Aug 2024 14:33:13 +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, 29 Aug 2024 14:33:13 +0800 From: Hongbo Li To: , , , , , CC: , , Subject: [PATCH RESEND v3 2/2] hugetlbfs: use tracepoints in hugetlbfs functions. Date: Thu, 29 Aug 2024 14:41:10 +0800 Message-ID: <20240829064110.67884-3-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829064110.67884-1-lihongbo22@huawei.com> References: <20240829064110.67884-1-lihongbo22@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500022.china.huawei.com (7.185.36.66) X-Stat-Signature: 6urpmzjto43fw1g4q59tupgmnfbn6kzz X-Rspam-User: X-Rspamd-Queue-Id: 926281A0014 X-Rspamd-Server: rspam02 X-HE-Tag: 1724913197-649205 X-HE-Meta: U2FsdGVkX18v5I2ITsEQuVh7Jsba7lgmn0XJn/Jxld2NwBGw7bPH04Q/teX3QWO44Qz7SB2EmFfZyStRXuLN8582Oq6JbfXtHPr0JIzRD9NeMj8L+2HQ29/EAfFF98bTiiRhJtnR0QpXCL2klyjoG3STcUsdwttwXgUvrzS5VMMM8YbaZNOqE7eXVbeJ6P+U/e7fv9rq/inY2Tw6w4F030HKQXjmg5pmQXe6JPpygywZkjTeJM0RDAwCzGAdYkeE1V6kOxZvzO6UsrogF+o+eSYvv5umnd9R2WgF6So4cOP4HGenJclZFdhJ9hS57jo6biIOJ/i60UsgCwK3lVJ2aa5kUWS8wAdNpoi4lDe+FHvJDPG0ky4b9aCQKGy8ox4zAvGRaw6EZA+zJI9Z+uEdqKjXYU47M5I+LksVEWTo9c5sIc35v/tY5mQyF7OP4L0kfHy4fjhmGX3UUPd7DJHL+dATY538D3qHxsjnPPjV2kW5sDZR6lnoEt++sfGSwRlxBJVCcqIoRT8P2oBimgIIkGS/98n16M5NgHFEkdVNdbl6ZUpAXjmIV+F3Ez4//CtVWVjPWgH5pwCNgxjr/TNMsLj8NHBwZY5n0XcdevSp1mko0EvHTpSYoGhYDnxIgqHCkPsW/TEllFsZPju4laEBtzQne8cJevRkdGEGe/3sSsYiTG5EBLzvzDep6fy1Fg7m4hoFLWPnrP8aMay08yreyF1O03eXXhRRSEsB8V+MTWD4ck6fKjNxz4TgOwE5ktWwNsSWj0FzVfAYxQVF8b138ezvomavQIT4bkVvR0rphR8VWkjbPB9QNhkk8FNdjg9KEgIpWiofXRFSjc8kIbfv/gfzX0vI8HnLgW+dT3fOQpCUfIb3BKrOJvaQNTXuMgti+lUf9D0xXw8ranxCymLF0eSXY3VAo/UA5VSZz5inr1U0bpwgA/KnILQQ6HQtfGl1F9beEk8HQ2CW+BFG6y9 NaBGwJ1A mTDLFLyGwBqbybJcKugUmTOhmSmVWzp9R3ScIqxS3WvU2mb+zAAuATNtGt56zlX4/7P5N0cdayPDRb2S4Y3133jaQ2BukjFEs0UlBOiasB5Guuctfu5ONKk/Q4Cq/u7suPoOsz/sgdlxhWU2HAzKIwAXuAwUf9zH8WBByh/fCM0a3h4rB7aEzXCMnWg== 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)); }