Bug 191266 - Can't swapon huge swap partitions
Summary: Can't swapon huge swap partitions
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel
Version: 4.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Larry Woodman
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks: 176344
TreeView+ depends on / blocked
 
Reported: 2006-05-10 11:00 UTC by Bastien Nocera
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-12-12 15:54:31 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Bastien Nocera 2006-05-10 11:00:32 UTC
1. Create a swap partition > 128GB
2. Run mkswap on the partition
3. Run swapon with that partition

strace shows:
swapon("/dev/cciss/c0d0p1")             = -1 ENOMEM (Cannot allocate memory)

kernel-2.6.9-34.EL

Comment 1 Larry Woodman 2006-07-28 17:35:11 UTC
Can you retry this with the latest RHEL4 kernel?  I added a patch to "make
vmalloc() succeed for larger memory allocations" in kernel-2.6.9-34.4.EL ant
that is why the swapon is failing.

Larry Woodman


Comment 2 Larry Woodman 2006-10-16 15:51:40 UTC
This BZ can be closed.  The problem was that sys_swapon () called vmalloc()
which failed due to kernel memory fragmentation, because it called kmalloc() for
the page_array.  I changed __vmalloc() to recursively call vmalloc() when the
page_array is larger than 1 page and this no longer fails.

Larry Woodman


Comment 5 Larry Woodman 2006-12-12 15:54:31 UTC
Verified that this was fixed after kernel-2.6.9-34.EL

-------------------------------------------------------------------------------
* Thu Mar 16 2006 Jason Baron <jbaron> [2.6.9-34.4]
-make vmalloc() succeed for larger memory allocations (Larry Woodman) [173193]
-------------------------------------------------------------------------------
@@ -429,7 +432,11 @@ void *__vmalloc(unsigned long size, int
        array_size = (nr_pages * sizeof(struct page *));
                                                                               
                                
        area->nr_pages = nr_pages;
-       area->pages = pages = kmalloc(array_size, (gfp_mask & ~__GFP_HIGHMEM));
+       if (array_size > PAGE_SIZE)
+               pages = __vmalloc(array_size, gfp_mask, PAGE_KERNEL);
+       else
+               pages = kmalloc(array_size, (gfp_mask & ~__GFP_HIGHMEM));
+       area->pages = pages;
        if (!area->pages) {
                remove_vm_area(area->addr);
                kfree(area);
--------------------------------------------------------------------------------

Larry Woodman



Note You need to log in before you can comment on or make changes to this bug.