linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Tweedie <sct@redhat.com>
To: Andrea Arcangeli <andrea@suse.de>
Cc: Stephen Tweedie <sct@redhat.com>,
	Linus Torvalds <torvalds@transmeta.com>,
	Rogier Wolff <R.E.Wolff@BitWizard.nl>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: mapping user space buffer to kernel address space
Date: Tue, 17 Oct 2000 14:53:46 +0100	[thread overview]
Message-ID: <20001017145346.B20914@redhat.com> (raw)
In-Reply-To: <20001017001349.F17222@athlon.random>; from andrea@suse.de on Tue, Oct 17, 2000 at 12:13:49AM +0200

Hi,

On Tue, Oct 17, 2000 at 12:13:49AM +0200, Andrea Arcangeli wrote:
> 
> Correct. But the problem is that the page won't stay in physical memory after
> we finished the I/O because swap cache with page count 1 will be freed by the
> VM.

Rik has been waiting for an excuse to get deferred swapout into the
mainline.  Sounds like we've got the excuse.

> And anyways from a design standpoint it looks much better to really pin the
> page in the pte too (just like kernel reserved pages are pinend after a
> remap_page_range).

Unfortunately, there is one common case where we want to do exactly
that.  "dd < /dev/zero > something_using_raw_io" maps a whole series
of identical readonly ZERO_PAGE pages into the kiobuf.  One of the
reasons I removed the automatic page locking was that otherwise we're
forced to special-case things like ZERO_PAGE in the locking code.

Even ignoring that, users _will_ submit multiple IOs in the same page.
Pinning the physical page with page->count is clean.  Doing the
locking with the page lock makes no sense if you have adjacent IOs or
if you want to maintain the kiobuf mapping for any length of time.
The point of kiobufs was to avoid VM hacks so that IO can be done at
physical page level.  Pinning ptes should not have anything to do with
the IO or we've lost that abstraction.

> Replacing the get_user/put_user with handle_mm_fault _after_ changing
> follow_page to check the dirty bit too in the write case should be ok.

Right.

> > Once I'm back in the UK I'll look at getting map_user_kiobuf() simply
> > to call the existing access_one_page() from ptrace.  You're right,
> 
> access_one_page is missing the pagetable lock too, but that seems the only
> problem. I'm not convinced mixing the internal of access_one_page and
> map_user_kiobuf is a good thing since they needs to do a very different thing
> in the critical section.

Not the whole of access_one_page, but the pagetable-locked
follow-page / handle_mm_fault loop should be common code.  That's
where we're having the problem, so let's avoid having to maintain it
in two places.

Cheers, 
 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/

       reply	other threads:[~2000-10-17 13:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200010140918.LAA10416@cave.bitwizard.nl>
     [not found] ` <Pine.LNX.4.10.10010141916490.1642-100000@penguin.transmeta.com>
     [not found]   ` <20001016000854.A27414@athlon.random>
     [not found]     ` <20001016221401.A19951@redhat.com>
     [not found]       ` <20001017001349.F17222@athlon.random>
2000-10-17 13:53         ` Stephen Tweedie [this message]
     [not found] <20001018015949.C4635@athlon.random>
     [not found] ` <Pine.LNX.4.10.10010172129290.6732-100000@penguin.transmeta.com>
2000-10-19 20:06   ` Stephen Tweedie
2000-10-20 17:34     ` Linus Torvalds

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=20001017145346.B20914@redhat.com \
    --to=sct@redhat.com \
    --cc=R.E.Wolff@BitWizard.nl \
    --cc=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=torvalds@transmeta.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