Re: Using /dev/mem to access memory allocated with kmalloc

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

 



Can I page reserve memory allocated by kmalloc?

Marek

Arjan van de Ven wrote:
On Mon, 2005-12-12 at 03:26 -0500, Marek Olszewski wrote:

Hello, I'm doing a little project that investigates the benefits of using the new (seemingly only accessible from privileged code) x86 SSE3 monitor/mwait instructions for locks on hyperthreaded machines.

To get this to work, I need to allocate some contiguous memory in kernel space that is memory mapped to some address range in a userspace app. For now, I'm just trying to get this to work by mmaping /dev/mem. I use virt_to_phys on a kmalloced address and return it to my user app via a syscall. I then try to mmap /dev/mem in my user app at an offset of the returned address. The memory mapping seems to succeed, but when I check the contents of the address (which I wrote to in kernel space), I don't get a match. Is there some /dev/mem file location-to-physical memory address mapping that I am not aware of? man mem says that they are the same.


mmap of non-PAGE_RESERVED kernel memory is not allowed, instead all
zeros are return.



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux