Re: [PATCH] mm: pagefault_{disable,enable}()

From: Linus Torvalds
Date: Wed Jan 10 2007 - 17:44:29 EST




On Wed, 10 Jan 2007, Geert Uytterhoeven wrote:
>
> > The REAL problem seems to be that the m68k preempt.h (or rather, to be
> > exact, asm/thread_info.h) doesn't do things right, and while it exposes
> > "inc_preempt_count()", it doesn't expose enough information to actually
> > use it.
> >
> > I think your "current_thread_info()" is broken.
>
> But struct task_struct is defined in <linux/sched.h>, which cannot be included
> in <asm/thread_info.h> due to include recursion hell.

But why do you need "struct task_struct" at all?

The reason this doesn't happen on other platforms is that they don't use
"struct task_struct". They use "struct thread_info", which is where the
preemption counter is.

The problem on m68k i sthat broken indirection through "current", which is
unnecessary. Isn't the thread structure on the stack on m68k too? So you
could do what x86 does, and just do

movel %a7,%d0
andl $STACK_MASK,%d0

or something, and thus go directly to the thread-info rather than load it
off the task pointer.

Or, if worst comes to worst, you can just hardcode the offset of the
thread-info pointer in the "struct task_struct". It's the second word
after "state". Ugly, but less so than forcing everybody who does NOT want
to have that big <linux/sched.h> dependency to get it.

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