patch-2.4.0-test9 linux/ipc/shm.c
Next file: linux/kernel/exit.c
Previous file: linux/init/version.c
Back to the patch index
Back to the overall index
- Lines: 78
- Date:
Mon Sep 25 08:59:38 2000
- Orig file:
v2.4.0-test8/linux/ipc/shm.c
- Orig date:
Thu Sep 7 08:34:28 2000
diff -u --recursive --new-file v2.4.0-test8/linux/ipc/shm.c linux/ipc/shm.c
@@ -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;
@@ -1522,7 +1521,7 @@
}
/*
- * Goes through counter = (shm_rss / (prio + 1)) present shm pages.
+ * Goes through counter = (shm_rss >> prio) present shm pages.
*/
static unsigned long swap_id; /* currently being swapped */
static unsigned long swap_idx; /* next to swap */
@@ -1536,8 +1535,14 @@
int counter;
struct page * page_map;
+ /*
+ * Push this inside:
+ */
+ if (!(gfp_mask & __GFP_IO))
+ return 0;
+
zshm_swap(prio, gfp_mask);
- counter = shm_rss / (prio + 1);
+ counter = shm_rss >> prio;
if (!counter)
return 0;
if (shm_swap_preop(&swap_entry))
@@ -1863,7 +1868,7 @@
int counter;
struct page * page_map;
- counter = zshm_rss / (prio + 1);
+ counter = zshm_rss >> prio;
if (!counter)
return;
next:
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)