public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Christoph Hellwig <hch@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: Linux v2.6.24-rc1, x86 arch code quality, unifications
Date: Wed, 24 Oct 2007 12:17:15 +0200	[thread overview]
Message-ID: <20071024101715.GB18882@elte.hu> (raw)
In-Reply-To: <20071024080451.GA32690@infradead.org>


* Christoph Hellwig <hch@infradead.org> wrote:

> On Tue, Oct 23, 2007 at 09:19:16PM -0700, Linus Torvalds wrote:
> > In short, we just had an unusually large amount of not just x86 merges, 
> 
> Btw, can we please finis up this merge a little more before we freeze 
> 2.6.24?  The way we currently have leftovers of arch/i386/ and 
> arch/x86_64/ is quite a nightmare and not how the other architectures 
> were merged.
> 
> Thomas, what again prevents us from just killing these leftovers?

to answer that question one should first be aware of the fundamental 
code quality problems that the unified x86 architecture has inherited 
from the split i386 and x86_64 architectures.

To get objective and automated metrics about code quality, i've 
constructed a table of "coding style errors per one thousand lines of 
source code" numbers with the help of the latest checkpatch.pl. The 
codebases i measured are the pre-merge i386 and x86_64 tree, the 
post-merge arch/x86 unified architecture, and i've also added a handful 
of other architectures and selected core subsystems, as comparison:

               -------------------------------------------------------
               |    errors  | lines of code  |    errors/KLOC
               |            |                |    (smaller is better)
 --------------|------------|----------------|------------------------
  arch/i386/          5717            73865         77.3
  arch/x86_64/        2993            31155         96.0
  arch/x86/           8504           114654         74.1
 ..............|............|................|........................
  arch/ia64/          1779            64022         27.7
  arch/mips/          2110            94692         22.2
  arch/sparc64/       1387            49253         28.1
 ..............|............|................|........................
  kernel/              762            83540          9.1
  kernel/time/          15             4191          3.5
  kernel/irq/            1             2317          0.4
  mm/                  464            46324         10.0
  net/core             176            24413          7.2
 ..............|............|................|........................

a couple of observations. Firstly, it is plainly obvious that the x86_64 
and i386 architectures were in a dreadful state of code quality before 
the unification. Their code quality was almost an order of magnitude 
worse than that of the core kernel (!) - and their code quality was 
significantly worse than that of a couple of other, comparable 
architectures. (we knew this when we started the x86 unification effort 
- but i suspect it's even more apparent via the hard numbers in this 
table.)

 ( Note: code metrics should be taken with a grain of salt, as they
   often over-simplify the picture, but in this particular situation the
   trends are clear and the numbers match my personal impressions of
   code quality and robustness of these codebases. )

paradoxically the x86_64 architecture that had a _worse_ code quality 
than the "legacy" 32-bit code - so much about the "newer code must be 
better" misconception. The first, mechanic round of unifications thus 
brought a net degradation in quality - but we've reversed that trend in 
2.6.24-rc1 already, via unifications and cleanups, as it can be seen 
from the table. (and we did that while adding new features like 
high-resolution timers and dynticks to the x86-64bit architecture in 
v2.6.24-rc1 - or the new IOMMU code. So the x86 architecture is not 
standing still at all while the unification is going on.)

so to answer your question: full unification is no easy task and it is 
not automatic at all. The x86_64 tree has diverged from the i386 tree in 
the past 5 years due to their illogical, forced separation and a 
resulting bitrot. The two architectures have grown different sets of 
cleanliness problems and different sets of functions with arbitrary 
differences that often cover the same functionality. It's all compounded 
by the fact that the 64-bit code is in worse shape than the 32-bit - so 
it's not like we could just pick the 64-bit code and use that as the 
unified code. The 32-bit code is also used about 8-10 times more 
frequently than the 64-bit code. So there is no easy "just unify it" 
path.

The new maintainers of the x86 architecture (Thomas, Peter and me), and 
many other x86 developers are highly motivated to improve the x86 
architecture's code quality and unify the heck out of it, and there are 
some real improvements in 2.6.24-rc1 already, but we _must_ be (and are) 
working on this carefully. So we do unifications on a case by case 
basis, with the highest priority being to not introduce "unification 
regressions". The x86 architecture is the most common Linux architecture 
after all - and users care much more about having a working kernel than 
they care about cleanups and unifications. So yes, we agree with you, 
but please be patient! :-) This cannot be realistically finished in 
v2.6.24, without upsetting the codebase.

	Ingo

  reply	other threads:[~2007-10-24 10:17 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-24  4:19 Linux v2.6.24-rc1 Linus Torvalds
2007-10-24  4:49 ` Willy Tarreau
2007-10-24  5:22 ` Dave Young
2007-10-24  7:23   ` Ingo Molnar
2007-10-24  7:32     ` Ohad Ben-Cohen
2007-10-24  7:33     ` Dave Young
2007-10-24  8:12     ` Jens Axboe
2007-10-24  7:44 ` kvm_main.c:220: error: implicit declaration of function 'smp_call_function_mask' Paolo Ornati
2007-10-24  7:56   ` Jeff Garzik
2007-10-24  8:04 ` Linux v2.6.24-rc1 Ingo Molnar
2007-10-24  8:04 ` Christoph Hellwig
2007-10-24 10:17   ` Ingo Molnar [this message]
2007-10-24 11:07   ` Sam Ravnborg
2007-10-24 12:12     ` Ingo Molnar
2007-10-24 12:21       ` Sam Ravnborg
2007-10-24 21:30       ` [RFC - GIT pull] first step to get rid of x86_64 and i386 dirs Sam Ravnborg
2007-10-24 22:50         ` Randy Dunlap
2007-10-25  6:14           ` Yinghai Lu
2007-10-25 10:56             ` Sam Ravnborg
2007-10-25 15:45               ` Randy Dunlap
2007-10-25 10:18         ` Ingo Molnar
2007-10-25 10:55           ` Sam Ravnborg
2007-10-24  8:10 ` [Git Patch] arch/um/drivers/ubd_kern.c: fix a building error WANG Cong
2007-10-24 11:03   ` Jens Axboe
2007-10-24 11:30 ` [git pull] x86 arch updates Ingo Molnar
2007-10-24 11:48   ` Jeff Garzik
2007-10-24 12:03     ` Ingo Molnar
2007-10-24 13:25 ` 2.6.24-rc1 fails with lockup and BUG: Romano Giannetti
2007-10-24 14:27   ` Ingo Molnar
2007-10-24 15:53     ` Romano Giannetti
2007-10-24 15:55       ` Ingo Molnar
2007-10-24 16:11         ` Peter Zijlstra
2007-10-26  5:57           ` Romano Giannetti
2007-10-26  6:37             ` 2.6.24-rc1 fails with lockup - /sbin/ifconfig / inet_ioctl() / dev_close() / rtl8169_down() Ingo Molnar
2007-10-26 16:48               ` Stephen Hemminger
2007-10-26 17:56                 ` Ingo Molnar
2007-10-26 18:33                   ` [PATCH] r8169: don't call napi_disable if not doing NAPI Stephen Hemminger
2007-10-26 20:17                     ` Francois Romieu
2007-10-28 22:18                     ` Romano Giannetti
2007-10-29  8:56                     ` Romano Giannetti
2007-10-24 16:44   ` 2.6.24-rc1 fails with lockup and BUG: Joseph Fannin
2007-10-26  5:59     ` Romano Giannetti
2007-10-24 18:19 ` Linux v2.6.24-rc1 Giacomo Catenazzi
2007-12-04 10:08   ` [Bug 9246] On 2.6.24-rc1-gc9927c2b BUG: unable to handle kernel paging request at virtual address 3d15b925 Ingo Molnar
2007-12-04 16:47     ` Giacomo A. Catenazzi
2007-12-04 20:08       ` Rafael J. Wysocki
2007-12-05  9:26         ` Giacomo A. Catenazzi
2007-10-24 19:44 ` [patch] portman2x4.c: fix boot hang Ingo Molnar
2007-10-24 20:12   ` Frans Pop
2007-10-24 21:29     ` Ingo Molnar
2007-10-25  8:16   ` Takashi Iwai
2007-10-25  5:18 ` 2.6.24-rc1 doesn't build Theodore Tso
2007-10-25  5:30   ` Kamalesh Babulal
2007-10-25 12:45 ` Linux v2.6.24-rc1 edz_mania
2007-10-26  5:19 ` [PATCH] Dump filtering supports x86_64 sparsemem(Re: Linux v2.6.24-rc1) Ken'ichi Ohmichi

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=20071024101715.GB18882@elte.hu \
    --to=mingo@elte.hu \
    --cc=hch@infradead.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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