From: Linus Torvalds <torvalds@transmeta.com>
To: "Stephen C. Tweedie" <sct@redhat.com>
Cc: Andrea Arcangeli <andrea@suse.de>,
Rik van Riel <riel@nl.linux.org>, Ingo Molnar <mingo@redhat.com>,
linux-mm@kvack.org
Subject: Re: PATCH [2.4.0test10]: Kiobuf#02, fault-in fix
Date: Mon, 6 Nov 2000 09:23:38 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.10.10011060912120.7955-100000@penguin.transmeta.com> (raw)
In-Reply-To: <20001106150539.A19112@redhat.com>
On Mon, 6 Nov 2000, Stephen C. Tweedie wrote:
>
> > > - map = follow_page(ptr);
> > > + map = follow_page(ptr, datain);
> >
> > Here you should _first_ follow_page and do handle_mm_fault _only_ if the pte is
> > not ok.
>
> Agreed --- I'll push that as a performace diff to Linus once the
> essential bug-fixes are in.
I would _really_ want to see follow_page() just cleaned up altogether.
We should NOT have code that messes with combinations of
"handle_mm_fault()" and "follow_page()" at all.
We should just change the page followers (do_no_page() and friends) to
return the "struct page" directly, instead of returning an "int". Then
we'd have something on the order of
struct page * follow_page(struct mm_struct *mm, struct vm_area_struct * vma,
unsigned long address, int write_access)
{
pgd_t *pgd;
pmd_t *pmd;
pgd = pgd_offset(mm, address);
pmd = pmd_alloc(pgd, address);
if (pmd) {
pte_t * pte = pte_alloc(pmd, address);
if (pte) {
struct page * page = handle_pte_fault(mm, vma, address, write_access, pte);
if (page)
return page;
}
}
return NULL;
}
and just a simple
int handle_pte_fault(struct mm_struct *mm, ...
{
struct page * page = follow_page(..);
if (!IS_ERR(page)) {
page_cache_release(page); /* it's in the page tables */
return 1;
}
return PTR_ERR(page);
}
and you' dbe done with it.
Yes, I realize that we need to do the min_flt/maj_flt stuff too, and that
we'd need to tweak the return codes for sigbus/oom instead of having the
current 0 == SIGBUS, -1 == OOM magic, but that would actually clean things
up and would allow us to return proper errors on page faults (like
indicating whether it was due to ENOMEM or due to EIO or due to some other
reason like EPERM that we couldn't handle the page fault).
Linus
--
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-11-06 17:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-11-02 13:40 Stephen C. Tweedie
2000-11-02 14:30 ` Jeff Garzik
2000-11-02 15:58 ` Stephen C. Tweedie
2000-11-04 1:28 ` Eric Lowe
2000-11-03 22:27 ` Andrea Arcangeli
2000-11-04 1:36 ` Eric Lowe
2000-11-04 2:07 ` Andrea Arcangeli
2000-11-06 15:05 ` Stephen C. Tweedie
2000-11-06 16:12 ` Andrea Arcangeli
2000-11-06 16:54 ` Stephen C. Tweedie
2000-11-06 22:34 ` Andrea Arcangeli
2000-11-07 11:17 ` Stephen C. Tweedie
2000-11-06 17:23 ` Linus Torvalds [this message]
2000-11-07 11:57 ` Stephen C. Tweedie
2000-11-07 13:37 ` Andrea Arcangeli
2000-11-08 12:31 ` 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=Pine.LNX.4.10.10011060912120.7955-100000@penguin.transmeta.com \
--to=torvalds@transmeta.com \
--cc=andrea@suse.de \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=riel@nl.linux.org \
--cc=sct@redhat.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