Bug 119820
Summary: | Mapping more than 4096 pages using map_user_kiobuf fails | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 3 | Reporter: | Stuart Mills <smills> |
Component: | kernel | Assignee: | Dave Anderson <anderson> |
Status: | CLOSED NOTABUG | QA Contact: | Brian Brock <bbrock> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 3.0 | CC: | petrides, riel |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i686 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2004-04-07 20:29:54 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Stuart Mills
2004-04-02 13:01:25 UTC
can you provide a pointer to the source of the driver ? The problem was experienced in a driver I've written. Below is the function causing the problem: int map_write_buffer(struct net_device *dev, struct kiobuf **iobuf, void *buffer, size_t buffersize) { int result = 0; result = alloc_kiovec(1, iobuf); if (result != 0) { ERRORMSG("Could not allocate memory for the mapping of user memory to kernel memory, result = %d\n", result); return result; } result = map_user_kiobuf(WRITE, *iobuf, (unsigned long)buffer, buffersize); if (result != 0) { ERRORMSG("Could not map user memory to kernel memory, result = %d\n", result); free_kiovec(1, iobuf); *iobuf = NULL; } return result; } What appears to be happening is this: map_user_kiobuf() is calling expand_kiobuf() with the request page count: err = expand_kiobuf(iobuf, pgcount); if (err) return err; expand_kiobuf() is calling kmalloc() like so: blocks = kmalloc(wanted * SECTORS_PER_PAGE * sizeof(unsigned long), GFP_KERNEL); if (unlikely(!blocks)) { kfree(maplist); return -ENOMEM; } and returning ENOMEM (-12). Given a page count of 4096, SECTORS_PER_PAGE of 8 (512*8) and long size of 4, the request would be 128K. If the system has 128K of *contiguous* memory available, then the request will return OK. If not, and the defragmentation of kernel memory cannot create a 128K contigous chunk, the call will fail. However, given that the largest RHEL3 slab cache size is the "size-131072" slab, any attempt to kmalloc more than 4096 pages is guaranteed to fail. It probably works OK in non-RHEL3 kernels because the kmalloc() of the "blocks" is not done up-front. I'm unfamiliar with this area of code, but the change to make the blocks allocation done up-front in expand_kiobuf() is in: linux-2.4.21-kiobuf-fixes.patch Perhaps somebody familiar with this patch can explain the change? In any case, there's no way a kmalloc() greater than 128K can be done. |