poll cleanups 1/3
RFC PATCH 1/1 poll cleanups 1/3
Change 1:
Davide added a 'queue' variable into the poll_table, to indicate that no wait queue operations should happen.
This is not needed: setting the poll table to NULL achieves the same effect, and is used by select/poll to implement syscalls with a 0 timeout.
Patch vs 2.5.46, untested.
--
Manfred
// $Header$
// Kernel Version:
// VERSION = 2 // PATCHLEVEL = 5 // SUBLEVEL = 46 // EXTRAVERSION =
include/linux/poll.h +1 -4
@@ -13,7 +13,6 @@struct poll_table_page ; typedef struct poll_table_struct { - int queue; void *priv; void (*qproc)(void *, wait_queue_head_t *); int error;
@@ -30,18 +29,16 @@static inline void poll_initwait (poll_table * pt) { - pt->queue =1 ; pt->qproc =NULL ; pt->priv =NULL ; pt->error =0 ; pt->table =NULL ; } -static inline void poll_initwait_ex (poll_table * pt,int queue, +static inline void poll_initwait_ex (poll_table * pt,void (*qproc)(void *,wait_queue_head_t *),void *priv) { - pt->queue = queue; pt->qproc = qproc; pt->priv = priv; pt->error =0 ;
fs/select.c +0 -3
@@ -77,9 +77,6 @@ {struct poll_table_page *table = p->table; -if (!p->queue) -return ; -if (p->qproc) { p->qproc (p->priv, wait_address);return ;
fs/eventpoll.c +4 -27
@@ -828,7 +828,7 @@ }/* Attach the item to the poll hooks */ -poll_initwait_ex (&pt,1 , ep_ptable_queue_proc, dpi); +poll_initwait_ex (&pt, ep_ptable_queue_proc, dpi); revents = tfile->f_op->poll (tfile, &pt);poll_freewait (&pt);
@@ -854,25 +854,14 @@/* -* Returns the current events of the given file. It uses the special -* poll table initialization to avoid any poll queue insertion. +* Returns the current events of the given file. */ static unsigned int ep_get_file_events (struct file *file) {unsigned int revents; -poll_table pt; -/* -* This is a special poll table initialization that will -* make poll_wait() to not perform any wait queue insertion when -* called by file->f_op->poll(). This is a fast way to retrieve -* file events with perform any queue insertion, hence saving CPU cycles. -*/ -poll_initwait_ex (&pt,0 ,NULL ,NULL ); - - revents = file->f_op->poll (file, &pt); + revents = file->f_op->poll (file,NULL ); -poll_freewait (&pt);return revents; }
@@ -1056,15 +1045,6 @@unsigned long flags;struct list_head *lsthead = &ep->rdllist;struct pollfd eventbuf[EP_EVENT_BUFF_SIZE ]; -poll_table pt; - -/* -* This is a special poll table initialization that will -* make poll_wait() to not perform any wait queue insertion when -* called by file->f_op->poll(). This is a fast way to retrieve -* file events with perform any queue insertion, hence saving CPU cycles. -*/ -poll_initwait_ex (&pt,0 ,NULL ,NULL );write_lock_irqsave (&ep->lock, flags);
@@ -1075,7 +1055,7 @@EP_LIST_DEL (&dpi->rdllink);/* Fetch event bits from the signaled file */ - revents = dpi->file->f_op->poll (dpi->file, &pt); + revents = dpi->file->f_op->poll (dpi->file,NULL );if (revents & dpi->pfd.events) { eventbuf[ebufcnt] = dpi->pfd;
@@ -1091,7 +1071,6 @@write_unlock_irqrestore (&ep->lock, flags);if (__copy_to_user (&events[eventcnt], eventbuf, ebufcnt *sizeof (struct pollfd ))) { -poll_freewait (&pt);return -EFAULT ; } eventcnt += ebufcnt;
@@ -1111,8 +1090,6 @@ eventcnt += ebufcnt; } -poll_freewait (&pt); -return eventcnt; }
Quoted 5 lines · Manfred Spraul
Change 1:
Davide added a 'queue' variable into thepoll_table, to indicate that no wait queue operations should happen.
This is not needed: setting the poll table to NULL achieves the same effect, and is used by select/poll to implement syscalls with a 0 timeout.
Fine for me.
- Davide