From: "Stephen C. Tweedie" <sct@dcs.ed.ac.uk>
To: "Benjamin C.R. LaHaise" <blah@kvack.org>
Cc: "Stephen C. Tweedie" <sct@dcs.ed.ac.uk>, linux-mm@kvack.org
Subject: Re: PATCH: Swap shared pages (was: How to read-protect a vm_area?)
Date: Tue, 24 Feb 1998 09:45:50 GMT [thread overview]
Message-ID: <199802240945.JAA03090@dax.dcs.ed.ac.uk> (raw)
In-Reply-To: <Pine.LNX.3.95.980223184015.28517B-100000@as200.spellcast.com>
Hi Ben,
On Mon, 23 Feb 1998 19:08:59 -0500 (U\x01), "Benjamin C.R. LaHaise"
<blah@kvack.org> said:
> Hello,
> On Mon, 23 Feb 1998, Stephen C. Tweedie wrote:
> ...
>> The patch below, against 2.1.88, adds a bunch of new functionality to
>> the swapper. The main changes are:
>>
>> * All swapping goes through the swap cache (aka. page cache) now.
> ...
> I noticed you're using just one inode for the swapper/page cache... What
> I've been working on is a slightly different approach: Create inodes for
> each anonymous mapping.
It's not a different approach to the same problem --- it's a different
problem entirely! The swapper_inode is *only* used as a root for the
page cache. Its job is to identify pages by their swap entry, rather
than by their vma. Its purpose is really more to do with the management
of swap pages on disk than in memory.
> The actual implementation uses one inode per mm_struct, with the
> virtual address within the process providing the offset. This has the
> advantage of giving us an easy way to find all ptes that use an
> anonymous page. Anonymous mappings end up looking more like shared
> mappings, which gives us some interesting possibilities - it becomes
> almost trivial to implement a MAP_SHARED on another process' address
> space. What do you think of this approach?
I'm not sure --- one inode per mm might have problems if we ever change
the virtual address of a physical page (and mremap() does exactly that).
However, that's not an insurmountable problem, and the remap-vma code
will probably get it right. In fact, the more I think of it the more I
am convinced that this is a good way to go.
I am actually planning a different but very similar approach for the
final MAP_SHARED | MAP_ANONYMOUS code, which is to have one inode per
new vma for anonymous shared regions. The primary reason for that is
for lookup, so that when we initialise a demand-zero page, we can
rapidly locate any other processes sharing this vma and update their
pte's too.
> My main goal is to reimplement the page-oriented swapping my pte-list
> patch performed, which makes the running time try_to_free_page
> drastically shorter, even predictable... (at most 1 pass over mem_map
> to find a page using the old style aging, or just one list operation
> using the inactive list approach)
Yep. I was thinking along similar lines a while back. Doing this will
also make it easier to unify the handling of shrink_mmap() and
try_to_free_page(), which is something we desparately need (we've
already unified the page and buffer shrinking, and I think we can unify
shm swapout too with the new swap cache code).
The changes you are proposing overlap a lot of my current patches, but
that's not a problem --- the two sets of changes doing fundamentally
orthogonal things; there's just an overlap in the middle. The code I'm
working on right now is targetted at getting MAP_SHARED | MAP_ANONYMOUS
in place, and I reckon it's now pretty close.
However, the new swap cache mechanism is a lot more generic than that,
and its real flexibility lies in the way its underlying mechanism works
--- the ability to do swap read-ahead and to proactively write-ahead
swap pages will allow us to do some major performance enhancements.
Your changes to the vmscan code are really concerned with policy ---
rapidly locating what to swap, where and when --- than the mechanics of
getting pages to and from disk, synchronously or asynchronously. In
other words, I'm keen to integrate the two diffs, since I see a lot more
complimentary than overlapping progress here.
Cheers,
Stephen.
next prev parent reply other threads:[~1998-02-24 9:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <199802192321.XAA06580@dax.dcs.ed.ac.uk>
1998-02-20 5:41 ` How to read-protect a vm_area? Benjamin C.R. LaHaise
1998-02-23 23:17 ` PATCH: Swap shared pages (was: How to read-protect a vm_area?) Stephen C. Tweedie
1998-02-23 23:27 ` Linus Torvalds
1998-02-24 0:08 ` Benjamin C.R. LaHaise
1998-02-24 9:45 ` Stephen C. Tweedie [this message]
1998-02-24 9:42 ` Rik van Riel
1998-02-24 23:38 ` Stephen C. Tweedie
1998-02-25 10:41 ` Rik van Riel
1998-02-25 19:00 ` Stephen C. Tweedie
1998-02-25 22:05 ` Rik van Riel
1998-02-24 11:16 ` Thomas Sailer
[not found] ` <Pine.LNX.3.96.980224152231.7112A-100000@renass3.u-strasbg.fr>
1998-02-24 23:38 ` Stephen C. Tweedie
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=199802240945.JAA03090@dax.dcs.ed.ac.uk \
--to=sct@dcs.ed.ac.uk \
--cc=blah@kvack.org \
--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