Messages in this thread Patch in this message | | | Date | Tue, 6 Jun 2006 18:59:12 +0100 (BST) | From | Hugh Dickins <> | Subject | Re: 2.6.17-rc5-mm1 |
| |
On Tue, 6 Jun 2006, Christoph Lameter wrote: > > Would it not be better for an arch to explicitly tell us how many swap > devices are supported? Then we could make the swap_info array shorter and > get rid of this cryptic test.
If they differed at all, yes.
> This test also creates a problem for the migration entries: It is really > not clear until runtime how many swap devices are supported so we cannot > take the last 2 for page migration. In order for page migration to work > all NUMA arches that do not support 32 swap devices need to define > CONFIG_MIGRATION=n. Seems that this is only s390?
Even s390 is okay, isn't it? MartinS's swp_type returns the highest type, 31, corresponding to 32 types, as on every other architecture. You and I and Martin Bligh would prefer this patch...
Remove unnecessary obfuscation from sys_swapon's range check on swap type, which blew up causing memory corruption once swapless migration made MAX_SWAPFILES no longer 2 ^ MAX_SWAPFILES_SHIFT.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
--- 2.6.17-rc5-mm3/mm/swapfile.c 2006-06-04 11:52:47.000000000 +0100 +++ linux/mm/swapfile.c 2006-06-06 18:53:40.000000000 +0100 @@ -1404,7 +1404,7 @@ asmlinkage long sys_swapon(const char __ * from the initial ~0UL that can't be encoded in either the * swp_entry_t or the architecture definition of a swap pte. */ - if (type > swp_type(pte_to_swp_entry(swp_entry_to_pte(swp_entry(~0UL,0))))) { + if (type >= MAX_SWAPFILES) { spin_unlock(&swap_lock); goto out; } - 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://www.tux.org/lkml/
| |