* [PATCH] Fix for 2.6.5/2.6.6 Swap issue
@ 2004-05-27 18:39 Kumba
0 siblings, 0 replies; only message in thread
From: Kumba @ 2004-05-27 18:39 UTC (permalink / raw)
To: linux-mips; +Cc: Ralf Baechle
[-- Attachment #1: Type: text/plain, Size: 543 bytes --]
Peter Horton wrote this patch up several weeks ago for Cobalt, but it's
applicable for all MIPS machines I've seen thus far (atleast SGI and
Cobalt). It fixes the kernel panic resulting from trying to activate
swap on a system running 2.6.5 and up. It's been in Gentoo's
mips-sources for quite some time, and I've had no problems with it on my
O2 or Cobalt.
--Kumba
--
"Such is oft the course of deeds that move the wheels of the world:
small hands do them because they must, while the eyes of the great are
elsewhere." --Elrond
[-- Attachment #2: mipscvs-2.6.5-swapbug-fix.patch --]
[-- Type: text/plain, Size: 1329 bytes --]
diff -urN include/asm-mips/pgtable-32.h include/asm-mips/pgtable-32.h
--- include/asm-mips/pgtable-32.h 2004-03-11 16:46:57.000000000 +0000
+++ include/asm-mips/pgtable-32.h 2004-04-17 09:06:02.000000000 +0100
@@ -203,14 +203,18 @@
/* Swap entries must have VALID and GLOBAL bits cleared. */
#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
-#define __swp_type(x) (((x).val >> 1) & 0x7f)
-#define __swp_offset(x) ((x).val >> 10)
-#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 10) })
+/* offset is limited to 17 bits (512MB @ 4K page) */
+/* VALID & GLOBAL are bits 9 & 8 */
+#define __swp_type(x) (((x).val >> 10) & 0x1f)
+#define __swp_offset(x) ((x).val >> 15)
+#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 10) | ((offset) << 15) })
#else
-#define __swp_type(x) (((x).val >> 1) & 0x1f)
-#define __swp_offset(x) ((x).val >> 8)
-#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 8) })
+/* offset is limited to 19 bits (2GB @ 4K page) */
+/* VALID & GLOBAL are bits 7 & 6 */
+#define __swp_type(x) (((x).val >> 8) & 0x1f)
+#define __swp_offset(x) ((x).val >> 13)
+#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 8) | ((offset) << 13) })
#endif
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-05-27 18:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-27 18:39 [PATCH] Fix for 2.6.5/2.6.6 Swap issue Kumba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox