Skip to contentSkip to conversation

2.4.18 no timestamp update on modified mmapped files

DISCUSSION Kevin Easton 2 participants 2 messages Jun 16, 2002

lore
Share & tools
lore
#0 lore raw
Quoted 17 lines · Hugh Dickins
Quoted 16 lines · Russell King
Quoted 4 lines · Kevin Easton

Hmm.. so how do such pages get marked dirty on architectures that don't do it in hardware ("most RISC architectures" according to a comment in memory.c)? Is the entire mapping made dirty when the write permissions are added?

No. You only give user space write access when the write access _and_ "Linux dirty bit" are set. This means you fault when user space tries to write to the page, which means you can set the dirty bit. This is what the following code is doing (if write_access is required and the pte already has write permission, then set the dirty bit):

        if (write_access) {
                if (!pte_write(entry))
                        return do_wp_page(mm, vma, address, pte, pmd, entry);
Quoted 7 lines
Quoted 2 lines
                entry = pte_mkdirty(entry);
}

Thanks, Russell. Sorry, Kevin: I wasn't even thinking about non-i86 cases, add that to the list of disclaimers I put in.

Hugh

So... the difference on i386 is just the definitions of the protection_map entries that are used.. specifically that PAGE_SHARED in asm-i386/pgtable.h includes _PAGE_RW? Changing this definition to be the same as the PAGE_COPY definition would be one fix?

- Kevin.

#1 lore raw
Quoted 5 lines · Kevin Easton

So... the difference on i386 is just the definitions of the protection_map entries that are used.. specifically that PAGE_SHARED in asm-i386/pgtable.h includes _PAGE_RW? Changing this definition to be the same as the PAGE_COPY definition would be one fix?

It _could_ be _part_ of a fix (to the "problem" of dirty unbacked pages arriving unheralded at the filesystem, too late to find space for them; but our reluctance to have read faults allocate).

I say "could" because it would tend to cause double (read then write) faulting more widely than necessary; I say "part" because at present do_wp_page expects to be handling private Copy-On-Write faults rather than shared mappings (please correct me if I'm wrong, Russell); and we would still need to implement a callout down to the filesystem (e.g. "wppage" method I suggested) to allocate the space (though, doing it on the cheap, that method could be "nopage" revisited).

And I put quotes around "problem" because I'm uncertain how seriously to take it, and we've had no chorus of anxious developers and users.

Hugh