diff options
author | Jan Beulich <jbeulich@novell.com> | 2008-12-16 06:35:24 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-12-16 12:34:51 -0500 |
commit | 1796316a8b028a148be48ba5d4e7be493a39d173 (patch) | |
tree | 628848bb98909632bbb503b1db27c2a6db9291e6 /mm | |
parent | 9470565579f29486f4ed0ffa50774268b64994b0 (diff) |
x86: consolidate __swp_XXX() macros
Impact: cleanup, code robustization
The __swp_...() macros silently relied upon which bits are used for
_PAGE_FILE and _PAGE_PROTNONE. After having changed _PAGE_PROTNONE in
our Xen kernel to no longer overlap _PAGE_PAT, live locks and crashes
were reported that could have been avoided if these macros properly
used the symbolic constants. Since, as pointed out earlier, for Xen
Dom0 support mainline likewise will need to eliminate the conflict
between _PAGE_PAT and _PAGE_PROTNONE, this patch does all the necessary
adjustments, plus it introduces a mechanism to check consistency
between MAX_SWAPFILES_SHIFT and the actual encoding macros.
This also fixes a latent bug in that x86-64 used a 6-bit mask in
__swp_type(), and if MAX_SWAPFILES_SHIFT was increased beyond 5 in (the
seemingly unrelated) linux/swap.h, this would have resulted in a
collision with _PAGE_FILE.
Non-PAE 32-bit code gets similarly adjusted for its pte_to_pgoff() and
pgoff_to_pte() calculations.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/swapfile.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c index 90cb67a5417c..54a9f87e5162 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -1462,6 +1462,15 @@ static int __init procswaps_init(void) | |||
1462 | __initcall(procswaps_init); | 1462 | __initcall(procswaps_init); |
1463 | #endif /* CONFIG_PROC_FS */ | 1463 | #endif /* CONFIG_PROC_FS */ |
1464 | 1464 | ||
1465 | #ifdef MAX_SWAPFILES_CHECK | ||
1466 | static int __init max_swapfiles_check(void) | ||
1467 | { | ||
1468 | MAX_SWAPFILES_CHECK(); | ||
1469 | return 0; | ||
1470 | } | ||
1471 | late_initcall(max_swapfiles_check); | ||
1472 | #endif | ||
1473 | |||
1465 | /* | 1474 | /* |
1466 | * Written 01/25/92 by Simmule Turner, heavily changed by Linus. | 1475 | * Written 01/25/92 by Simmule Turner, heavily changed by Linus. |
1467 | * | 1476 | * |