Re: [PATCH 1/4] mm/mempolicy: kernel_migrate_pages: simplify the usage of put_task_struct()

From: Oleg Nesterov

Date: Mon May 25 2026 - 04:33:10 EST


On 05/24, Gregory Price wrote:
>
> On Sun, May 24, 2026 at 06:57:59PM +0200, Oleg Nesterov wrote:
> >
> > mm = get_task_mm(task);
> > - put_task_struct(task);
> > -
>
> Hm, I was a little trigger-happy on that review, I just realized that
> this increases the scope in which there is a task reference held (i.e.
> we're now holding a reference across do_migrate_pages())
>
> I don't *think* that's an issue, but it might we worth looking at the
> changelog to see if this was done intentionally.

I did this to simplify the code and the next changes. We pin this task's
memory across do_migrate_pages(), so I think that delaying put_task_struct()
doesn't add too much.

But of course, this is not necessary, I can rework if you don't like it.

Thanks for review!

Oleg.