Re: [PATCH 4/5] cpuset memory spread slab cache optimizations

From: Andrew Morton
Date: Sat Feb 04 2006 - 18:50:08 EST


Paul Jackson <pj@xxxxxxx> wrote:
>
> +void mpol_set_task_struct_flag(struct task_struct *p)
> +{
> + if (p->mempolicy)
> + p->flags |= PF_MEMPOLICY;
> + else
> + p->flags &= ~PF_MEMPOLICY;
> +}

As mentioned before, if we ever modify tsk->flags, where tsk != current, we
have a nasty race. So this function's interface really does invite that
race and hence is not very good.

As we do seem to be only calling it for current or for a newly-created task
I guess the access is OK, so perhaps a weaselly comment would cover that
worry.

-
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/