diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2009-02-23 14:05:56 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2009-02-23 14:05:56 -0800 |
commit | dc731ca60954310be0993e8992d450c7089fd13d (patch) | |
tree | 6a997916f963d9e6dfa76fc5564296f57c3f909e /ipc/shm.c | |
parent | ec5b3d32437571b8a742069a4cfd04edb6b6eda5 (diff) | |
parent | 20f4d6c3a2a23c5d7d9cc7f42fbb943ca7a03d1f (diff) |
Merge branch 'x86/urgent' into x86/mce2
Diffstat (limited to 'ipc/shm.c')
-rw-r--r-- | ipc/shm.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ipc/shm.c b/ipc/shm.c index c0a021f7f41..05d51d2a792 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -340,6 +340,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) struct file * file; char name[13]; int id; + int acctflag = 0; if (size < SHMMIN || size > ns->shm_ctlmax) return -EINVAL; @@ -364,11 +365,12 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) sprintf (name, "SYSV%08x", key); if (shmflg & SHM_HUGETLB) { - /* hugetlb_file_setup takes care of mlock user accounting */ - file = hugetlb_file_setup(name, size); + /* hugetlb_file_setup applies strict accounting */ + if (shmflg & SHM_NORESERVE) + acctflag = VM_NORESERVE; + file = hugetlb_file_setup(name, size, acctflag); shp->mlock_user = current_user(); } else { - int acctflag = 0; /* * Do not allow no accounting for OVERCOMMIT_NEVER, even * if it's asked for. @@ -565,11 +567,15 @@ static void shm_get_stat(struct ipc_namespace *ns, unsigned long *rss, struct hstate *h = hstate_file(shp->shm_file); *rss += pages_per_huge_page(h) * mapping->nrpages; } else { +#ifdef CONFIG_SHMEM struct shmem_inode_info *info = SHMEM_I(inode); spin_lock(&info->lock); *rss += inode->i_mapping->nrpages; *swp += info->swapped; spin_unlock(&info->lock); +#else + *rss += inode->i_mapping->nrpages; +#endif } total++; |