Re: Viewing virtual memory locations from the command line ??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2009-09-14 at 14:32 -0400, William Case wrote:
> Hi;
> 
> I can use gnome-system-monitor with the Ctrl-M key to view memory
> addresses for various processes.  It will show me a pop-up window with |
> VM Start | VM End | VM Size | Flags | VM Offset | etc.
> 
> What would be the command line equivalent ?  

cat /proc/<pid>/maps

E.g.: http://pastebin.com/m3f70e9bb

The columns are vmstart-vmend, perms, offset, device major:minor, inode
number and path (if one exists). See the "man proc" for more information
or the file filesystems/proc.txt in the kernel documentation directory.

Kernels since 2.6.14 also include an option for a "smaps" file which
gives additional information on the RSS and status of pages for each
mapped segment.

> Besides user process addresses, I would like to see kernel processes
> addresses on stdout.  My understanding is that Virtual Memory for the
> kernel map to the same addresses as their physical addresses, so either
> view would do.  Also, my understanding is that Virtual Memory creates a
> buffer in physical memory where it keeps the VM structure; similarly for
> a DMA buffer.  I would like to view them as well -- at least once.

Not sure what you're looking for here - the maps and smaps files only
make sense for user space processes since kernel threads do not have
their own address space (the mm field in the relevant task struct is
NULL). All code running in kernel mode uses the same more-or-less flat
address space (although there's a fixed offset between most kernel
virtual addresses and the corresponding physical address - see the
PAGE_OFFSET constant). There is a limited window of addresses used for
dynamic kernel mappings (vmalloc) but the majority of the kernel's
address space is statically mapped and does not change over time.

There are system-wide files in /proc like meminfo, slabinfo, buddyinfo,
pagetypeinfo, vmallocinfo, vmstat and zoneinfo that provide information
on the state of various memory related subsystems in the kernel - see
the proc documentation for more details.

You can also use tools like crash[1] or systemtap[2] to look at the
behavior of a running system and examine the values of kernel data
structures as they change.

> To avoid anyone spending a lot of time on long explanations, I just need
> someone to point me in the right direction re: commands.  If I have
> stated some mis-assumptions here, don't worry about it.  I have several
> kernel and architecture texts and I am just starting my closer look.

Have a look at the notes on linux-mm.org, e.g.:

http://linux-mm.org/VirtualMemory

There's also a very good introduction to all this in the early chapters
of Understanding the Linux Kernel by Bovet and Cesati:

http://oreilly.com/catalog/9780596000028/

[1] http://people.redhat.com/anderson/
[2] http://sourceware.org/systemtap/

Regards,
Bryn.


-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux