linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Roman Zippel <zippel@linux-m68k.org>
To: William Lee Irwin III <wli@holomorphy.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Rik van Riel <riel@conectiva.com.br>,
	Samuel Ortiz <sortiz@dbear.engr.sgi.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH] rmap 13a
Date: Thu, 09 May 2002 23:45:04 +0200	[thread overview]
Message-ID: <3CDAEDE0.E12583FB@linux-m68k.org> (raw)
In-Reply-To: <20020509174221.GQ15756@holomorphy.com>

Hi,

William Lee Irwin III wrote:

> MEM_START would be the lowest physical address, not the lowest virtual.
> __va(PAGE_OFFSET + ((page - mem_map) << PAGE_SHIFT)) would yield
> garbage... Perhaps __pa(PAGE_OFFSET) would work while relaxing only the
> "memory starts at 0" precondition? It should come out to 0 for the
> architectures with memory starting at 0, and the other preconditions
> guarantee that it's the lowest physical, but that breaks if the lowest
> physical isn't mapped to PAGE_OFFSET...

Sigh...
Why do you insist on calculating with the physical address? PAGE_OFFSET
is already a virtual address and without CONFIG_DISCONTIGMEM the page at
PAGE_OFFSET always corresponds to memmap[0] (on every arch).

> > And it's not needed, why should the vm care about the physical memory
> > location?
> 
> VM is about translating virtual to physical, and so it must know
> something resembling the physical address of a page just to edit PTE's?

The vm doesn't manage the memory based on the physical address, so all
it needs are functions to convert to/from a physical address, it doesn't
care about the value itself.

I scratch the rest of mail and try describe the more general problem.
We have three possibilities to address a memory page: virtual address,
physical address and pgdat+index. In the simplest case we can map all
them linear for continuos memory configuration. Otherwise the mapping
between physical address and pgdat+index will always involve some lookup
mechanism. It's desirable to have at least one linear mapping, so the
virtual mapping should be aligned either to the physical address space
or the pgdat array(s). m68k does the latter, everyone else the first.
Now the archs or your general code has to provide mappings between every
address space, so we have now:
- virt_to_phys()/phys_to_virt()
- pfn_to_page()/page_to_pfn()
- virt_to_page()/page_to_virt^Wpage_addr()
Please take a look at asm-ppc/page.h:__va()/__pa(). Here you have an
example that even for linear mappings, we use some tricks to optimize
this. How do you want to generalize this? So every arch specifies how to
map between the address spaces and provides special functions to do the
mapping, what is now left for the generic code?
BTW 5 out of the 6 functions are currently defined by the archs, what
makes the 6th so special?
Highmem is the only special case, that can be handled by generic code,
because the basic problem is on every arch the same.

bye, Roman
--
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-05-09 21:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-07  2:17 Rik van Riel
2002-05-07 17:37 ` Christoph Hellwig
2002-05-07 18:03   ` William Lee Irwin III
2002-05-08 11:06   ` Samuel Ortiz
2002-05-08 11:13     ` William Lee Irwin III
2002-05-08 13:40     ` Rik van Riel
2002-05-08 18:21   ` Roman Zippel
2002-05-08 21:34     ` William Lee Irwin III
2002-05-08 22:34       ` Roman Zippel
2002-05-08 22:42         ` William Lee Irwin III
2002-05-08 22:50           ` William Lee Irwin III
2002-05-08 23:26           ` Roman Zippel
2002-05-09  1:29             ` William Lee Irwin III
2002-05-09 12:33               ` Roman Zippel
2002-05-09 14:09                 ` William Lee Irwin III
2002-05-09 15:36                   ` Roman Zippel
2002-05-09 17:42                     ` William Lee Irwin III
2002-05-09 21:45                       ` Roman Zippel [this message]
2002-05-09 23:13                         ` William Lee Irwin III
2002-05-10 11:37                           ` Roman Zippel
2002-05-10 16:28                             ` William Lee Irwin III
2002-05-10 19:48                               ` Roman Zippel
2002-05-08 21:50     ` William Lee Irwin III

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=3CDAEDE0.E12583FB@linux-m68k.org \
    --to=zippel@linux-m68k.org \
    --cc=hch@infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@conectiva.com.br \
    --cc=sortiz@dbear.engr.sgi.com \
    --cc=wli@holomorphy.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