From: Martin Maletinsky <maletinsky@scs.ch>
To: linux-mm@kvack.org, kernelnewbies@nl.linux.org
Subject: Question on pte bits
Date: Fri, 06 Dec 2002 15:57:24 +0100 [thread overview]
Message-ID: <3DF0BAD4.946B1845@scs.ch> (raw)
Hello,
Looking at some memory managment functions in 2.4.18, I came accross the function follow_page, which is called by get_user_pages, to parse a processes page tables.
After getting the corresponding page table entry, the function makes a check, which I don't quite understand - if write access is requested to the page, it not only checks
the write permission in the page table entry (with pte_write()), but also the dirty bit (with pte_dirty()). Why does a page need to be dirty in the case write == 1 (see
line 444 in the code excerpt below?
Thanks in advance for any help
with best regards
Martin Maletinsky
P.S. Please put me on CC: in your reply, since I am not in the mailing list.
static struct page * follow_page(struct mm_struct *mm, unsigned long address, int write)
425 {
426 pgd_t *pgd;
427 pmd_t *pmd;
428 pte_t *ptep, pte;
429
430 pgd = pgd_offset(mm, address);
431 if (pgd_none(*pgd) || pgd_bad(*pgd))
432 goto out;
433
434 pmd = pmd_offset(pgd, address);
435 if (pmd_none(*pmd) || pmd_bad(*pmd))
436 goto out;
437
438 ptep = pte_offset_atomic(pmd, address);
439
440 pte = *ptep;
441 pte_kunmap(ptep);
442 if (pte_present(pte)) {
443 if (!write ||
444 (pte_write(pte) && pte_dirty(pte)))
445 return pte_page(pte);
446 }
447
448 out:
449 return 0;
450 }
--
Supercomputing System AG email: maletinsky@scs.ch
Martin Maletinsky phone: +41 (0)1 445 16 05
Technoparkstrasse 1 fax: +41 (0)1 445 16 10
CH-8005 Zurich
--
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-mm.org/
next reply other threads:[~2002-12-06 14:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-06 14:57 Martin Maletinsky [this message]
2002-12-06 16:08 ` Question on pte bits 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=3DF0BAD4.946B1845@scs.ch \
--to=maletinsky@scs.ch \
--cc=kernelnewbies@nl.linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.