linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Questions on cache flushing in do_wp_page
@ 1999-06-07 19:26 Kanoj Sarcar
  1999-06-07 19:44 ` David S. Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Kanoj Sarcar @ 1999-06-07 19:26 UTC (permalink / raw)
  To: linux-mm, linux-kernel; +Cc: ralf, davem

I am trying to understand what the primitives flush_page_to_ram and
flush_cache_page do. I am vaguely aware of the issues of non coherent
io and virtual aliasing/virtual coherency error. Specially, I am
trying to guess at what these primitives might be doing in the
do_wp_page() routine. The only processors which I have worked with
are MIPS and Intel processors. In Intel, these two primitives are
null since the caches are fully coherent. For MIPS, I can't find
a good reason why either function would be neccesary in
do_wp_page(). I am CCing David Miller and Ralf Baechle whose
names appear in the copyright messages in arch/mips/mm/r4xx0.c.
Anyone else with m68k/ppc/sparc etc expertise please feel free to
comment.

I am looking at the piece of code in do_wp_page that reads:

        copy_cow_page(old_page,new_page);
        flush_page_to_ram(old_page);
        flush_page_to_ram(new_page);
        flush_cache_page(vma, address);
        set_pte(page_table, pte_mkwrite(pte_mkdirty(mk_pte(new_page, vma->vm_page_prot))));
        free_page(old_page);
        flush_tlb_page(vma, address);

I can see that the flush_cache_page() is needed for a processor that
has virtually indexed, virtually tagged L1, but is there any such
processor that Linux supports (sparc?)? Does this processor also
need virtual alias avoidance support from the os because the processor
can not detect such aliasing?

For MIPS R4000PC, with a virtually indexed physically tagged L1, I
think it might be enough to just have a flush_page_to_ram(new_page);
to avoid aliasing issues ...

In any case, I can't see a reason for flush_page_to_ram(old_page);
Can anyone tell me why that might be needed (on whichever processor)?

Another place that I can't explain why a flush_cache_page might be
needed is in:

        case 1:
                /* We can release the kernel lock now.. */
                unlock_kernel();

                flush_cache_page(vma, address);
                set_pte(page_table, pte_mkdirty(pte_mkwrite(pte)));
                flush_tlb_page(vma, address);
end_wp_page:
                if (new_page)
                        free_page(new_page);
                return 1;

Thanks.

Kanoj
kanoj@engr.sgi.com

--
To unsubscribe, send a message with 'unsubscribe linux-mm my@address'
in the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-06-07 21:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-07 19:26 Questions on cache flushing in do_wp_page Kanoj Sarcar
1999-06-07 19:44 ` David S. Miller
1999-06-07 20:45   ` Kanoj Sarcar
1999-06-07 21:54     ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox