lkml.org 
[lkml]   [2000]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: problem with 2.4.0-test9-pre6 seems to be SHM
From
Date
David Ford <david@kalifornia.com> writes:

> Very correct except for one thing, allocation fails and ipcs -u
> shows 4097 when the limit shows 4096. safemode reports that
> eventually the kernel crashes. This may be due to the test9
> 'features' and a side affect, or it may be something to keep in mind
> once we get things nailed down a bit.

Oh, yes that's a off by one error in the statistics. (I hate the
/dev/zero stuff...) There was also some incorrect double
accounting. The appended patch fixes this. Linus please apply. It
fixes obvious bugs.

Greetings
Christoph

--- linux/ipc/shm.c.orig Mon Sep 25 10:16:50 2000
+++ linux/ipc/shm.c Mon Sep 25 10:28:40 2000
@@ -206,7 +206,6 @@
/* some statistics */
static ulong swap_attempts;
static ulong swap_successes;
-static ulong used_segs;

void __init shm_init (void)
{
@@ -364,7 +363,9 @@
buf->f_blocks = shm_ctlall;
buf->f_bavail = buf->f_bfree = shm_ctlall - shm_tot;
buf->f_files = shm_ctlmni;
- buf->f_ffree = shm_ctlmni - used_segs;
+ shm_lockall();
+ buf->f_ffree = shm_ctlmni - shm_ids.in_use + 1;
+ shm_unlockall();
buf->f_namelen = SHM_NAME_LEN;
return 0;
}
@@ -593,7 +594,6 @@
if (doacc) {
shm_lockall();
shm_tot += pages;
- used_segs++;
shm_unlockall();
}
return ret;
@@ -646,7 +646,6 @@
shm_rss -= rss;
shm_swp -= swp;
shm_tot -= pages;
- used_segs--;
shm_unlockall();
}
}
@@ -970,7 +969,7 @@

memset(&shm_info,0,sizeof(shm_info));
shm_lockall();
- shm_info.used_ids = shm_ids.in_use;
+ shm_info.used_ids = shm_ids.in_use - 1; /* correct the /dev/zero hack */
shm_info.shm_rss = shm_rss;
shm_info.shm_tot = shm_tot;
shm_info.shm_swp = shm_swp;
\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.142 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site