From: Manfred Spraul <manfred@colorfullife.com>
To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Davide Libenzi <davidel@xmailserver.org>
Subject: [RFC,PATCH] poll cleanups 1/3
Date: Sun, 10 Nov 2002 12:25:19 +0100 [thread overview]
Message-ID: <3DCE421F.8000802@colorfullife.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 310 bytes --]
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
[-- Attachment #2: patch-poll-1-NULL --]
[-- Type: text/plain, Size: 3423 bytes --]
// $Header$
// Kernel Version:
// VERSION = 2
// PATCHLEVEL = 5
// SUBLEVEL = 46
// EXTRAVERSION =
--- 2.5/include/linux/poll.h 2002-11-10 11:54:59.000000000 +0100
+++ build-2.5/include/linux/poll.h 2002-11-10 11:57:39.000000000 +0100
@@ -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;
--- 2.5/fs/select.c 2002-11-10 11:54:59.000000000 +0100
+++ build-2.5/fs/select.c 2002-11-10 11:58:24.000000000 +0100
@@ -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;
--- 2.5/fs/eventpoll.c 2002-11-10 11:54:59.000000000 +0100
+++ build-2.5/fs/eventpoll.c 2002-11-10 11:57:17.000000000 +0100
@@ -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;
}
next reply other threads:[~2002-11-10 12:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-10 11:25 Manfred Spraul [this message]
2002-11-10 19:20 ` [RFC,PATCH] poll cleanups 1/3 Davide Libenzi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3DCE421F.8000802@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=davidel@xmailserver.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.