patch-2.4.1 linux/kernel/fork.c

Next file: linux/kernel/ksyms.c
Previous file: linux/kernel/context.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0/linux/kernel/fork.c linux/kernel/fork.c
@@ -134,7 +134,6 @@
 	mm->mmap_cache = NULL;
 	mm->map_count = 0;
 	mm->cpu_vm_mask = 0;
-	mm->swap_cnt = 0;
 	mm->swap_address = 0;
 	pprev = &mm->mmap;
 	for (mpnt = current->mm->mmap ; mpnt ; mpnt = mpnt->vm_next) {
@@ -193,6 +192,7 @@
 }
 
 spinlock_t mmlist_lock __cacheline_aligned = SPIN_LOCK_UNLOCKED;
+int mmlist_nr;
 
 #define allocate_mm()	(kmem_cache_alloc(mm_cachep, SLAB_KERNEL))
 #define free_mm(mm)	(kmem_cache_free(mm_cachep, (mm)))
@@ -246,6 +246,7 @@
 {
 	if (atomic_dec_and_lock(&mm->mm_users, &mmlist_lock)) {
 		list_del(&mm->mmlist);
+		mmlist_nr--;
 		spin_unlock(&mmlist_lock);
 		exit_mmap(mm);
 		mmdrop(mm);
@@ -326,6 +327,7 @@
 	 */
 	spin_lock(&mmlist_lock);
 	list_add(&mm->mmlist, &oldmm->mmlist);
+	mmlist_nr++;
 	spin_unlock(&mmlist_lock);
 
 	if (retval)
@@ -445,7 +447,7 @@
 	if (size > __FD_SETSIZE) {
 		newf->max_fdset = 0;
 		write_lock(&newf->file_lock);
-		error = expand_fdset(newf, size);
+		error = expand_fdset(newf, size-1);
 		write_unlock(&newf->file_lock);
 		if (error)
 			goto out_release;
@@ -464,7 +466,7 @@
 		read_unlock(&oldf->file_lock);
 		newf->max_fds = 0;
 		write_lock(&newf->file_lock);
-		error = expand_fd_array(newf, open_files);
+		error = expand_fd_array(newf, open_files-1);
 		write_unlock(&newf->file_lock);
 		if (error) 
 			goto out_release;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)