Skip to contentSkip to conversation

tmpfs accounting cleanup for -ac series

PATCH New Christoph Rohland 1 participant 1 message May 17, 2001

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tmpfs accounting cleanup for -ac series

Hi Alan,

While looking at the -ac version of ramfs I noticed that there is a new address operation introduced which I can use to cleanup shmem.

This patch throws away some magic recalculation and makes the accounting of shmem accurate.

It also encapsulates all accesses to the superblock_info into a macro.

The patch is on top of my previous ones.

Greetings
Christoph

fs/proc/proc_misc.c +2 -10
diff -uNr 4-ac9/fs/proc/proc_misc.c c/fs/proc/proc_misc.c
@@ -140,17 +140,9 @@
 {
 	struct sysinfo i;
 	int len;
-	unsigned int cached, shmem;
+	unsigned int cached;
 
-	/*
-	 * There may be some inconsistency because shmem_nrpages
-	 * update is delayed to page_cache_size
-	 * We make sure the cached value does not get below zero 
-	 */
-	cached = atomic_read(&page_cache_size);
-	shmem  = atomic_read(&shmem_nrpages);
-	if (shmem < cached)
-		cached -= shmem;
+	cached = atomic_read(&page_cache_size) - atomic_read(&shmem_nrpages);
 
 /*
  * display in kilobytes.
mm/mmap.c +2 -12
diff -uNr 4-ac9/mm/mmap.c c/mm/mmap.c
@@ -56,24 +56,14 @@
 	 */
 
 	long free;
-	unsigned long cached, shmem;
-
-	/*
-	 * There may be some inconsistency because shmem_nrpages
-	 * update is delayed to the page_cache_size
-	 * We make sure the cached value does not get below zero 
-	 */
-	cached = atomic_read(&page_cache_size);
-	shmem  = atomic_read(&shmem_nrpages);
-	if (cached > shmem)
-		cached -= shmem;
 
         /* Sometimes we want to use more memory than we have. */
 	if (sysctl_overcommit_memory)
 	    return 1;
 
 	free = atomic_read(&buffermem_pages);
-	free += cached;
+	free += atomic_read(&page_cache_size) ;
+	free -= atomic_read(&shmem_nrpages);
 	free += nr_free_pages();
 	free += nr_swap_pages;
 
mm/shmem.c +62 -77

261 lines not on this page · raw message