[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070512000507.GA519@tv-sign.ru>
Date: Sat, 12 May 2007 04:05:07 +0400
From: Oleg Nesterov <oleg@...sign.ru>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: "Rafael J. Wysocki" <rjw@...k.pl>,
Andrew Morton <akpm@...ux-foundation.org>,
Gautham R Shenoy <ego@...ibm.com>,
LKML <linux-kernel@...r.kernel.org>, Pavel Machek <pavel@....cz>,
"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: Re: [PATCH 1/7] Freezer: Read PF_BORROWED_MM in a nonracy way
I hope Rafael will correct me if I am wrong,
On 05/12, Oleg Nesterov wrote:
>
> On 05/11, Linus Torvalds wrote:
> >
> > On Sat, 12 May 2007, Oleg Nesterov wrote:
> > >
> > > without task_lock() we can see "p->mm != NULL" but not PF_BORROWED_MM.
> >
> > Let me explain it one more time:
> > - shouldn't the *caller* protect this?
> >
> > Afaik, there's two situations:
> > - either things don't change (in which case you don't need locking at
> > all, since things are statically one way or the other)
> > - or things change (in which case the caller can't rely on the return
> > value anyway, since they might change *after* you release the lock)
>
> things change, ->mm is not stable if the kernel thread does use_mm/unuse_mm.
>
> However, the return value == 0 does not change in that particular case,
> exactly because is_user_space() takes task_lock().
Probably there is some misunderstanding. This patch doesn't claim it solves
all problems. Before this patch we have
static inline int is_user_space(struct task_struct *p)
{
return p->mm && !(p->flags & PF_BORROWED_MM);
}
and this is clearly racy wrt to use_mm() which sets this PF_BORROWED_MM bit.
So this is just a little improvement, nothing more.
Oleg.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists