From: Jeff Garzik <jgarzik@mandrakesoft.mandrakesoft.com>
To: Timur Tabi <ttabi@interactivesi.com>
Cc: Linux MM mailing list <linux-mm@kvack.org>,
Linux Kernel Mailing list <linux-kernel@vger.rutgers.edu>
Subject: Re: phys-to-virt kernel mapping and ioremap()
Date: Fri, 21 Jul 2000 08:49:03 -0500 (CDT) [thread overview]
Message-ID: <Pine.LNX.3.96.1000721084834.5477B-100000@mandrakesoft.mandrakesoft.com> (raw)
In-Reply-To: <20000720182643Z131167-4584+4@kanga.kvack.org>
On Thu, 20 Jul 2000, Timur Tabi wrote:
> I'm studying the code for __ioremap and I'm confused by something.
>
> The phys_to_virt and virt_to_phys macros are very simple. Basically, in kernel
> space, the virtual address is an offset of the physical address, so it's very
> simple.
>
> __ioremap is supposed to take high PCI memory and map it to kernel space.
> However, __ioremap() calls get_vm_area() which then calls kmalloc(), which
> allocates some memory from the heap. Then remap_area_pages() is called, and
> that uses the three-level page tables to map the memory allocated by kmalloc to
> the PCI memory.
>
> And that's where I'm confused. Particularly:
>
> 1) Doesn't this mapping break the phys_to_virt and virt_to_phys macros?
>
> 2) kmalloc takes real physical memory from the kernel heap. But then the
> virtual addresses are remapped to other physical memory. What happens to the
> physical memory that kmalloc allocated? Why isn't it freed?
You are being confused by the allocation. kmalloc only allocates a
vm_area_struct, which holds information about the new mapping.
Jeff
--
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.eu.org/Linux-MM/
next prev parent reply other threads:[~2000-07-21 13:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-07-20 18:06 Timur Tabi
2000-07-21 13:49 ` Jeff Garzik [this message]
[not found] <20000720174852Z156962-31297+1037@vger.rutgers.edu>
2000-07-20 18:41 ` Jes Sorensen
2000-07-20 18:53 ` Timur Tabi
[not found] ` <20000720183534Z156966-31297+1096@vger.rutgers.edu>
2000-07-20 19:06 ` Jes Sorensen
2000-07-20 19:12 ` Ivan Passos
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=Pine.LNX.3.96.1000721084834.5477B-100000@mandrakesoft.mandrakesoft.com \
--to=jgarzik@mandrakesoft.mandrakesoft.com \
--cc=linux-kernel@vger.rutgers.edu \
--cc=linux-mm@kvack.org \
--cc=ttabi@interactivesi.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