From: William Lee Irwin III <wli@holomorphy.com>
To: "Martin J. Bligh" <mbligh@aracnet.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
akpm@digeo.com, plars@linuxtestproject.org
Subject: Re: [Bug 601] New: BUG when running ipcs after huge page shm
Date: Fri, 18 Apr 2003 16:14:22 -0700 [thread overview]
Message-ID: <20030418231422.GC12469@holomorphy.com> (raw)
In-Reply-To: <1382570000.1050698909@flay>
On Fri, Apr 18, 2003 at 01:48:29PM -0700, Martin J. Bligh wrote:
> http://bugme.osdl.org/show_bug.cgi?id=601
> Summary: BUG when running ipcs after huge page shm
> Kernel Version: 2.5.67-bk current
> Status: NEW
> Severity: normal
> Owner: akpm@digeo.com
> Submitter: plars@austin.ibm.com
Trivial. We must remember to check for hugetlb in shm_get_stat().
-- wli
diff -urpN linux-2.5.67-bk9/ipc/shm.c shmstat-2.5.67-bk9-2/ipc/shm.c
--- linux-2.5.67-bk9/ipc/shm.c 2003-04-07 10:31:20.000000000 -0700
+++ shmstat-2.5.67-bk9-2/ipc/shm.c 2003-04-18 15:53:38.000000000 -0700
@@ -361,27 +361,35 @@ static inline unsigned long copy_shminfo
}
}
-static void shm_get_stat (unsigned long *rss, unsigned long *swp)
+static void shm_get_stat(unsigned long *rss, unsigned long *swp)
{
- struct shmem_inode_info *info;
int i;
*rss = 0;
*swp = 0;
- for(i = 0; i <= shm_ids.max_id; i++) {
- struct shmid_kernel* shp;
- struct inode * inode;
+ for (i = 0; i <= shm_ids.max_id; i++) {
+ struct shmid_kernel *shp;
+ struct inode *inode;
shp = shm_get(i);
- if(shp == NULL)
+ if(!shp)
continue;
+
inode = shp->shm_file->f_dentry->d_inode;
- info = SHMEM_I(inode);
- spin_lock (&info->lock);
- *rss += inode->i_mapping->nrpages;
- *swp += info->swapped;
- spin_unlock (&info->lock);
+
+ if (is_file_hugepages(shp->shm_file)) {
+ struct address_space *mapping = inode->i_mapping;
+ spin_lock(&mapping->page_lock);
+ *rss += (HPAGE_SIZE/PAGE_SIZE)*mapping->nrpages;
+ spin_unlock(&mapping->page_lock);
+ } else {
+ struct shmem_inode_info *info = SHMEM_I(inode);
+ spin_lock(&info->lock);
+ *rss += inode->i_mapping->nrpages;
+ *swp += info->swapped;
+ spin_unlock(&info->lock);
+ }
}
}
prev parent reply other threads:[~2003-04-18 23:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-18 20:48 [Bug 601] New: BUG when running ipcs after huge page shm Martin J. Bligh
2003-04-18 23:14 ` William Lee Irwin III [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030418231422.GC12469@holomorphy.com \
--to=wli@holomorphy.com \
--cc=akpm@digeo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@aracnet.com \
--cc=plars@linuxtestproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.