small unclean speedup to fork()

Ingo Molnar (mingo@pc5829.hil.siemens.at)
Mon, 11 Nov 1996 20:26:17 +0100 (MET)


This small patch avoids 256 byte memory zeroing per fork() on the i386
architecture.

Since i dont know how to fit it into the multiarchitecture memory
management system properly, i just throw in this patch, maybe someone
can make a clean patch out of it? ....

------------------------------------------------------------>
--- linux-2.1.8.orig/mm/memory.c Mon Oct 28 13:21:41 1996
+++ linux-2.1.8_private/mm/memory.c Mon Nov 11 19:56:07 1996
@@ -167,8 +167,13 @@
{
pgd_t * page_dir, * new_pg;

- if (!(new_pg = pgd_alloc()))
+ if (!(new_pg = (pgd_t *) __get_free_page(GFP_KERNEL)))
return -ENOMEM;
+ /*
+ * only clear the space that doesnt get copied:
+ */
+ memset((void *)(new_pg), 0, USER_PTRS_PER_PGD * sizeof (pgd_t));
+
page_dir = pgd_offset(&init_mm, 0);
flush_cache_mm(tsk->mm);
memcpy(new_pg + USER_PTRS_PER_PGD, page_dir + USER_PTRS_PER_PGD,