mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@kernel.org>,
	Sam Ravnborg <sam@ravnborg.org>,
	Jaswinder Singh Rajput <jaswinder@kernel.org>,
	x86 maintainers <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [git-pull -tip] x86: include inverse Xmas tree patches
Date: Sun, 29 Mar 2009 14:25:48 +0400	[thread overview]
Message-ID: <20090329102548.GA3014@x200.localdomain> (raw)
In-Reply-To: <20090329000026.GA27015@elte.hu>

On Sun, Mar 29, 2009 at 01:00:26AM +0100, Ingo Molnar wrote:
> 
> * Thomas Gleixner <tglx@linutronix.de> wrote:
> 
> > On Sun, 29 Mar 2009, Ingo Molnar wrote:
> > > * Thomas Gleixner <tglx@linutronix.de> wrote:
> > > 
> > > > > Personally I'd prefer alphabetic order, sorting based on length 
> > > > > isn't a complete ordering.  Nearly all editors can sort 
> > > > > alphabetically at the push of a key.
> > > > 
> > > > I'd prefer if somebody would sit down and write a tool to analyse 
> > > > the include hell instead of manually shuffling crap around to 
> > > > avoid trivial merge conflicts. I have cleaned up enough stuff in 
> > > > the x86 merger myself where I was able to cut the number of 
> > > > includes at least in half just by staring at the gcc intermediate 
> > > > files. We could do better and automate the analysis so we get down 
> > > > to a handful of includes instead of including the world and more.
> > > 
> > > I do not disagree with include file cleanups (we've done many of 
> > > them in this cycle and in previous cycles), but note that the 
> > > reduction in include files at the top of .c files actually increases 
> > > the chance of patch conflicts: when a new include file is added by 
> > > two patches to the same .c file.
> > 
> > Those conflicts are trivial and if we have a mechanism to anlyse 
> > include dependencies then we can avoid such conflicts often at 
> > all.
> 
> Yeah, i agree that least 50% of the existing #include's are not 
> needed.
> 
> That's not the point though. When two new files both append to the
> #include file section, they'll clash. Those _new_ includes tend to 
> be justified - people dont add #includes needlessly - it's years 
> long bitrot that causes #includes to bloat up slowly.
> 
> > Go through some of the include madness and watch the compiler 
> > reading the same header file ten times for a single source file 
> > compile.

Care to read strace(1) output? Include file is not even opened second
time.

[reads strace(1) output himself]

Correction!

Except, e. g., <asm/atomic.h> because i386/x86_64 unification dropped
ifndef guards in the right place and added them in the wrong one.

> Yes, we need both efforts. That section needs to look professional 
> (unordered lines look amateurishly random, arbitrary and confusing), 
> and it needs to be minimalized as well.

These are #include directives, how else should they look like.
As for confusing, as if you're looking for the first time at C code.

> And the xmas-tree helps the minimizing effort - as it trivially 
> eliminates duplicate #includes (which do happen frequently as well), 

yes, 5-10-20 for the whole tree per release and people periodically
removing them regardless of -tip, Xmas and so on.

> and they eliminate related includes as well because they get moved 
> together and get noticed.

I'll answer on this later.

> Most importantly, such code needs to look like as if someone 
> actually cared about it.

Reminder, this is include directives, not real code.

> If code looks tidy, people assume that it's 
> supposed to be perfect, and will notice and fix more subtle 
> imperfections in it. If code looks totally messy on the other hand, 
> _nobody_ will care because it's visibly broken. So these changes are 
> a small step forward.

People probably forgot the real problem with includes and start
inventing new non-problems with all the consequences.



So here is my countersuggestion for small and useful improvements:

1. Plug ifndef guargs back on x86.
   Check with strace(1) for past behaviour re non-opened includes.
   Remove current ifdef guards (need much more thinking for consequences)

2. Do #1 for other arches which exercised similar transformation
   (sparc/sparc64?)

3. For headers with small and let's say bounded area like <asm/unistd.h>,
   go check for every file including them and remove it if header genuinely
   unneeded.

  In case of <asm/unistd.h> this would check for copy_from_user/copy_to_user,
  put_user/get_user, clear_user and not much more.

This will reduce compile time _and_ size of DEBUG_INFO=y kernels.

  parent reply	other threads:[~2009-03-29 10:18 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-28 14:48 Jaswinder Singh Rajput
2009-03-28 15:07 ` Joerg Roedel
2009-03-28 16:48   ` Jaswinder Singh Rajput
2009-03-28 17:16     ` Jaswinder Singh Rajput
2009-03-28 15:07 ` Alexey Dobriyan
2009-03-28 15:55   ` Alan Cox
2009-03-28 15:58     ` Alexey Dobriyan
2009-03-28 16:11       ` Jaswinder Singh Rajput
2009-03-28 16:28       ` Alan Cox
2009-03-28 19:03   ` Sam Ravnborg
2009-03-28 22:25     ` H. Peter Anvin
2009-03-28 22:37       ` Al Viro
2009-03-28 23:31       ` Thomas Gleixner
2009-03-28 23:34         ` Ingo Molnar
2009-03-28 23:39           ` Thomas Gleixner
2009-03-29  0:00             ` Ingo Molnar
2009-03-29  0:24               ` Al Viro
2009-03-29 10:25               ` Alexey Dobriyan [this message]
2009-03-29  0:28             ` Thomas Gleixner
2009-03-29  1:58               ` Ingo Molnar
2009-03-29  7:57       ` Jaswinder Singh Rajput
2009-03-28 15:17 ` Hugh Dickins
2009-03-28 23:40   ` Ingo Molnar
2009-03-29  6:38     ` Jaswinder Singh Rajput
2009-03-29 11:46       ` Thomas Gleixner
2009-03-29 14:38         ` Jaswinder Singh Rajput
2009-03-28 23:35 ` Ingo Molnar
2009-03-29  5:54   ` Jaswinder Singh Rajput

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=20090329102548.GA3014@x200.localdomain \
    --to=adobriyan@gmail.com \
    --cc=hpa@kernel.org \
    --cc=jaswinder@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sam@ravnborg.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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®