linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Phillips <phillips@arcor.de>
To: Matti Aarnio <matti.aarnio@zmailer.org>
Cc: Linux Memory Management <linux-mm@kvack.org>
Subject: Re: [PATCH] Optimize away pte_chains for single mappings
Date: Mon, 15 Jul 2002 19:50:59 +0200	[thread overview]
Message-ID: <E17U9zw-0003dQ-00@starship> (raw)
In-Reply-To: <20020715195527.X28720@mea-ext.zmailer.org>

On Monday 15 July 2002 18:55, Matti Aarnio wrote:
> On Mon, Jul 15, 2002 at 06:30:43PM +0200, Daniel Phillips wrote:
> > On Monday 15 July 2002 17:40, Matti Aarnio wrote:
> > > In register-lacking i386 this  masking is definite punishment..
> > 
> > Nonsense, the value needs to be loaded into a register anyway
> > before being used.
> 
>   Think in assembly, what is needed in i386 to mask the pointer ?

	and <reg>, -2

(apologies for thinking in Intel assembly, old habits die hard)

>   How the pointer is then used ?

Like any pointer.

>   How many register you need ?

One.

>   What registers can be used for masking arithmetics, and which
>   are usable in indexed memory reference address calculation ?

No extra register for masking arithmetic.

>   Linus seems to care about this kind of speed things, and
>   at least DaveM does look into gcc generated assembly to
>   verify, that used C idioms are compiled correctly and fast.

Yes, I guess I will generate the assembly code and have a look.
There is a lot more than just instructions/cycle counts to worry
about in code optimization.  Other big considerations are cache
line hits, address generation interlocks and suitability of the
code for multiple execution units.

Getting down to nano-efficiency here, masking the address before
using it will generate a one cycle stall in one of the execution
pipes on classic pentium.  That doesn't matter here - supposing
we use the low bit to indicate the non-direct case: the very
next thing we want to do after masking off the low bit is test
to see if the result is zero.  Hey, our masking operation just
set the condition codes, isn't that nice.  And the following jmp
instruction nicely fills the AGI slot.

Now I'm going to suggest an optimization that *is* really ugly:
note that in the current patch, the list always terminates with
null.  But suppose instead it terminates with a pointer to a pte, 
with the low bit set.  We save 8 bytes per pte chain, and that is 
not to be taken lightly.

-- 
Daniel
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/

      reply	other threads:[~2002-07-15 17:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-09 18:35 Dave McCracken
2002-07-13 13:13 ` Daniel Phillips
2002-07-15 14:02   ` Dave McCracken
2002-07-15 14:56     ` Daniel Phillips
2002-07-15 15:40       ` Matti Aarnio
2002-07-15 16:10         ` Daniel Phillips
2002-07-15 16:34           ` Rik van Riel
2002-07-15 16:42             ` Daniel Phillips
2002-07-15 20:57               ` Andrew Morton
2002-07-16  4:50                 ` Daniel Phillips
2002-07-15 16:30         ` Daniel Phillips
2002-07-15 16:55           ` Matti Aarnio
2002-07-15 17:50             ` Daniel Phillips [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=E17U9zw-0003dQ-00@starship \
    --to=phillips@arcor.de \
    --cc=linux-mm@kvack.org \
    --cc=matti.aarnio@zmailer.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