public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Bug 601] New: BUG when running ipcs after huge page shm
@ 2003-04-18 20:48 Martin J. Bligh
  2003-04-18 23:14 ` William Lee Irwin III
  0 siblings, 1 reply; 2+ messages in thread
From: Martin J. Bligh @ 2003-04-18 20:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Bill Irwin

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


Distribution:
Hardware Environment: 2-way PIII-550, 2GB ram
Software Environment:
CONFIG_HUGETLB_PAGE=y

Problem Description:

kernel BUG at include/asm/spinlock.h:123!
invalid operand: 0000 [#1]
CPU:    0
EIP:    0060:[<c02055ad>]    Not tainted
EFLAGS: 00010286
EIP is at shm_get_stat+0x5d/0xbc
eax: 0000000e   ebx: f772e14c   ecx: c04a1be0   edx: c0411d88
esi: f772e1b0   edi: 00000000   ebp: f747df38   esp: f747dde4
ds: 007b   es: 007b   ss: 0068
Process ipcs (pid: 778, threadinfo=f747c000 task=f762e100)
Stack: c03a9ab7 c0205595 f747df2c bffff620 f747df44 c050bfb0 c0205801 f747df34
       f747df38 bffff5bc 0000000e 00000000 00000000 00000000 00000000 00000000
       00000001 00000001 00000019 00000000 00000000 c0512bc0 f7c181cc f7c181bc
Call Trace:
 [<c0205595>] shm_get_stat+0x45/0xbc
 [<c0205801>] sys_shmctl+0x1f5/0x820
 [<c013a1e0>] check_poison_obj+0x38/0x188
 [<c013baa6>] kmem_cache_alloc+0x126/0x134
 [<c01483b2>] page_add_rmap+0x12/0x158
 [<c0143e26>] do_no_page+0x47a/0x488
 [<c014401d>] handle_mm_fault+0x105/0x220
 [<c01168b0>] do_page_fault+0x120/0x45d
 [<c0116790>] do_page_fault+0x0/0x45d
 [<c0215ef1>] tty_write+0x33d/0x378
 [<c021b298>] write_chan+0x0/0x20c
 [<c010f918>] sys_ipc+0x1d4/0x1ec
 [<c0109a2d>] error_code+0x2d/0x38
 [<c0108fa3>] syscall_call+0x7/0xb

Code: 0f 0b 7b 00 a0 9a 3a c0 83 c4 08 f0 fe 0b 0f 88 04 0d 00 00

Steps to reproduce:
echo 10 > /proc/sys/vm/nr_hugepages
ran a quick test program that used shm to allocate 8MB with SHM_HUGETLB
run the 'ipcs' command


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Bug 601] New: BUG when running ipcs after huge page shm
  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
  0 siblings, 0 replies; 2+ messages in thread
From: William Lee Irwin III @ 2003-04-18 23:14 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: linux-kernel, akpm, plars

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);
+		}
 	}
 }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-04-18 23:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox