From: Jamie Lokier <jamie.lokier@cern.ch>
To: Chuck Lever <cel@monkey.org>
Cc: linux-mm@kvack.org
Subject: Re: MADV_DONTNEED
Date: Wed, 22 Mar 2000 23:41:15 +0100 [thread overview]
Message-ID: <20000322234115.B31795@pcep-jamie.cern.ch> (raw)
In-Reply-To: <Pine.BSO.4.10.10003221641400.17378-100000@funky.monkey.org>; from Chuck Lever on Wed, Mar 22, 2000 at 04:54:09PM -0500
Chuck Lever wrote:
> > If I knew what msync(MS_INVALIDATE) did I could think about this! :-)
> > But the msync documentation is unhelpful and possibly misleading.
>
> well, the doc's accurate, as far as i can tell. but my use of it is a
> side-effect of the behavior described in the man page.
"MS_INVALIDATE asks to invalidate other mappings of the
same file (so that they can be updated with the fresh val-
ues just written)."
Oh I see. It means the locally modified but in principle shared mapping
is copied back to the underlying object. For a page aligned mapping
that shouldn't need to do anything.
Since the MS_INVALIDATE code doesn't modify other ptes, we must assume
the other mappings are all page aligned or they wouldn't see the
update.
So why does MS_INVALIDATE have any code? :-)
> > > function 2 (could be MADV_FREE; currently msync(MS_INVALIDATE)):
> > > release pages, syncing dirty data. if they are referenced again, the
> > > process causes page faults to read in latest data.
> >
> > Oh, I see, this is what msync(MS_INVALIDATE) does :-)
>
> more or less. it removes the mappings, but also schedules writes for any
> dirty pages it finds.
I think "schedules writes" is what MS_ASYNC and MS_SYNC do,
independently of MS_INVALIDATE.
> > > function 4 (for comparison; currently munmap):
> > > release pages, syncing dirty data. if they are referenced again, the
> > > process causes invalid memory access faults.
> >
> > > for MADV_DONTNEED, i re-used code.
> >
> > From where?
>
> you can find logic that invokes zap_page_range throughout the mm code, but
> especially in do_munmap. if my implementation is broken in this regard,
> then i'd bet do_munmap is broken too.
do_munmap also calls vm_ops->unmap before the zap_page_range, which has
a potentially important side effects for files... Like actually writing
the data :-)
That's not what, say, MADV_DISCARD would do, but it's what "release
pages, syncing dirty data" should do.
> > > i'm not convinced that it's correct, though, as i stated when i
> > > submitted the patch. it may abandon swap cache pages, and there may
> > > be some undefined interaction between file truncation and
> > > MADV_DONTNEED.
> >
> > Oh dear -- because it's in pre2.4 already :-)
> > Better work out what it's supposed to do and fix it :-)
>
> it's not too serious, i hope, since madvise is not used by any existing
> Linux apps. this area of the kernel has been changing so much in the past
> 6-9 months that it's been difficult to know what is the blessed way to get
> my implementation to work.
Quite. I'm not so concerned about the implementation at this stage as
getting agreement on the right semantics!
-- Jamie
--
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-03-22 22:41 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20000320135939.A3390@pcep-jamie.cern.ch>
2000-03-20 19:09 ` MADV_SPACEAVAIL and MADV_FREE in pre2-3 Chuck Lever
2000-03-21 1:20 ` madvise (MADV_FREE) Jamie Lokier
2000-03-21 2:24 ` William J. Earl
2000-03-21 14:08 ` Jamie Lokier
2000-03-22 16:24 ` Chuck Lever
2000-03-22 18:05 ` Jamie Lokier
2000-03-22 21:39 ` Chuck Lever
2000-03-22 22:31 ` Jamie Lokier
2000-03-22 22:44 ` Stephen C. Tweedie
2000-03-23 18:53 ` Chuck Lever
2000-03-24 0:00 ` /dev/recycle Jamie Lokier
2000-03-24 9:14 ` /dev/recycle Christoph Rohland
2000-03-24 13:10 ` /dev/recycle Jamie Lokier
2000-03-24 13:54 ` /dev/recycle Christoph Rohland
2000-03-24 14:17 ` /dev/recycle Jamie Lokier
2000-03-24 17:40 ` /dev/recycle Christoph Rohland
2000-03-24 18:13 ` /dev/recycle Jamie Lokier
2000-03-25 8:35 ` /dev/recycle Christoph Rohland
2000-03-28 0:48 ` /dev/recycle Chuck Lever
2000-03-24 0:21 ` madvise (MADV_FREE) Jamie Lokier
2000-03-24 7:21 ` lars brinkhoff
2000-03-24 17:42 ` Jeff Dike
2000-03-24 16:49 ` Jamie Lokier
2000-03-24 17:08 ` Stephen C. Tweedie
2000-03-24 19:58 ` Jeff Dike
2000-03-25 0:30 ` Stephen C. Tweedie
2000-03-22 22:33 ` Stephen C. Tweedie
2000-03-22 22:45 ` Jamie Lokier
2000-03-22 22:48 ` Stephen C. Tweedie
2000-03-22 22:55 ` Q. about swap-cache orphans Jamie Lokier
2000-03-22 22:58 ` Stephen C. Tweedie
2000-03-22 18:15 ` madvise (MADV_FREE) Christoph Rohland
2000-03-22 18:30 ` Jamie Lokier
2000-03-23 16:56 ` Christoph Rohland
2000-03-21 1:29 ` MADV_DONTNEED Jamie Lokier
2000-03-22 17:04 ` MADV_DONTNEED Chuck Lever
2000-03-22 17:10 ` MADV_DONTNEED Stephen C. Tweedie
2000-03-22 17:32 ` MADV_DONTNEED Jamie Lokier
2000-03-22 17:33 ` MADV_DONTNEED Jamie Lokier
2000-03-22 17:37 ` MADV_DONTNEED Stephen C. Tweedie
2000-03-22 17:43 ` MADV_DONTNEED Jamie Lokier
2000-03-22 21:54 ` MADV_DONTNEED Chuck Lever
2000-03-22 22:41 ` Jamie Lokier [this message]
2000-03-23 19:13 ` MADV_DONTNEED James Antill
2000-03-21 1:47 ` Extensions to mincore Jamie Lokier
2000-03-21 9:11 ` Eric W. Biederman
2000-03-21 9:40 ` lars brinkhoff
2000-03-21 11:34 ` Stephen C. Tweedie
2000-03-21 15:15 ` Jamie Lokier
2000-03-21 15:41 ` Stephen C. Tweedie
2000-03-21 15:55 ` Jamie Lokier
2000-03-21 16:08 ` Stephen C. Tweedie
2000-03-21 16:48 ` Jamie Lokier
2000-03-22 7:36 ` Eric W. Biederman
2000-03-21 1:50 ` MADV flags as mmap options Jamie Lokier
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=20000322234115.B31795@pcep-jamie.cern.ch \
--to=jamie.lokier@cern.ch \
--cc=cel@monkey.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