From: Dan Magenheimer <dan.magenheimer@oracle.com>
To: linux-mm@kvack.org
Subject: swapcache size oddness
Date: Fri, 27 Apr 2012 13:27:10 -0700 (PDT) [thread overview]
Message-ID: <f0b2f4a3-f6d4-41e9-943b-d083eec9e106@default> (raw)
In continuing digging through the swap code (with the
overall objective of improving zcache policy), I was
looking at the size of the swapcache.
My understanding was that the swapcache is simply a
buffer cache for pages that are actively in the process
of being swapped in or swapped out. And keeping pages
around in the swapcache is inefficient because every
process access to a page in the swapcache causes a
minor page fault.
So I was surprised to see that, under a memory intensive
workload, the swapcache can grow quite large. I have
seen it grow to almost half of the size of RAM.
Digging into this oddity, I re-discovered the definition
for "vm_swap_full()" which, in scan_swap_map() is a
pre-condition for calling __try_to_reclaim_swap().
But vm_swap_full() compares how much free swap space
there is "on disk", with the total swap space available
"on disk" with no regard to how much RAM there is.
So on my system, which is running with 1GB RAM and
10GB swap, I think this is the reason that swapcache
is growing so large.
Am I misunderstanding something? Or is this code
making some (possibly false) assumptions about how
swap is/should be sized relative to RAM? Or maybe the
size of swapcache is harmless as long as it doesn't
approach total "on disk" size?
(Sorry if this is a silly question again...)
Thanks,
Dan
--
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-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2012-04-27 20:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-27 20:27 Dan Magenheimer [this message]
2012-04-28 3:58 ` swapcache size oddness Hugh Dickins
2012-04-28 16:48 ` Dan Magenheimer
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=f0b2f4a3-f6d4-41e9-943b-d083eec9e106@default \
--to=dan.magenheimer@oracle.com \
--cc=linux-mm@kvack.org \
/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 NNTP newsgroup(s).