[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch reduces the number of pages allocated in the copy_syscall_table 
function. 

Signed-off-by: Ildar Muslukhov <ildarm@xxxxxxxxxx>

---
 tables.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/tables.c b/tables.c
index 3c78ab9..306decc 100644
--- a/tables.c
+++ b/tables.c
@@ -509,17 +509,14 @@ static struct syscalltable * copy_syscall_table(struct syscalltable *from, unsig
 	unsigned int n;
 	struct syscall *copy;
 
-	/* FIXME: Use fewer shared maps.
-	 * It's pretty sad that we use a whole page just for a copy of that struct when we
-	 * could fit dozens of them in a page.  This would cut down our /proc/$$/maps a *lot*
-	 */
+	copy = alloc_shared(nr * sizeof(struct syscall));
+	if (copy == NULL)
+		exit(EXIT_FAILURE);
+
 	for (n = 0; n < nr; n++) {
-		copy = alloc_shared(sizeof(struct syscall));
-		if (copy == NULL)
-			exit(EXIT_FAILURE);
-		memcpy(copy, from[n].entry, sizeof(struct syscall));
-		copy->number = n;
-		from[n].entry = copy;
+		memcpy(copy + n , from[n].entry, sizeof(struct syscall));
+		copy[n].number = n;
+		from[n].entry = &copy[n];
 	}
 	return from;
 }
-- 
1.8.4

--
To unsubscribe from this list: send the line "unsubscribe trinity" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux