From: "Stephen C. Tweedie" <sct@redhat.com>
To: Mike Simons <msimons@moria.simons-clan.com>
Cc: Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: More observations...
Date: Tue, 16 May 2000 11:20:12 +0100 [thread overview]
Message-ID: <20000516112012.D26581@redhat.com> (raw)
In-Reply-To: <20000515224403.B5677@moria.simons-clan.com>; from msimons@moria.simons-clan.com on Mon, May 15, 2000 at 10:44:03PM -0400
Hi,
On Mon, May 15, 2000 at 10:44:03PM -0400, Mike Simons wrote:
> Sure if the kernel flushed started forcing flushed buffers to disk after
> 75% dirty the application could redirty ones already flushed and there
> would be some wasted I/O but that might just prevent the system from
> completely running out of "available" pages to use, since it could
> reuse one of it just put out to disk...
With mmap(), it is nothing to do with dirty buffers. There are, in fact,
_no_ dirty buffers when you have the mmap() case --- the buffer_heads
backing the files will remain clean. It is the pages themselves which
are dirty, and the only record of their dirtiness is in the ptes.
For buffer_heads, we can (and do) throttle write activity when
the dirty list grows too long. However, we don't do anything like
that for mmaped pages. Think what happens if you have an application
(say, a simulation, in which a lot of the data is constantly being
modified) which fits in memory, but only just --- if you put a limit
on the %age of dirty memory, you'd be constantly thrashing to disk
despite having enough memory for the workload.
We _could_ keep track of the number of dirty pages quite easily, by
making all clean ptes readonly. It's not at all clear that it helps,
though.
I think that the real solution here is still dynamic RSS limits for
mms. We can allow the RSS limits to grow as the RSS grows as long as
there are sufficient free pages in the GFP_USER class. As soon as we
start to swap, however, imposing RSS limits is an ideal way (right
now, it's pretty much the only way) to limit the impact of heavy
threaded memory write activity by a process.
The concept is quite simple: if you can limit a process's RSS, you
can limit the amount of memory which is pinned in process page tables,
and thus subject to expensive swapping. Note that you don't have to
get rid of the pages --- you can leave them in the page cache/swap
cache, where they can be re-faulted rapidly if needed, but if the
memory is needed for something else then shrink_mmap can reclaim the
pages rapidly.
Rick's old memory hog flag is essentially a simple case of an RSS
limit (the task RSS is limited to what it is currently set at). In
general, if you can identify severe memory pressure being caused by
a specific process, then you can start doing early RSS limiting on
the mm in question and substantially reduce the impact on the rest
of the system.
--Stephen
--
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.eu.org/Linux-MM/
next prev parent reply other threads:[~2000-05-16 10:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-05-16 2:44 Mike Simons
2000-05-16 10:20 ` Stephen C. Tweedie [this message]
2000-05-16 15:41 ` Rik van Riel
2000-05-16 16:07 ` Stephen C. Tweedie
2000-05-16 17:23 ` Rik van Riel
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=20000516112012.D26581@redhat.com \
--to=sct@redhat.com \
--cc=linux-mm@kvack.org \
--cc=msimons@moria.simons-clan.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