linux-newbie.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Prashant Batra <prbatra.mail@gmail.com>
To: Prashant Batra <prbatra.lists@gmail.com>, netdev@vger.kernel.org
Cc: linux-newbie@vger.kernel.org
Subject: Re: understanding linux cache and free command
Date: Wed, 27 Feb 2013 11:05:36 +0530	[thread overview]
Message-ID: <512D9B28.205@gmail.com> (raw)
In-Reply-To: <512CAF30.70805@gmail.com>

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


      reply	other threads:[~2013-02-27  5:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-26 12:48 understanding linux cache and free command Prashant Batra
2013-02-27  5:35 ` Prashant Batra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=512D9B28.205@gmail.com \
    --to=prbatra.mail@gmail.com \
    --cc=linux-newbie@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=prbatra.lists@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).