Linux-kernel mailing list archive 2000-29,: [PATCH] Flushing cache at exit_mmap

# [PATCH] Flushing cache at exit_mmap

NIIBE Yutaka (gniibe@chroot.org)
Fri, 21 Jul 2000 12:57:26 +0900

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Nathan Simons: "knfsd oops (2.4.0-test1) and tulip weirdness"
- Previous message: Keith Owens: "Re: Cache coherency... and locking"

Stuart Menefy found that there's something wrong in cache handling
(for SuperH (SH-4) port). It's not SuperH specific, but generic issue.

As he seems to be off-line these days, I submit the patch on behalf of
him. If there's something wrong, it's due to me.

SH-4 has virtually indexed and physically tagged cache, which has
alias problem to be handled by kernel. When process exits, we need to
flush the caches used by the process. If we don't do flush here,
something wrong will be happened later, because of cache aliases, when
the pages will be reused. The page will be polluted by old cache data
in unrelated way.

I don't know if TLB flush is needed, but every code has TLB flush, it
is added.

--- linux-2.4.0-test5-pre3/mm/mmap.c Thu Jul 20 14:59:44 2000
+++ linux/mm/mmap.c Thu Jul 20 14:37:42 2000
@@ -864,7 +864,9 @@
}
mm->map_count--;
remove_shared_vm_struct(mpnt);
+ flush_cache_range(mm, start, end);
zap_page_range(mm, start, size);
+ flush_tlb_range(mm, start, end);
if (mpnt->vm_file)
fput(mpnt->vm_file);
kmem_cache_free(vm_area_cachep, mpnt);

    --

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

- Next message: Nathan Simons: "knfsd oops (2.4.0-test1) and tulip weirdness"
- Previous message: Keith Owens: "Re: Cache coherency... and locking"