All of lore.kernel.org
 help / color / mirror / Atom feed
* About kernel memory limit
@ 2011-11-10 14:23 Geraint Yang
  2011-11-10 20:58 ` Dave Hylands
  0 siblings, 1 reply; 9+ messages in thread
From: Geraint Yang @ 2011-11-10 14:23 UTC (permalink / raw)
  To: kernelnewbies

Hi there,
I am a newbie to Linux kernel programming. I am going to make a module
which will cost much memory in kernel, I just want to know how much
memory I can get by calling memory allocate API in kernel.
Any help will be appreaciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20111110/4ddbbe41/attachment.html 

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

* About kernel memory limit
  2011-11-10 14:23 About kernel memory limit Geraint Yang
@ 2011-11-10 20:58 ` Dave Hylands
  2011-11-11  4:44   ` Geraint Yang
  0 siblings, 1 reply; 9+ messages in thread
From: Dave Hylands @ 2011-11-10 20:58 UTC (permalink / raw)
  To: kernelnewbies

Hi,

On Thu, Nov 10, 2011 at 6:23 AM, Geraint Yang <geraint0923@gmail.com> wrote:
> Hi there,
> I am a newbie to Linux kernel programming. I am going to make a module
> which will cost much memory in kernel, I just want to know how much
> memory I can get by calling memory allocate API in kernel.

All of it.

>From kernel space, you can completely exhaust memory to the point of
making your system unusable.

>From kernel space you have vmalloc memory and kmalloc memory (plus a
couple other memory spaces). Depending on how things are configured,
it's possible to exhaust vmalloc memory even though there is memory
available to be kmalloc'd.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com

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

* About kernel memory limit
  2011-11-10 20:58 ` Dave Hylands
@ 2011-11-11  4:44   ` Geraint Yang
  2011-11-11  5:08     ` Haojian Zhuang
                       ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Geraint Yang @ 2011-11-11  4:44 UTC (permalink / raw)
  To: kernelnewbies

Hi Dave,
Thank you for your help !
Does it mean that I could use all of the memory my computer has? But one of
my classmates told me that kernel could only use 1G from a 4G
memory.computer...Is there anything I have misunderstood ?


On Fri, Nov 11, 2011 at 4:58 AM, Dave Hylands <dhylands@gmail.com> wrote:

> Hi,
>
> On Thu, Nov 10, 2011 at 6:23 AM, Geraint Yang <geraint0923@gmail.com>
> wrote:
> > Hi there,
> > I am a newbie to Linux kernel programming. I am going to make a module
> > which will cost much memory in kernel, I just want to know how much
> > memory I can get by calling memory allocate API in kernel.
>
> All of it.
>
> From kernel space, you can completely exhaust memory to the point of
> making your system unusable.
>
> From kernel space you have vmalloc memory and kmalloc memory (plus a
> couple other memory spaces). Depending on how things are configured,
> it's possible to exhaust vmalloc memory even though there is memory
> available to be kmalloc'd.
>
> --
> Dave Hylands
> Shuswap, BC, Canada
> http://www.davehylands.com
>



-- 
Geraint Yang
Tsinghua University Department of Computer Science and Technology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20111111/100c7645/attachment.html 

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

* About kernel memory limit
  2011-11-11  4:44   ` Geraint Yang
@ 2011-11-11  5:08     ` Haojian Zhuang
  2011-11-11  5:15     ` Dave Stevens
  2011-11-11  8:20     ` Dave Hylands
  2 siblings, 0 replies; 9+ messages in thread
From: Haojian Zhuang @ 2011-11-11  5:08 UTC (permalink / raw)
  To: kernelnewbies

On Fri, Nov 11, 2011 at 12:44 PM, Geraint Yang <geraint0923@gmail.com> wrote:
> Hi Dave,
> Thank you for your help !
> Does it mean that I could use all of the memory my computer has? But one of
> my classmates told me that kernel could only use 1G from a 4G
> memory.computer...Is there anything I have misunderstood ?
>

Kernel can operate 896MB directly. If your physical memory is larger
than this memory size, you can use high memory. So kernel needs to map
them first, then use it. The mapped size is limited in 128MB at the
same time.

Thanks
Haojian

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

* About kernel memory limit
  2011-11-11  4:44   ` Geraint Yang
  2011-11-11  5:08     ` Haojian Zhuang
@ 2011-11-11  5:15     ` Dave Stevens
  2011-11-11  5:28       ` Geraint Yang
  2011-11-11  8:20     ` Dave Hylands
  2 siblings, 1 reply; 9+ messages in thread
From: Dave Stevens @ 2011-11-11  5:15 UTC (permalink / raw)
  To: kernelnewbies

Quoting Geraint Yang <geraint0923@gmail.com>:

> Hi Dave,
> Thank you for your help !
> Does it mean that I could use all of the memory my computer has? But one of
> my classmates told me that kernel could only use 1G from a 4G
> memory.computer...Is there anything I have misunderstood ?

I'm sitting in front of a Ubuntu box with 8G installed, uname -a shows:

Linux roger-System-Product-Name 3.0.0-12-generic #20-Ubuntu SMP Fri  
Oct 7 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

so kernel 3 and free: shows
              total       used       free     shared    buffers     cached
Mem:       8192500    2907656    5284844          0     162060    1915540
-/+ buffers/cache:     830056    7362444
Swap:      7812092          0    7812092

so 2.9G of 8 in use

Dave



>
>
> On Fri, Nov 11, 2011 at 4:58 AM, Dave Hylands <dhylands@gmail.com> wrote:
>
>> Hi,
>>
>> On Thu, Nov 10, 2011 at 6:23 AM, Geraint Yang <geraint0923@gmail.com>
>> wrote:
>> > Hi there,
>> > I am a newbie to Linux kernel programming. I am going to make a module
>> > which will cost much memory in kernel, I just want to know how much
>> > memory I can get by calling memory allocate API in kernel.
>>
>> All of it.
>>
>> From kernel space, you can completely exhaust memory to the point of
>> making your system unusable.
>>
>> From kernel space you have vmalloc memory and kmalloc memory (plus a
>> couple other memory spaces). Depending on how things are configured,
>> it's possible to exhaust vmalloc memory even though there is memory
>> available to be kmalloc'd.
>>
>> --
>> Dave Hylands
>> Shuswap, BC, Canada
>> http://www.davehylands.com
>>
>
>
>
> --
> Geraint Yang
> Tsinghua University Department of Computer Science and Technology
>



-- 
It is told that such are the aerodynamics and wing loading of the  
bumblebee that, in principle, it cannot fly...if all this be  
true...life among bumblebees must bear a remarkable resemblance to  
life in the United States.

-- John Kenneth Galbraith, in American Capitalism: The Concept of  
Countervailing Power

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

* About kernel memory limit
  2011-11-11  5:15     ` Dave Stevens
@ 2011-11-11  5:28       ` Geraint Yang
  2011-11-11  5:46         ` adheer chandravanshi
  0 siblings, 1 reply; 9+ messages in thread
From: Geraint Yang @ 2011-11-11  5:28 UTC (permalink / raw)
  To: kernelnewbies

Thanks.
But I think that command 'free' just tell the memory used in kernel space
and user space.It is still unknown to us that how much memory is used by
kernel.



On Fri, Nov 11, 2011 at 1:15 PM, Dave Stevens <geek@uniserve.com> wrote:

> Quoting Geraint Yang <geraint0923@gmail.com>:
>
>  Hi Dave,
>> Thank you for your help !
>> Does it mean that I could use all of the memory my computer has? But one
>> of
>> my classmates told me that kernel could only use 1G from a 4G
>> memory.computer...Is there anything I have misunderstood ?
>>
>
> I'm sitting in front of a Ubuntu box with 8G installed, uname -a shows:
>
> Linux roger-System-Product-Name 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7
> 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
>
> so kernel 3 and free: shows
>             total       used       free     shared    buffers     cached
> Mem:       8192500    2907656    5284844          0     162060    1915540
> -/+ buffers/cache:     830056    7362444
> Swap:      7812092          0    7812092
>
> so 2.9G of 8 in use
>
> Dave
>
>
>
>
>
>>
>> On Fri, Nov 11, 2011 at 4:58 AM, Dave Hylands <dhylands@gmail.com> wrote:
>>
>>  Hi,
>>>
>>> On Thu, Nov 10, 2011 at 6:23 AM, Geraint Yang <geraint0923@gmail.com>
>>> wrote:
>>> > Hi there,
>>> > I am a newbie to Linux kernel programming. I am going to make a module
>>> > which will cost much memory in kernel, I just want to know how much
>>> > memory I can get by calling memory allocate API in kernel.
>>>
>>> All of it.
>>>
>>> From kernel space, you can completely exhaust memory to the point of
>>> making your system unusable.
>>>
>>> From kernel space you have vmalloc memory and kmalloc memory (plus a
>>> couple other memory spaces). Depending on how things are configured,
>>> it's possible to exhaust vmalloc memory even though there is memory
>>> available to be kmalloc'd.
>>>
>>> --
>>> Dave Hylands
>>> Shuswap, BC, Canada
>>> http://www.davehylands.com
>>>
>>>
>>
>>
>> --
>> Geraint Yang
>> Tsinghua University Department of Computer Science and Technology
>>
>>
>
>
> --
> It is told that such are the aerodynamics and wing loading of the
> bumblebee that, in principle, it cannot fly...if all this be true...life
> among bumblebees must bear a remarkable resemblance to life in the United
> States.
>
> -- John Kenneth Galbraith, in American Capitalism: The Concept of
> Countervailing Power
>
>
>


-- 
Geraint Yang
Tsinghua University Department of Computer Science and Technology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20111111/bc8dfda6/attachment.html 

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

* About kernel memory limit
  2011-11-11  5:28       ` Geraint Yang
@ 2011-11-11  5:46         ` adheer chandravanshi
  0 siblings, 0 replies; 9+ messages in thread
From: adheer chandravanshi @ 2011-11-11  5:46 UTC (permalink / raw)
  To: kernelnewbies


Try this command:

dmesg | grep Memory

For  me the output is:
[    0.000000] Memory: 2007408k/2051636k available (4678k kernel code, 42932k reserved, 2124k data, 668k init, 1142332k highmem)

Look here for more details:
https://bbs.archlinux.org/viewtopic.php?id=14412

~ Adheer

From: geraint0923@gmail.com
Date: Fri, 11 Nov 2011 13:28:53 +0800
Subject: Re: About kernel memory limit
To: geek at uniserve.com
CC: dhylands at gmail.com; kernelnewbies at kernelnewbies.org

Thanks. 
But I think that command 'free' just tell the memory used in kernel space and user space.It is still unknown to us that how much memory is used by kernel.



On Fri, Nov 11, 2011 at 1:15 PM, Dave Stevens <geek@uniserve.com> wrote:


Quoting Geraint Yang <geraint0923@gmail.com>:






Hi Dave,

Thank you for your help !

Does it mean that I could use all of the memory my computer has? But one of

my classmates told me that kernel could only use 1G from a 4G

memory.computer...Is there anything I have misunderstood ?




I'm sitting in front of a Ubuntu box with 8G installed, uname -a shows:



Linux roger-System-Product-Name 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux



so kernel 3 and free: shows

             total       used       free     shared    buffers     cached

Mem:       8192500    2907656    5284844          0     162060    1915540

-/+ buffers/cache:     830056    7362444

Swap:      7812092          0    7812092



so 2.9G of 8 in use



Dave












On Fri, Nov 11, 2011 at 4:58 AM, Dave Hylands <dhylands@gmail.com> wrote:




Hi,



On Thu, Nov 10, 2011 at 6:23 AM, Geraint Yang <geraint0923@gmail.com>

wrote:

> Hi there,

> I am a newbie to Linux kernel programming. I am going to make a module

> which will cost much memory in kernel, I just want to know how much

> memory I can get by calling memory allocate API in kernel.



All of it.



>From kernel space, you can completely exhaust memory to the point of

making your system unusable.



>From kernel space you have vmalloc memory and kmalloc memory (plus a

couple other memory spaces). Depending on how things are configured,

it's possible to exhaust vmalloc memory even though there is memory

available to be kmalloc'd.



--

Dave Hylands

Shuswap, BC, Canada

http://www.davehylands.com










--

Geraint Yang

Tsinghua University Department of Computer Science and Technology










-- 

It is told that such are the aerodynamics and wing loading of the bumblebee that, in principle, it cannot fly...if all this be true...life among bumblebees must bear a remarkable resemblance to life in the United States.





-- John Kenneth Galbraith, in American Capitalism: The Concept of Countervailing Power







-- 
Geraint Yang 
Tsinghua University Department of Computer Science and Technology




_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20111111/ee068e5b/attachment-0001.html 

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

* About kernel memory limit
  2011-11-11  4:44   ` Geraint Yang
  2011-11-11  5:08     ` Haojian Zhuang
  2011-11-11  5:15     ` Dave Stevens
@ 2011-11-11  8:20     ` Dave Hylands
  2011-11-11  8:40       ` Geraint Yang
  2 siblings, 1 reply; 9+ messages in thread
From: Dave Hylands @ 2011-11-11  8:20 UTC (permalink / raw)
  To: kernelnewbies

Hi Geraint,

On Thu, Nov 10, 2011 at 8:44 PM, Geraint Yang <geraint0923@gmail.com> wrote:
> Hi Dave,
> Thank you for your help !
> Does it mean that I could use all of the memory my computer has? But one of
> my classmates told me that kernel could only use 1G from a 4G
> memory.computer...Is there anything I have misunderstood ?

There is a certain amount (exact amount depends on the architecture
and configuration) that can be accessed directly all of the time.

Then there is high memory, which can be accessed using kmap/kunmap.
See http://linux-mm.org/HighMemory

If you have a 64-bit system, then you can access all of the memory directly.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com

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

* About kernel memory limit
  2011-11-11  8:20     ` Dave Hylands
@ 2011-11-11  8:40       ` Geraint Yang
  0 siblings, 0 replies; 9+ messages in thread
From: Geraint Yang @ 2011-11-11  8:40 UTC (permalink / raw)
  To: kernelnewbies

Thank you !
I will try kmap/kunmap later.


On Fri, Nov 11, 2011 at 4:20 PM, Dave Hylands <dhylands@gmail.com> wrote:

> Hi Geraint,
>
> On Thu, Nov 10, 2011 at 8:44 PM, Geraint Yang <geraint0923@gmail.com>
> wrote:
> > Hi Dave,
> > Thank you for your help !
> > Does it mean that I could use all of the memory my computer has? But one
> of
> > my classmates told me that kernel could only use 1G from a 4G
> > memory.computer...Is there anything I have misunderstood ?
>
> There is a certain amount (exact amount depends on the architecture
> and configuration) that can be accessed directly all of the time.
>
> Then there is high memory, which can be accessed using kmap/kunmap.
> See http://linux-mm.org/HighMemory
>
> If you have a 64-bit system, then you can access all of the memory
> directly.
>
> --
> Dave Hylands
> Shuswap, BC, Canada
> http://www.davehylands.com
>



-- 
Geraint Yang
Tsinghua University Department of Computer Science and Technology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20111111/7aeaa19d/attachment.html 

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

end of thread, other threads:[~2011-11-11  8:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-10 14:23 About kernel memory limit Geraint Yang
2011-11-10 20:58 ` Dave Hylands
2011-11-11  4:44   ` Geraint Yang
2011-11-11  5:08     ` Haojian Zhuang
2011-11-11  5:15     ` Dave Stevens
2011-11-11  5:28       ` Geraint Yang
2011-11-11  5:46         ` adheer chandravanshi
2011-11-11  8:20     ` Dave Hylands
2011-11-11  8:40       ` Geraint Yang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.