linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] swapin flush cache bug
@ 2001-02-12 23:21 Marcelo Tosatti
  2001-02-13  9:50 ` Russell King
  2001-02-13 10:53 ` NIIBE Yutaka
  0 siblings, 2 replies; 23+ messages in thread
From: Marcelo Tosatti @ 2001-02-12 23:21 UTC (permalink / raw)
  To: Linus Torvalds, Alan Cox; +Cc: NIIBE Yutaka, lkml


Hi,

Niibe Yutaka noted (and added an entry on the MM bugzilla system) that
cache flushing on do_swap_page() is buggy. Here: 

---
        struct page *page = lookup_swap_cache(entry);
        pte_t pte;

        if (!page) {
                lock_kernel();
                swapin_readahead(entry);
                page = read_swap_cache(entry);
                unlock_kernel();
                if (!page)
                        return -1;

                flush_page_to_ram(page);
                flush_icache_page(vma, page);
        }

        mm->rss++;
--

If lookup_swap_cache() finds a page in the swap cache, and that page was
in memory because of the swapin readahead, the cache is not flushed.

Here is a patch to fix the problem by always flushing the cache including
for pages in the swap cache:

--- linux.orig/mm/memory.c.orig       Thu Feb  8 10:52:20 2001
+++ linux/mm/memory.c    Thu Feb  8 10:54:07 2001
@@ -1033,12 +1033,12 @@
                unlock_kernel();
                if (!page)
                        return -1;
-
-               flush_page_to_ram(page);
-               flush_icache_page(vma, page);
        }
 
        mm->rss++;
+
+       flush_page_to_ram(page);
+       flush_icache_page(vma, page);
 
        pte = mk_pte(page, vma->vm_page_prot);




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

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

end of thread, other threads:[~2001-07-03  0:05 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-12 23:21 [PATCH] swapin flush cache bug Marcelo Tosatti
2001-02-13  9:50 ` Russell King
2001-02-13 10:53 ` NIIBE Yutaka
2001-02-13 11:16   ` Russell King
2001-02-13 11:26   ` Alan Cox
2001-02-13 23:50   ` NIIBE Yutaka
2001-02-14  2:08   ` NIIBE Yutaka
2001-02-14 10:12     ` Marcelo Tosatti
2001-06-27  0:51     ` NIIBE Yutaka
2001-06-27 10:11       ` Marcelo Tosatti
2001-06-28  0:42         ` David S. Miller
2001-06-28  0:07       ` NIIBE Yutaka
2001-06-27 22:41         ` Marcelo Tosatti
2001-06-28  0:23         ` Stephen C. Tweedie
2001-06-28  0:47           ` David S. Miller
2001-06-28  1:10             ` David S. Miller
2001-06-29 14:18             ` NIIBE Yutaka
2001-07-02 22:47               ` Cache issues David S. Miller
2001-06-28  0:41         ` [PATCH] swapin flush cache bug NIIBE Yutaka
2001-06-28  1:04           ` NIIBE Yutaka
2001-07-02 11:23             ` Cache issues NIIBE Yutaka
2001-07-03  0:04               ` NIIBE Yutaka
2001-06-28  0:46         ` [PATCH] swapin flush cache bug 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;
as well as URLs for NNTP newsgroup(s).