Re: [PATCH 3/4] kthreads: rework kthread_stop()

From: Rusty Russell
Date: Wed Feb 04 2009 - 20:04:33 EST


On Thursday 05 February 2009 02:29:35 Eric W. Biederman wrote:
> Rusty Russell <rusty@xxxxxxxxxxxxxxx> writes:
> > Clever? Sure. Neat? Yes.
> >
> > But you are using a definition of obvious with which I was not previously
> > familiar :)
...
> Now Rusty I don't know about you but after I learned to do
> addition and subtraction it has always been obvious to me that
> one is the opposite of the other.

It is *not* obvious that the offset must be constant across all kthreads. On
all architectures, and always will be. That noone will *ever* put a
variable-size object on the stack in this code path.

I *think* it's true, but I've been surprised before.

> I am slightly concerned that using task_stack_page(tsk) may be
> overly clever, but compared to ACCESS_ONCE(), memory barriers,
> or not letting kthread_stop be called on a thread that may exit
> I think I am ahead of the game.

Absolutely agreed. Just humor me please and put a BUG_ON in there :)

Thanks,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/