mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roman Zippel <zippel@linux-m68k.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Andrew Morton <akpm@osdl.org>, Al Viro <viro@zeniv.linux.org.uk>,
	Linux Kernel Development <linux-kernel@vger.kernel.org>,
	Linux/m68k <linux-m68k@vger.kernel.org>
Subject: Re: [PATCH] mm: pagefault_{disable,enable}()
Date: Mon, 15 Jan 2007 13:09:03 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.64.0701111918480.787@scrub.home> (raw)
In-Reply-To: <Pine.LNX.4.64.0701101436370.3594@woody.osdl.org>

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

      reply	other threads:[~2007-01-15 12:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200612071659.kB7GxGHa030259@hera.kernel.org>
2007-01-10 22:00 ` Geert Uytterhoeven
2007-01-10 22:16   ` Linus Torvalds
2007-01-10 22:28     ` Geert Uytterhoeven
2007-01-10 22:43       ` Linus Torvalds
2007-01-15 12:09         ` Roman Zippel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0701111918480.787@scrub.home \
    --to=zippel@linux-m68k.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@osdl.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®