kmalloc/mmap bug?

kmalloc/mmap bug?

Post by Lok Tin L » Mon, 18 Dec 1995 04:00:00

In the old days,  kmalloc() could allocate only ~4KB (one page). Now
kmalloc() can allocate ~128KB. However, I noticed that kmalloc() still
incremented the mem_map[] entry only for the first page. Therefore,
when I tried to mmap the memory region allocated by kmalloc() to user space,
only the page table entry for the first page was set up correctly.
Is it a bug in the RMQUEUE and EXPAND macros in mm/swap.c in the 1.2.13 kernel?
The code seems to be the same in the 1.3.30 kernel. Has it been fixed in
the recent 1.3.x kernel?




1. kernel documentation, memory management, kmalloc, mmap.


I'm looking for documentation about kernel programming. I'm used to the
BSD world, where there is lot of stuff about the kernel in section 9 of
the man pages, and I don't know where to find that kind of information
for Linux. Here are a few problem I have, and for which I'm looking some

First problem: information about memory management: I did read that the
Linux kernel sees physical memory directly (ie: kernel virtual
addresses=physical addresses). Is it true? If not, how do I translate
between kernel virtual addresses and physical addresses?

Other problem: kmalloc and get_free_page feature a lot of options
(GFP_BUFFER, GFP_DMA, etc...). Where can I find info about them?

Last problem: I have a kernel resident buffer, with a kernel virtual
address kptr. Using an ioctl, I get this address in a user process. I
try to map the buffer in the user process virtual memory by issueing a
mmap on /dev/kmem at offset kptr:
  vptr = mmap(0, PAGESIZE, PROT_READ,
                   MAP_SHARED|MAP_FILE, fdkmem, (off_t)kptr);

The mmap is successful, but I don't get my buffer mapped (It's not the
data I did set up in kernel memory.) Why?

Thank you for any answer...

Emmanuel Dreyfus

2. Help: ethernet don't work

3. Kernel/Device Driver questions (mmap,kmalloc,irq)

4. xwindows failure on sunfire v240

5. fix weird kmalloc bug

6. Atomic Add

7. 3 kmalloc underallocation bugs

8. crc error when booting

9. mmap bug with drivers that adjust vm_start

10. mmap bug ???

11. mmap not working(2) - kernel bug?!

12. mmap bug in 2.4.18-3???