From: Johannes Weiner <hannes@cmpxchg.org>
To: Dave Hansen <dave.hansen@intel.com>
Cc: "Khalid Mughal (khalidm)" <khalidm@cisco.com>,
Rik van Riel <riel@redhat.com>,
"Daniel Walker (danielwa)" <danielwa@cisco.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Michal Hocko <mhocko@suse.com>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"xe-kernel@external.cisco.com" <xe-kernel@external.cisco.com>
Subject: Re: computing drop-able caches
Date: Fri, 12 Feb 2016 17:15:09 -0500 [thread overview]
Message-ID: <20160212221509.GA31407@cmpxchg.org> (raw)
In-Reply-To: <56BE52CE.5070403@intel.com>
On Fri, Feb 12, 2016 at 01:46:54PM -0800, Dave Hansen wrote:
> On 02/12/2016 10:01 AM, Khalid Mughal (khalidm) wrote:
> > If you look at the attached pdf, you will notice that OOM messages start
> > to appear when memAvailable is showing 253MB (259228 KB) Free, memFree is
> > 13.5MB (14008 KB) Free, and dropcache based calculation 3Available memory2
> > is showing 21MB (21720 KB) Free.
> >
> > So, it appears that memAvailable is not as accurate, especially if data is
> > used to warn user about system running low on memory.
>
> Yep, that's true.
>
> But, MemAvailable is calculated from some very cheap counters. The
> "dropcache-based-calculation" requires iterating over every 4k page
> cache page in the system.
It's also completely off when the dominating cache consumer uses
mmap() instead of buffered IO.
> We track dirty and writebackw with counters, so we should theoretically
> be able to pull those out of MemAvailable fairly cheaply.
Yeah, that sounds like a good idea.
But the fact remains that this will never be fully accurate, and there
will always be scenarios where the system will thrash and trigger OOM
before this counter depletes, simply because maintaining uptodate heat
information of the page cache would be crazy expensive.
IMO, the best way to use the MemAvailable counter is to calculate a
utilization percentage against MemTotal, and then maintaining a
healthy number like 80-90% - depending on expected runtime variance
and an educated guess of how hot the page cache is.
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-02-12 22:15 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-28 23:42 computing drop-able caches Daniel Walker
2016-01-28 23:58 ` Johannes Weiner
2016-01-29 1:03 ` Daniel Walker
2016-01-29 1:29 ` Daniel Walker
2016-01-29 1:55 ` Johannes Weiner
2016-01-29 21:21 ` Daniel Walker
2016-01-29 22:33 ` Johannes Weiner
2016-01-29 22:41 ` Rik van Riel
2016-02-08 20:57 ` Khalid Mughal (khalidm)
2016-02-10 18:04 ` Daniel Walker
2016-02-10 18:13 ` Dave Hansen
2016-02-10 19:11 ` Daniel Walker
2016-02-11 22:11 ` Rik van Riel
2016-02-12 18:01 ` Khalid Mughal (khalidm)
2016-02-12 21:46 ` Dave Hansen
2016-02-12 22:15 ` Johannes Weiner [this message]
2016-02-12 18:06 ` Dave Hansen
2016-02-12 18:15 ` Daniel Walker
2016-02-12 18:18 ` Dave Hansen
2016-02-12 18:25 ` Daniel Walker
2016-02-12 20:15 ` Daniel Walker
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=20160212221509.GA31407@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=danielwa@cisco.com \
--cc=dave.hansen@intel.com \
--cc=khalidm@cisco.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=riel@redhat.com \
--cc=viro@zeniv.linux.org.uk \
--cc=xe-kernel@external.cisco.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 NNTP newsgroup(s).