mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Balbir Singh <balbirs@nvidia.com>
To: Bradley Morgan <brads@mainlining.org>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] taskstats: take the inode once in exe_add_tsk()
Date: Mon, 2 Nov 2026 13:57:21 +1100	[thread overview]
Message-ID: <eea1690b-ddf9-4424-b312-3446092aec18@nvidia.com> (raw)
In-Reply-To: <20261101005743.3022780-2-brads@mainlining.org>

On 11/1/26 11:57 AM, Bradley Morgan wrote:
> exe_add_tsk() walks exe_file->f_inode twice, once for the superblock
> device and once for the inode number.  file_inode() is the accessor for
> that field, and hoisting the inode out of the two assignments also gets
> stats->ac_exe_dev onto one line instead of a split continuation.
> 
> Signed-off-by: Bradley Morgan <brads@mainlining.org>
> ---
>  kernel/taskstats.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/taskstats.c b/kernel/taskstats.c
> index 37422c43b8caa..35e9fa71526cc 100644
> --- a/kernel/taskstats.c
> +++ b/kernel/taskstats.c
> @@ -159,10 +159,11 @@ static void exe_add_tsk(struct taskstats *stats, struct task_struct *tsk)
>  	struct file *exe_file = get_task_exe_file(tsk);
>  
>  	if (exe_file) {
> +		struct inode *inode = file_inode(exe_file);
> +
>  		/* Following cp_new_stat64() in stat.c . */
> -		stats->ac_exe_dev =
> -			huge_encode_dev(exe_file->f_inode->i_sb->s_dev);
> -		stats->ac_exe_inode = exe_file->f_inode->i_ino;
> +		stats->ac_exe_dev = huge_encode_dev(inode->i_sb->s_dev);
> +		stats->ac_exe_inode = inode->i_ino;
>  		fput(exe_file);
>  	} else {
>  		stats->ac_exe_dev = 0;

Thanks!

Reviewed-by: Balbir Singh <balbirs@nvidia.com>

  reply	other threads:[~2026-11-02  2:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-01  0:56 [PATCH 0/4] taskstats: four more tidy-ups in the genl path Bradley Morgan
2026-11-01  0:57 ` [PATCH 1/4] taskstats: use nla_put_u32() in mk_reply() Bradley Morgan
2026-11-01  0:57   ` [PATCH 2/4] taskstats: take the inode once in exe_add_tsk() Bradley Morgan
2026-11-02  2:57     ` Balbir Singh [this message]
2026-11-01  0:57   ` [PATCH 3/4] taskstats: reuse na in cgroupstats_user_cmd() Bradley Morgan
2026-11-02  2:54     ` Balbir Singh
2026-11-01  0:57   ` [PATCH 4/4] taskstats: use div_u64() for the elapsed time in tgid_stats_add_task() Bradley Morgan
2026-11-02  2:52     ` Balbir Singh
2026-11-02  2:59   ` [PATCH 1/4] taskstats: use nla_put_u32() in mk_reply() Balbir Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eea1690b-ddf9-4424-b312-3446092aec18@nvidia.com \
    --to=balbirs@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=brads@mainlining.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®