diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2009-02-23 17:05:56 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2009-02-23 17:05:56 -0500 |
commit | dc731ca60954310be0993e8992d450c7089fd13d (patch) | |
tree | 6a997916f963d9e6dfa76fc5564296f57c3f909e /ipc | |
parent | ec5b3d32437571b8a742069a4cfd04edb6b6eda5 (diff) | |
parent | 20f4d6c3a2a23c5d7d9cc7f42fbb943ca7a03d1f (diff) |
Merge branch 'x86/urgent' into x86/mce2
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/shm.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -340,6 +340,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) | |||
340 | struct file * file; | 340 | struct file * file; |
341 | char name[13]; | 341 | char name[13]; |
342 | int id; | 342 | int id; |
343 | int acctflag = 0; | ||
343 | 344 | ||
344 | if (size < SHMMIN || size > ns->shm_ctlmax) | 345 | if (size < SHMMIN || size > ns->shm_ctlmax) |
345 | return -EINVAL; | 346 | return -EINVAL; |
@@ -364,11 +365,12 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) | |||
364 | 365 | ||
365 | sprintf (name, "SYSV%08x", key); | 366 | sprintf (name, "SYSV%08x", key); |
366 | if (shmflg & SHM_HUGETLB) { | 367 | if (shmflg & SHM_HUGETLB) { |
367 | /* hugetlb_file_setup takes care of mlock user accounting */ | 368 | /* hugetlb_file_setup applies strict accounting */ |
368 | file = hugetlb_file_setup(name, size); | 369 | if (shmflg & SHM_NORESERVE) |
370 | acctflag = VM_NORESERVE; | ||
371 | file = hugetlb_file_setup(name, size, acctflag); | ||
369 | shp->mlock_user = current_user(); | 372 | shp->mlock_user = current_user(); |
370 | } else { | 373 | } else { |
371 | int acctflag = 0; | ||
372 | /* | 374 | /* |
373 | * Do not allow no accounting for OVERCOMMIT_NEVER, even | 375 | * Do not allow no accounting for OVERCOMMIT_NEVER, even |
374 | * if it's asked for. | 376 | * if it's asked for. |
@@ -565,11 +567,15 @@ static void shm_get_stat(struct ipc_namespace *ns, unsigned long *rss, | |||
565 | struct hstate *h = hstate_file(shp->shm_file); | 567 | struct hstate *h = hstate_file(shp->shm_file); |
566 | *rss += pages_per_huge_page(h) * mapping->nrpages; | 568 | *rss += pages_per_huge_page(h) * mapping->nrpages; |
567 | } else { | 569 | } else { |
570 | #ifdef CONFIG_SHMEM | ||
568 | struct shmem_inode_info *info = SHMEM_I(inode); | 571 | struct shmem_inode_info *info = SHMEM_I(inode); |
569 | spin_lock(&info->lock); | 572 | spin_lock(&info->lock); |
570 | *rss += inode->i_mapping->nrpages; | 573 | *rss += inode->i_mapping->nrpages; |
571 | *swp += info->swapped; | 574 | *swp += info->swapped; |
572 | spin_unlock(&info->lock); | 575 | spin_unlock(&info->lock); |
576 | #else | ||
577 | *rss += inode->i_mapping->nrpages; | ||
578 | #endif | ||
573 | } | 579 | } |
574 | 580 | ||
575 | total++; | 581 | total++; |