From: Oskar Senft <osk-lkml@sirrix.de>
To: linux-kernel@vger.kernel.org
Subject: Use of "high_memory" in iounmap
Date: Wed, 25 Jan 2006 11:28:17 +0100 [thread overview]
Message-ID: <43D752C1.40205@sirrix.de> (raw)
Hi!
While using Linux in a virtualization environment (L4), I found a
strange inconsistency in "iounmap" regarding the use of the
"high_memory" variable.
According to [1]: "high_memory is the virtual address where high memory
begins", so high_memory contains the first address in high memory.
Accordingly, also linux-source/mm/memory.c, ca. line 72 says:
"A number of key systems in x86 including ioremap() rely on the
assumption that high_memory defines the upper bound on direct map
memory, then end of ZONE_NORMAL. Under CONFIG_DISCONTIG this means that
max_low_pfn and highstart_pfn must be the same; there must be no gap
between ZONE_NORMAL and ZONE_HIGHMEM."
(BTW: CONFIG_DISCONTIG is no longer existent / has been renamed).
Obviously, this is applied correctly, for example in
linux-source/arch/i386/mm/ioremap.c in function "__ioremap":
/*
* Don't allow anybody to remap normal RAM that we're using..
*/
if (phys_addr <= virt_to_phys(high_memory - 1))
However, in linux-source/arch/i386/mm/ioremap.c in "iounmap" oviously
the meaning of "high_memory" is understood differently:
if ((void __force *)addr <= high_memory) return;
In that case (by means of <=) we could not unmap again the "first"
mapping in high memory: the first mapping usually is being mapped to the
start of the high memory and thus is addr == high_memory in the iounmap
call. (This was the case in which we found the inconsistency).
For this reason in my opinion it rather should be:
if ((void __force *)addr < high_memory) return;
What do you think?
Regards,
Oskar.
[1] Mel Gorman, Code Commentary On The Linux Virtual Memory Manager
p. 24, http://www.csn.ul.ie/~mel/projects/vm/guide/pdf/code.pdf
reply other threads:[~2006-01-25 10:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=43D752C1.40205@sirrix.de \
--to=osk-lkml@sirrix.de \
--cc=linux-kernel@vger.kernel.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