lkml.org 
[lkml]   [2007]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm: pagefault_{disable,enable}()
Hi,

On Wed, 10 Jan 2007, Linus Torvalds wrote:

> > > I think your "current_thread_info()" is broken.

No, it's not. What is broken are our header dependencies - we happily mix
declarations with implementations.
Let's take a simple example like <linux/list.h>, which is practically
included everywhere, but even that already includes 57 other files and
depends on 49 config symbols (by comparison for <linux/types.h> it's 7
other files and 7 symbols).

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

That's exactly want I want to avoid, thread info and task struct can be
accessed via a single register (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.

That still generates worse code, the best solution would be to leave the
work to gcc, but that requires it can actually recognize that task struct
and thread info need only a single pointer.
One possibility would be to do something like ia64 and abuse
asm-offsets.h, but then one gets other funny build problems.

By far the cleanest solution would be to clean up our damned header
dependencies, separating task_struct from sched.h is not that difficult
and would give archs far more flexibility how to place task struct and
thread info.

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

\
 
 \ /
  Last update: 2007-01-15 13:39    [W:0.034 / U:1.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site