All of lore.kernel.org
 help / color / mirror / Atom feed
* understanding linux cache and free command
@ 2013-02-26 12:48 Prashant Batra
  2013-02-27  5:35 ` Prashant Batra
  0 siblings, 1 reply; 2+ messages in thread
From: Prashant Batra @ 2013-02-26 12:48 UTC (permalink / raw)
  To: linux-newbie; +Cc: prbatra.mail

Hi All,

I have created few memory cache areas using "kmem_cache_create" and 
using it to allocate some memory.

What I observe after some cache_alloc's and cache_free's is that 
/proc/slabinfo entries for my objects are good, meaning the number of 
objects go back to 0 after they are freed.

But linux "free" command shows that some of the objects are cached and 
that keeps on increasing. I am not able to understand this behavior. Is 
it that kernel keeps the cache objects even after they are freed?

#cat /proc/slabinfo
my_cache         200    200   4096    1    1 : tunables   24   12    8 : 
slabdata    200    200      0

It shows 200 allocated objects from "my_cache"

and

#free -lm

             total       used       free     shared    buffers     cached
Mem:         48340        610      47730          0         96       130

the cached objects keep on growing.

After 5 mins in which I am doing some alloc and free-
             total       used       free     shared    buffers     cached
Mem:        48340        616      47723          0         96        137

/proc/slabinfo remains the same.

Any help is appreciated.

Thanks,
Prashant
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

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

* Re: understanding linux cache and free command
  2013-02-26 12:48 understanding linux cache and free command Prashant Batra
@ 2013-02-27  5:35 ` Prashant Batra
  0 siblings, 0 replies; 2+ messages in thread
From: Prashant Batra @ 2013-02-27  5:35 UTC (permalink / raw)
  To: Prashant Batra, netdev; +Cc: linux-newbie

Adding netdev for a bigger audience.

On Tuesday, February 26, 2013 6:18:48 PM, Prashant Batra wrote:
> Hi All,
>
> I have created few memory cache areas using "kmem_cache_create" and
> using it to allocate some memory.
>
> What I observe after some cache_alloc's and cache_free's is that
> /proc/slabinfo entries for my objects are good, meaning the number of
> objects go back to 0 after they are freed.
>
> But linux "free" command shows that some of the objects are cached and
> that keeps on increasing. I am not able to understand this behavior.
> Is it that kernel keeps the cache objects even after they are freed?
>
> #cat /proc/slabinfo
> my_cache         200    200   4096    1    1 : tunables   24   12    8
> : slabdata    200    200      0
>
> It shows 200 allocated objects from "my_cache"
>
> and
>
> #free -lm
>
>             total       used       free     shared    buffers     cached
> Mem:         48340        610      47730          0         96       130
>
> the cached objects keep on growing.
>
> After 5 mins in which I am doing some alloc and free-
>             total       used       free     shared    buffers     cached
> Mem:        48340        616      47723          0         96        137
>
> /proc/slabinfo remains the same.
>
> Any help is appreciated.
>
> Thanks,
> Prashant


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

end of thread, other threads:[~2013-02-27  5:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-26 12:48 understanding linux cache and free command Prashant Batra
2013-02-27  5:35 ` Prashant Batra

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.