Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp5599233rwe; Tue, 18 Apr 2023 08:53:24 -0700 (PDT) X-Google-Smtp-Source: AKy350Y6EQddCZ+8GCSuIh/gxCccljblh+kvtdGKg890FNga8sQtvFfRIzd8dXIhGHC780UP0IUp X-Received: by 2002:a05:6a21:1186:b0:ec:9437:84c5 with SMTP id oj6-20020a056a21118600b000ec943784c5mr162770pzb.37.1681833204227; Tue, 18 Apr 2023 08:53:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681833204; cv=none; d=google.com; s=arc-20160816; b=WMgXtEXo+WXbktTWiiy8N3Au1wuGqpEIIk5DGWhEYk7HRWQFB5rlLuixzmlH1DWHpw VXo36Ha52gPAiau60ircneHvfh6onMoV0yslWhy1t/bBP7RySa35aYOpKZsfH0cUysmR hDKd6DexCcPZRPliKJgeLUw7lVVEESGB1Vg/QPgPaTdf7+2BJMpMTO/nalcPCAAz20pp g0WLiNYxz3lkL/dV51oZ7TsDIIYajPvd8gPyow/JKb0upk6q9zjAZncaqYZSFjZpDqe5 lbqiw1RmDXzUurBCUcNQHIjrlFFu4lle8xbLjX9KKMvmD++Yiiap/Rqu9dMQ1HCK+b0h qh/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:content-language:references:cc:to:user-agent:mime-version:date :message-id:dkim-signature; bh=SWIIHK88UX74y/rLDAQZ/bqtN388K70bDoKvMBQpPFM=; b=rZt+FJsW3+ie08m198pjaUDg9zzaZEE23ik1gOd1Q6V/cRJQ6mBRu+RaKAHHmXbDhd H86ueDXCNujRHuAZlm+gYkERkKXcpfzcFBpOqHuF6FtOYGtf05rvydvyqhYSEeDt8MCF dAwY0SF37vSWP4RuKUotoeI5yVS5ejS5zPhZPESuDpOTFmEGxh2eQQASUYKZCESiCHRo T/c+er4PjIV14+txqGbhK/BbsH7g8Vjcgd+suxIhad6r/QTw0zVbFhk1LmBKvrnFJF5b be5aTd77j/u6ROo7fYH80ej9Ak3xqSYzb0B++Pk9qvz3d02QLDjRAIM5pjiK6NaiHayN e8cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="P/izFCk/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l70-20020a638849000000b0051b5e96024asi12474108pgd.591.2023.04.18.08.53.09; Tue, 18 Apr 2023 08:53:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="P/izFCk/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232405AbjDRPwA (ORCPT + 99 others); Tue, 18 Apr 2023 11:52:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232463AbjDRPvu (ORCPT ); Tue, 18 Apr 2023 11:51:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 644D2146C6 for ; Tue, 18 Apr 2023 08:51:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 08F3960A73 for ; Tue, 18 Apr 2023 15:51:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 838DAC433EF; Tue, 18 Apr 2023 15:51:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681833066; bh=Ra9LOOWN9eSP/4y8aM9TfE/7Ag8xiVkMl5Q5mzBrecQ=; h=Date:To:Cc:References:From:Subject:In-Reply-To:From; b=P/izFCk/AKRvCxZjg8Shl0wwFYA0f007+xbf2DYwzCo9+kWejl6kYM0QB29UTfu06 csRkkw0kQOtEjjtFkSPMlX6J8JzFfVSdlm+jXKoprEpRG9dSQ4Xlk6ltnS99i/DEPH NeiaJspeorMmvCD0CTThN0AM6atv0Fq5GS5daWOgE9Lt6RRJRwf/qIxvLM8Bc6uXBp pSgGsLsAf1aKAVXV0s5C0v3ARJyXmbAojXt6zgi7fzJVfP3UOVq0gO1gkXW10favaP mqfhPPS3+EHh87jQZ+eppKEasxaaxaFEJSbb6ZyLBttf1w3T8TNDQXMmdvIT4GWPTl rMr94pU2wEXbg== Message-ID: Date: Tue, 18 Apr 2023 23:51:02 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 To: Wu Bo , Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, wubo.oduw@gmail.com References: <20230414104308.6591-1-bo.wu@vivo.com> Content-Language: en-US From: Chao Yu Subject: Re: [PATCH 1/1] f2fs: allocate trace path buffer from names_cache In-Reply-To: <20230414104308.6591-1-bo.wu@vivo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/4/14 18:43, Wu Bo wrote: > It would be better to use the dedicated slab to store path. > > Signed-off-by: Wu Bo > --- > fs/f2fs/file.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > index 15dabeac4690..27137873958f 100644 > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -4361,7 +4361,7 @@ static void f2fs_trace_rw_file_path(struct kiocb *iocb, size_t count, int rw) > struct inode *inode = file_inode(iocb->ki_filp); > char *buf, *path; > > - buf = f2fs_kmalloc(F2FS_I_SB(inode), PATH_MAX, GFP_KERNEL); > + buf = __getname(); How about: buf = f2fs_kmem_cache_alloc(names_cachep, GFP_KERNEL, NULL, F2FS_I_SB(inode)); > if (!buf) > return; > path = dentry_path_raw(file_dentry(iocb->ki_filp), buf, PATH_MAX); > @@ -4374,7 +4374,7 @@ static void f2fs_trace_rw_file_path(struct kiocb *iocb, size_t count, int rw) > trace_f2fs_dataread_start(inode, iocb->ki_pos, count, > current->pid, path, current->comm); > free_buf: > - kfree(buf); > + __putname(buf); kmem_cache_free(names_cachep, buf); Thanks, > } > > static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)