Bug 113522
| Summary: | Bigpages and sshd crash | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 2.1 | Reporter: | Dave Anderson <anderson> | ||||
| Component: | kernel | Assignee: | Dave Anderson <anderson> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Brian Brock <bbrock> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | 2.1 | CC: | jbaron, kambiz, riel, tburke | ||||
| 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: | 2005-09-28 16:13:56 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: | |||||||
| Attachments: |
|
||||||
|
Description
Dave Anderson
2004-01-14 21:55:19 UTC
The following patch has been sent to Oracle for verification. For
shared anonymous memory map requests, it validates the request for
bigpage usage first via shmem_make_bigpage_mmap(), before allowing
shm_enable_bigpages() to be called:
--- linux/mm/shmem.c.orig Tue Jan 13 15:16:21 2004
+++ linux/mm/shmem.c Tue Jan 13 15:48:12 2004
@@ -52,6 +52,7 @@
atomic_t shmem_nrpages = ATOMIC_INIT(0);
int shm_use_bigpages;
+#define MAX_BIGPAGES (16384)
#define BLOCKS_PER_PAGE (PAGE_CACHE_SIZE/512)
@@ -828,8 +829,9 @@
int shmem_make_bigpage_mmap(struct file * file, struct vm_area_struct
* vma)
{
struct inode *inode = file->f_dentry->d_inode;
- unsigned long pages;
+ unsigned long pages, max_bigpages;
shmem_info_t *info;
+ struct shmem_sb_info *sbinfo;
int bigpage;
/*
@@ -858,7 +860,11 @@
pages = (vma->vm_end - vma->vm_start) / PAGE_SIZE + vma->vm_pgoff;
pages >>= (BIGPAGE_SHIFT - PAGE_SHIFT);
- if (pages > info->max_bigpages)
+ sbinfo = SHMEM_SB(inode->i_sb);
+ max_bigpages = sbinfo->max_blocks >> (BIGPAGE_SHIFT -
PAGE_CACHE_SHIFT);
+ if (max_bigpages > MAX_BIGPAGES)
+ max_bigpages = MAX_BIGPAGES;
+ if (pages > max_bigpages)
return -ENOSPC;
vma->vm_flags |= VM_LOCKED;
@@ -1587,9 +1592,9 @@
}
/*
- * Limit kmalloc() size to a max of 64K. This covers 32 GB 2MB pages.
+ * MAX_BIGPAGES (16384) limits the kmalloc() size to a max of 64K.
+ * This covers 32 GB 2MB pages.
*/
-#define MAX_BIGPAGES (16384)
void shm_enable_bigpages(struct inode *inode, struct file *filp,
size_t size, int prealloc)
{
@@ -1823,12 +1828,18 @@
{
struct file *file;
loff_t size = vma->vm_end - vma->vm_start;
+ unsigned long vm_flags = vma->vm_flags;
+ int error;
file = shmem_file_setup("dev/zero", size);
if (IS_ERR(file))
return PTR_ERR(file);
- if (shm_use_bigpages)
+ if (shm_use_bigpages && !(error = shmem_make_bigpage_mmap(file, vma))
+ && (vma->vm_flags & VM_BIGPAGE)) {
shm_enable_bigpages(file->f_dentry->d_inode, file, BIGPAGE_SIZE, 0);
+ if (!I_BIGPAGE(file->f_dentry->d_inode))
+ vma->vm_flags = vm_flags;
+ }
if (vma->vm_file)
fput (vma->vm_file);
Patch was accepted/tested at Oracle. Created attachment 97103 [details]
downloadable version of posted patch
|