linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* RE: Running out of vmalloc space
@ 2001-05-17 18:51 Hua Ji
  2001-05-17 20:17 ` Andi Kleen
  0 siblings, 1 reply; 18+ messages in thread
From: Hua Ji @ 2001-05-17 18:51 UTC (permalink / raw)
  To: David Pinedo, linux-mm

>What are the implications of making such a change?  Will it work when
>there is less or more memory in the system?  Should this be a
>configurable kernel parameter?

My 2 cents:

By default, linux kernel space starts from PAGE_OFFSET, which is 0xC0000000.
In other words,
All the kernel can only have 1G memory left for usage, if/when under a 32bit
CPU.

Even with the 1G left, the cake left for vmalloc is much less than the 1G.
Kernel
will map the PAGE_OFFSET~PAGE_OFFSET+physical_memory for kmalloc usage. The
real start point for
vmalloc is high_memory + 8M(this is a hole). 

Hence, we can understand that the virtual address left for vmalloc is really
small.

For example, if your machine has a physical memory of 256M. And then your
vmalloc can only manage
(1G-256M-8M) space.

If we go through the get_vma_area that is called by vmalloc(), we will find
this:

------------------------------------------
addr = VMALLOC_START;
.....

 if (addr > VMALLOC_END-size) {	 
			kfree(area);
			return NULL;
		}
------------------------------------------

Therefore, it is very possible that your driver codes can't find **big
enough hole** in the vmlist, which
is a global linked list for maintaining all the vm_struct data structures.

For enlarging the managed memory, you can try this:

* change the PAGE_OFFSET to 0x80000000(for example) from 0xC000000. Then you
will have 1G extra memory managable:-). However, the side effect is: your
user level tasks can only range from 0x0 to 0x8000000(2G).



Wish helpful,

Mike
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: Running out of vmalloc space
@ 2001-05-17 21:58 Hua Ji
  2001-05-18  8:21 ` Matti Aarnio
  0 siblings, 1 reply; 18+ messages in thread
From: Hua Ji @ 2001-05-17 21:58 UTC (permalink / raw)
  To: Matti Aarnio, Christoph Hellwig; +Cc: David Pinedo, linux-mm

http://www.linux-mm.org/more_than_1GB.shtml

The above url gives a good introduction for what we are discussing. 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Running out of vmalloc space
@ 2001-05-17 17:13 David Pinedo
  2001-05-17 17:39 ` Stephen C. Tweedie
  2001-05-17 19:16 ` Matti Aarnio
  0 siblings, 2 replies; 18+ messages in thread
From: David Pinedo @ 2001-05-17 17:13 UTC (permalink / raw)
  To: linux-mm

Hello.  My name is David Pinedo and I subscribed to this list a few days
ago.  I work for Hewlett-Packard, and am in the process of porting the
drivers for the FX10 graphics boards from Red Hat 6.2 to Red Hat 7.1.
Our customers are begging us to support the FX10 on RH7.1, primarily
because of the large memory capabilities in the 2.4.2 kernel.
 
I only have minimal knowledge of the Linux kernel, enough to be able to
create the kernel module driver for the FX10.  My apologies for jumping
into this email list and the inevitable newbie mistakes I may make.  I
have a strong business need to get these graphics boards working
correctly in the 2.4.2 kernel, and I think this email list may be the
only place I can get some help. If I should be using some other forum
for my questions, I would appreciate if someone would point me to it.
 
Porting the driver to 2.4.2 was not terribly difficult.  Most of the
changes were in code that translates to and from physical addresses and
virtual addresses.  There were a few changes I had to make due to
difference in the gcc compiler on RH7.1 vs RH6.2.
 
The FX10 has a very large frame buffer and control space (the control
space is where the registers to control the device reside).  The frame
buffer is 16Mbytes and the control space is 32Mbytes.  The address space
for the frame buffer and control space is allocated from the kernel vm
address space, using get_vm_area() in mm/vmalloc.c.
 
On Linux, HP supports up to two FX10 boards in the system.  In order to
use two FX10 boards, the kernel driver needs to map the frame buffer and
control space for both of the boards.  That's a lot of address space,
2*(16M+32M)=96M to be exact.  Using this much virtual address space on a
stock RH7.1 smp kernel on a system with 0.5G of memory didn't seem to
be a problem.  However, a colleague reported a problem to me on his
system with 1.0G of memory -- the X server was exiting with an error
message indicating that it couldn't map both devices.
 
On investigating the problem, I found that a call to get_vm_area was
failing because the kernel was running out of vmalloc space.  It seems
that the vmalloc space is smaller when more memory was installed on the
system:
 
                        .5G RAM           1.0G RAM
                       ----------        ---------
        VMALLOC_END    0xfdffe000        0xfdffe000
        VMALLOC_START  0xe0800000        0xf8800000
                       ----------        ---------
        space avail    0x1d7fe000(471M)  0x057FE000(87M)
 
 
I found that if I reconfigure the kernel with Maximum Virtual Memory set
to 2G (sets CONFIG_2GB), the vmalloc space is larger and the problem
goes away.  I couldn't quite figure out what the implications of
changing Maximum Virtual Memory really are.  The Help button when using
"make xconfig" says there is no help available.  Could someone enlighten
me?  Will this fix also work when I add more memory to the system?
 
Another method of fixing this problem that seems to work is to change
the constant VMALLOC_RESERVE in arch/i386/kernel/setup.c.  I changed the
line that defines it from:
 
   #define VMALLOC_RESERVE (unsigned long)(128 << 20)
 
to:
 
   #define VMALLOC_RESERVE (unsigned long)(256 << 20)
 
What are the implications of making such a change?  Will it work when
there is less or more memory in the system?  Should this be a
configurable kernel parameter?
 
Thanks for any information anyone can provide.
 
David Pinedo
Hewlett-Packard Company
Fort Collins, Colorado
dp@fc.hp.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2001-05-26  5:13 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-17 18:51 Running out of vmalloc space Hua Ji
2001-05-17 20:17 ` Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2001-05-17 21:58 Hua Ji
2001-05-18  8:21 ` Matti Aarnio
2001-05-17 17:13 David Pinedo
2001-05-17 17:39 ` Stephen C. Tweedie
2001-05-17 22:48   ` David Pinedo
2001-05-18 11:24     ` Andi Kleen
2001-05-18 11:53     ` Stephen C. Tweedie
2001-05-18 16:44     ` Christoph Hellwig
2001-05-22 23:15     ` David Pinedo
2001-05-23  9:35       ` Stephen C. Tweedie
2001-05-23 16:14         ` David Pinedo
2001-05-23 16:45           ` Stephen C. Tweedie
2001-05-26  5:13       ` Andrew Morton
2001-05-17 19:16 ` Matti Aarnio
2001-05-17 19:23   ` Christoph Hellwig
2001-05-17 20:10     ` Matti Aarnio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox