Re: [RFC][PATCH 2/2] kernel: extract thread types fromtask_struct::flags

From: Andrew Morton
Date: Mon Sep 20 2010 - 15:16:20 EST


On Mon, 20 Sep 2010 17:13:36 +0200
Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> wrote:

> Free up a few more PF_flags by moving thread types out to their own variable.
>
> Initially I compressed the types into less bits inside task_struct::flags, but
> Thomas suggested I move them to their own field.
>

There doesn't seem to be a huge point to all this, but I guess there's
some sense in separating "what type of thread this is" from "attributes
of this thread". Maybe. At the expense of a larger task_struct.

> +/*
> + * Types >= tt_kernel imply the old PF_KTHREAD
> + */

Perhaps that should be encapsulated into another helper function

> --- linux-2.6.orig/kernel/fork.c
> +++ linux-2.6/kernel/fork.c
> @@ -570,7 +570,7 @@ struct mm_struct *get_task_mm(struct tas
> task_lock(task);
> mm = task->mm;
> if (mm) {
> - if (task->flags & PF_KTHREAD)
> + if (task_type(task) >= tt_kernel)

rather than open-coded everywhere.


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