Re: how to get physical memory address from virtual memory address

Tim Roberts wrote:
"David Schwartz" <davids@xxxxxxxxxxxxx> wrote:
Hari wrote:
Hi ,

I am using Linux 2.4.20 Kernel. I am runing an application which will
malloc and returns a virtual memory address. I need to get the physical
memory address for that virtual memory address. How can I get that?
There isn't one. You haven't allocated any physical memory, so the
kernel doesn't give you any.

What?? This is entirely incorrect. EVERY valid virtual address has an
associated physical address. In the case of malloc-ed memory, that
physical address will be in physical memory.

Addressing the OP, while you are in user mode, the physical address can
change at any time. The only reliable way to get the physical address is
within a kernel driver.

Where does the physical memory come from when you turn on virtual memory
overcommits? Look at Documentation/vm/overcommit-accounting in your
kernel sources. Setting vm.overcommit_memory=1 is indeed useful in some
circumstances but can lead to unpredictable process deaths.

Dr. Douglas O'Neal
Manager, Bioinformatics Center
Delaware Biotechnology Institute
(302) 831-3456

Relevant Pages

  • 2.6.33 dies on modprobe
    ... The kernel starts up fine and mounts the root-filesystem, ... Freeing unused kernel memory: 408k freed ... # CPUFreq processor drivers ...
  • Re: [PATCH] intel-agp.c: Fix crash when accessing nonexistent GTT entries in i915
    ... has info that 256K is for GTT bar, so max video memory size is 256M. ... IGD DVMT/FIXED MEMORY: 32 MB ... Access in iceweasel and the X server will crash. ... Sometimes, the kernel freezes. ...
  • Re: s2disk hang update
    ... This looks like we have run out of memory while creating a new kernel thread ... because the I/O doesn't work at this point). ... Keep 1 MB of memory free so that device drivers can allocate some pages in ...
  • [UNIX] Linux Kernel do_brk() Vulnerablility (Explained)
    ... Get your security news from a reliable source. ... A critical security bug has been found in the Linux kernel 2.4.22 (and ... earlier) memory management subsystem. ... for the code working at the lowest privilege level. ...
  • kernel panic - not syncing: out of memory and no killable processes
    ... Kernel panic - not syncing: Out of memory and no killable processes... ... Re-tune the scheduler latency defaults to decrease worst-case latencies ... # Device Drivers ...