Re: [RFC PATCH 04/11] mm/mempolicy: modify get_mempolicy call stack to take a task argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[restoring the CC list as I believe this was not meant to be a private
response]

On Tue 28-11-23 09:12:35, Gregory Price wrote:
> On Tue, Nov 28, 2023 at 03:07:28PM +0100, Michal Hocko wrote:
> > On Wed 22-11-23 16:11:53, Gregory Price wrote:
> > [...]
> > > @@ -928,7 +929,16 @@ static long do_get_mempolicy(int *policy, nodemask_t *nmask,
> > >  		 * vma/shared policy at addr is NULL.  We
> > >  		 * want to return MPOL_DEFAULT in this case.
> > >  		 */
> > > -		mm = current->mm;
> > > +		if (task == current) {
> > > +			/*
> > > +			 * original behavior allows a kernel task changing its
> > > +			 * own policy to avoid the condition in get_task_mm,
> > > +			 * so we'll directly access
> > > +			 */
> > > +			mm = task->mm;
> > > +			mmget(mm);
> > 
> > Do we actually have any kernel thread that would call this? Does it
> > actually make sense to support?
> > 
> 
> This was changed in the upcoming v2 by using the pidfd interface for
> referencing both the task and the mm, so this code is a bit dead.

OK, that is the right thing to do IMHO. Allowing modifications on memory
policies on borrowed mms sounds rather weird and if we do not have any
actual usecases that would require that support then I would rather not
open that possibility at all.

-- 
Michal Hocko
SUSE Labs




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux