2008-06-24 11:19:36     global memory usage

Document created by Aaronwu Employee on Aug 6, 2013
Version 1Show Document
  • View in full screen mode

2008-06-24 11:19:36     global memory usage

Linux Newbie (INDIA)

Message: 57812   

 

Hi ,

 

 

 

Is it possible to find the global memory usage of an individual file in an Application(user space) using bfin-uclinux-objdump? or is there any other way to find it?

 

Thanks in Advance

QuoteReplyEditDelete

 

 

2008-06-24 11:40:47     Re: global memory usage

Mike Frysinger (UNITED STATES)

Message: 57814   

 

objdump runs on your development host and shows you information about binaries ... it doesnt work with runtime images at all

 

look at the files in /proc/<pid>/ and read the proc(5) man page

QuoteReplyEditDelete

 

 

2008-06-25 05:36:05     Re: global memory usage

Linux Newbie (INDIA)

Message: 57854   

 

Hi,

 

On executing following commands via telnet to board, I am getting following msg's

 

1. root:~> cat /proc/89/mem

cat: read error: No such process

 

2. root:~> cat /proc/92/status

 

Groups:

Mem:    29351872 bytes

Slack:   4878496 bytes

Shared:        0 bytes

Threads:        1

 

Also the same memory info is displayed on executing second command for all thread ID's.

 

Can you please suggest how to look for global memory usage of each and every threads in the application.

QuoteReplyEditDelete

 

 

2008-06-25 07:08:04     Re: global memory usage

Mike Frysinger (UNITED STATES)

Message: 57855   

 

i already gave you the document to read: man 5 proc

 

it explains every file in there and how to use it

QuoteReplyEditDelete

 

 

2008-06-27 03:41:01     Re: global memory usage

Linux Newbie (INDIA)

Message: 57950   

 

Hi,

 

I created a simple application which has 4Mbytes global buffer. On running the application in background and watching the memory it shows 8Mytes as used.

 

compiled using bfin-linux-uclibc-gcc main.c -o main

 

 

Intial memory

 

root:~> free

              total         used         free       shared      buffers

  Mem:        42904         3588        39316            0          104

 

while application is running

 

root:~> free

              total         used         free       shared      buffers

  Mem:        42904        12340        30564            0          104

 

Can you please explain why this behaviour???

 

 

QuoteReplyEditDelete

 

 

2008-06-27 05:03:09     Re: global memory usage

Yi Li (CHINA)

Message: 57952   

 

It may be expected behavior. "cat /proc/buddyinfo" before and after running the test to see what is the available memory block.

QuoteReplyEditDelete

 

 

2008-06-27 05:05:56     Re: global memory usage

Mike Frysinger (UNITED STATES)

Message: 57953   

 

read the documents i already pointed you to and correlate the files in the proc.  you're probably allocating more than 4 megs total, which means you hit: http://docs.blackfin.uclinux.org/doku.php?id=kernel_space_memory_allocation

QuoteReplyEditDelete

 

 

2008-06-29 11:02:50     Re: global memory usage

Linux Newbie (INDIA)

Message: 58050   

 

Hi ,

 

Thanks for the document, it helped me to gain more understanding.

 

Still need few issues to get clarified

 

After compiling my application, I am getting its size as follows

 

text             data           bss               dec                  hex           filename

1982426  984175    7998848     10965449         a751c9       app   

 

When I run this application and issue free command it shows as follows

 

root:~> free

                      total         used              free       shared      buffers

  Mem:        42584        40724         1860            0          184

 

Now I removed some global buffers in the project and its total sizes comes to around 1.7Mbytes and I did the same process again

 

text                data       bss            dec               hex        filename

1982402  984175   6178956   9145533  8b8cbd          app

 

When I run the application and issue the free it shows as follows

 

root:~> free

                     total           used            free       shared      buffers

  Mem:        42584        32876         9708            0          236

 

Now the free size is increased very much. It means , is there any constraint in allocating global buffers? system wise do we need to take care of any pre-cautions to optimize memory? I suspect its due to page boundary that after removing 1.7 Mbytes of memory almost 8Mbytes has been freed? is my understanding correct?

 

Thanks in Advcance

 

 

 

 

QuoteReplyEditDelete

 

 

2008-06-29 12:01:03     Re: global memory usage

Mike Frysinger (UNITED STATES)

Message: 58051   

 

did you read that wiki page i gave you ?  it talks about how the kernel memory manager works in power of twos.

 

QuoteReplyEditDelete

 

 

2008-06-29 12:35:32     Re: global memory usage

Linux Newbie (INDIA)

Message: 58052   

 

Yes Mike.

 

Also when we do insmod, system crashes due to page allocation failure. I believe it is due to memory fragmentation.

 

Is it possible to do memory de-fragment once the kernel is booted?

 

Is Non Power of 2 allocator ported now?

QuoteReplyEditDelete

 

 

2008-06-29 12:48:52     Re: global memory usage

Linux Newbie (INDIA)

Message: 58053   

 

One more question.

 

is there any docu on buddyinfo. how to interpret cat /proc/buddyinfo??

QuoteReplyEditDelete

 

 

2008-06-29 13:04:56     Re: global memory usage

Mike Frysinger (UNITED STATES)

Message: 58054   

 

there is no way to defragment things without an MMU

 

QuoteReplyEditDelete

 

 

2008-06-29 13:05:06     Re: global memory usage

Mike Frysinger (UNITED STATES)

Message: 58055   

 

look in linux-2.6.x/Documentation/

Attachments

    Outcomes