public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Mateusz Guzik <mjguzik@gmail.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] get_task_exe_file: check PF_KTHREAD locklessly
Date: Tue, 19 Nov 2024 16:05:51 +0100	[thread overview]
Message-ID: <20241119150550.GB2240@redhat.com> (raw)
In-Reply-To: <20241119143526.704986-1-mjguzik@gmail.com>

On 11/19, Mateusz Guzik wrote:
>
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -1500,12 +1500,13 @@ struct file *get_task_exe_file(struct task_struct *task)
>  	struct file *exe_file = NULL;
>  	struct mm_struct *mm;
>  
> +	if (task->flags & PF_KTHREAD)
> +		return NULL;
> +
>  	task_lock(task);
>  	mm = task->mm;
> -	if (mm) {
> -		if (!(task->flags & PF_KTHREAD))
> -			exe_file = get_mm_exe_file(mm);
> -	}
> +	if (mm)
> +		exe_file = get_mm_exe_file(mm);
>  	task_unlock(task);
>  	return exe_file;

Acked-by: Oleg Nesterov <oleg@redhat.com>


  reply	other threads:[~2024-11-19 15:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19 14:35 [PATCH] get_task_exe_file: check PF_KTHREAD locklessly Mateusz Guzik
2024-11-19 15:05 ` Oleg Nesterov [this message]
2024-11-22  6:35 ` Andrew Morton

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=20241119150550.GB2240@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjguzik@gmail.com \
    /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