mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Linux-2.5.16
Date: Tue, 21 May 2002 09:55:28 +1000 (EST)	[thread overview]
Message-ID: <15593.36080.660343.246677@argo.ozlabs.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0205200904461.23874-100000@home.transmeta.com>

Linus Torvalds writes:

> Hmm.. The PPC <asm/tlb.h> seems to be largely a simplified version of
> the asm-generic one, with no support for the UP optimization, for example.
> 
> And that UP optimization should be perfectly correct even on PPC, so you
> apparently lost something in the translation.

The UP optimization would be slower on "classic" PPCs because you end
up doing a flush_tlb_mm rather than flushing the ranges of addresses
where there are actually PTEs present.

By "classic" PPCs I mean those that use a hashed page table, as
distinct from the embedded PPCs that have software-loaded TLBs.
Certainly for the embedded PPCs the UP optimization is useful and
desirable.  More ifdefs... :(

Anyway, on classic PPCs, the cost of TLB flushes goes up with the
amount of address space being flushed, and flush_tlb_mm is essentially
a flush of the whole space from 0 to TASK_SIZE.  As an optimization,
I currently have flush_tlb_mm look at the list of vma's and flush the
address range for each vma.  That works because flush_tlb_mm currently
only gets called from dup_mmap() and the list of vma's is valid in
that case.  If we were calling flush_tlb_mm from tlb_flush_mmu, we
could not use that optimization (since all the vma's have been removed
from the mm->mmap list at that point) so we would have to flush the
entire 0 .. TASK_SIZE range.

There is a further optimization that we do that we would not be able
to use if flush_tlb_mm were called from tlb_flush_mmu.  We have a bit
in each PTE, the _PAGE_HASHPTE bit, that tells us if a hardware PTE
for that virtual address has been put into the hash table.  (This bit
is present even when the PTE is a swap entry, and set_pte et al. don't
modify this bit.)  Then, when we are flushing a range of addresses, we
look at the linux PTE for each page and only do the hash table search
if the bit is set.  However, by the time tlb_flush_mmu is called, the
page tables have been freed, so we would have to do the hash table
search for every page from 0 to TASK_SIZE.  (This is why I call
tlb_flush_mmu from tlb_end_vma rather than tlb_finish_mmu.)

Therefore I concluded that the UP optimization was actually a
pessimization for classic PPC.

The fact that flushes cost in proportion to the size of the range
being flushed is the reason behind the code that flushes and starts a
new range if address - tlb->end > 32 * PAGE_SIZE.  The 32 is a number
that could use some tuning; we get some advantage from batching up the
flushes but that advantage will be lost if we have to look through
large ranges of addresses where there were no valid PTEs.

> I'd actually rather try to share more of the code, if possible.

I'll see what I can do along those lines...

Paul.

  parent reply	other threads:[~2002-05-20 23:56 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-18  7:57 Linux-2.5.16 Linus Torvalds
2002-05-18  8:05 ` Linux-2.5.16 Aschwin Marsman - aYniK Software Solutions
2002-05-18  8:21 ` Linux-2.5.16 Russell King
2002-05-18  9:51   ` Linux-2.5.16 Tomas Szepe
2002-05-18 11:28     ` Linux-2.5.16 Marcus Alanen
2002-05-18 15:38       ` Linux-2.5.16 Matthias Andree
2002-05-18 15:44         ` Linux-2.5.16 Tomas Szepe
2002-05-18  8:52 ` Linux-2.5.16 mikeH
2002-05-18 18:33   ` Linux-2.5.16 Andrew Morton
2002-05-20  0:33 ` Linux-2.5.16 Roman Zippel
2002-05-20  0:39   ` Linux-2.5.16 Linus Torvalds
2002-05-20  0:47     ` Linux-2.5.16 Linus Torvalds
2002-05-20  1:09       ` Linux-2.5.16 Paul Mackerras
2002-05-20  1:25         ` Linux-2.5.16 Linus Torvalds
2002-05-20 12:43           ` Linux-2.5.16 Paul Mackerras
2002-05-20 16:13             ` Linux-2.5.16 Linus Torvalds
2002-05-20 23:30               ` Linux-2.5.16 David S. Miller
2002-05-20 23:37                 ` Linux-2.5.16 David S. Miller
2002-05-21  1:02                   ` [PATCH] TLB changes (was Re: Linux-2.5.16) David S. Miller
2002-05-20 23:55               ` Paul Mackerras [this message]
2002-05-21  0:18                 ` Linux-2.5.16 Paul Mackerras
2002-05-21  5:10             ` Linux-2.5.16 Linus Torvalds
2002-05-21  5:10               ` Linux-2.5.16 David S. Miller
2002-05-21 16:01                 ` Linux-2.5.16 Linus Torvalds
2002-05-21 16:45                   ` Linux-2.5.16 Linus Torvalds
2002-05-20  1:15       ` Linux-2.5.16 Roman Zippel
2002-05-20  1:20         ` Linux-2.5.16 Linus Torvalds
2002-05-20  4:30       ` Linux-2.5.16 David S. Miller
2002-05-20 22:20       ` Linux-2.5.16 Roman Zippel
2002-05-20 23:36         ` [PATCH] Fix rss accounting Roman Zippel
2002-05-20  1:10     ` Linux-2.5.16 Roman Zippel
2002-05-20 17:57       ` Linux-2.5.16 Linus Torvalds

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=15593.36080.660343.246677@argo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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®