Bug 191266 - Can't swapon huge swap partitions
Can't swapon huge swap partitions
Status: CLOSED NEXTRELEASE
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel (Show other bugs)
4.0
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Larry Woodman
Brian Brock
:
Depends On:
Blocks: 176344
  Show dependency treegraph
 
Reported: 2006-05-10 07:00 EDT by Bastien Nocera
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-12-12 10:54:31 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Bastien Nocera 2006-05-10 07:00:32 EDT
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 13:35:11 EDT
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 11:51:40 EDT
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 10:54:31 EST
Verified that this was fixed after kernel-2.6.9-34.EL

-------------------------------------------------------------------------------
* Thu Mar 16 2006 Jason Baron <jbaron@redhat.com> [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.