[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070407184801.b6f3f549.akpm@linux-foundation.org>
Date:	Sat, 7 Apr 2007 18:48:01 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Christoph Lameter <clameter@....com>
Cc:	Hugh Dickins <hugh@...itas.com>, Nick Piggin <npiggin@...e.de>,
	dgc@....com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] Optimize compound_head() by avoiding a shared page
 flag
On Sat, 7 Apr 2007 18:32:04 -0700 (PDT) Christoph Lameter <clameter@....com> wrote:
> On Sat, 7 Apr 2007, Andrew Morton wrote:
> 
> > > I just tried the approach that we discussed earlier and it was not 
> > > nice either.
> > 
> > We've discussed at least three approaches, so we don't know to what you refer.
> 
> Thats the approach of checking two flags at the same time. In that case 
> the compiler will generate and "and-immediate" and then a 
> "compare-immediate" one branch but .... Yuck.
Right.
        movl    (%ebx), %eax    # <variable>.flags, tmp399
        andl    $48, %eax       #, tmp399
        cmpl    $48, %eax       #, tmp399
        je      .L265   #,
what's "yuck" about that?
With the single page flag:
	movl	(%ebx), %eax	#* page.521, D.21940
	testb	$32, %al	#, D.21940
	jne	.L265	#,
So you're talking about saving one sole single silly solitary instruction.
> > Because I don't expect there will be much efficiency difference between the
> > above and the use of another page flag.
> 
> Then we end up with all these small efficiency differences in all 
> the code paths. I'd rather go for optimal performance in a frequently used 
> construct like this.
You can save that worrisome single instruction in the common case by putting the
handling of the uncommon compound pages out of line, as I indicated.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists