Skip to contentSkip to conversation

poll cleanup 3/3

RFC PATCH New Manfred Spraul 1 participant 1 message Nov 10, 2002 VFS

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 poll cleanup 3/3

This patch is performance improvement, not really a cleanup:

sys_poll performs at least 3 dynamic memory allocations, even if just one file descriptor is polled. The attached patch avoids that by using stack space if possible.

This results in a 40 % performance improvement for sys_poll on one ready file descriptor.

--
Manfred

// $Header$
// Kernel Version:

//  VERSION = 2
//  PATCHLEVEL = 5
//  SUBLEVEL = 46
//  EXTRAVERSION =
include/linux/poll.h +9 -0
@@ -17,10 +17,19 @@
 	void *priv;
 };
 
+struct poll_table_entry {
+	struct file * filp;
+	wait_queue_t wait;
+	wait_queue_head_t * wait_address;
+};
+#define POLL_TABLE_INTERNAL	8
+ 
 struct poll_wrapper {
 	poll_table pt;
 	int error;
+	int nr;
 	struct poll_table_page * table;
+	struct poll_table_entry internal[POLL_TABLE_INTERNAL];
 };
 
 void poll_initwait(struct poll_wrapper* pt);
fs/select.c +137 -102

352 lines not on this page · raw message