From: "Madhu K.S." <madhu.subbaiah@wipro.com>
To: linux-kernel@vger.kernel.org
Subject: select(0,NULL,NULL,NULL,&t1) used for delay
Date: Thu, 06 Oct 2005 19:19:06 +0530 [thread overview]
Message-ID: <1128606546.14385.26.camel@penguin.madhu> (raw)
Hi all,
In many application we use select() system call for delay.
example:
select(0,NULL,NULL,NULL,&t1);
select() for delay is very inefficient. I modified sys_select() code for
efficiency .Here are the changes to fs/select.c.
Please suggest on these changes.
I know nanosleep() can be used instead of select(), but please suggest
on my changes.
file : fs/select.c
function : sys_select()
timeout += sec * (unsigned long) HZ;
}
}
-
+
+
ret = -EINVAL;
if (n < 0)
goto out_nofds;
-
+ if ( (n == 0) && (inp == NULL) && (outp == NULL) &&
(exp== NULL)){
+ printf("\n I am inside new select condition timeout
%d\n",timeout);
+ set_current_state(TASK_INTERRUPTIBLE);
+ ret = 0;
+ timeout = schedule_timeout(timeout);
+ if (signal_pending(current))
+ ret = -ERESTARTNOHAND;
+ if (tvp && !(current->personality & STICKY_TIMEOUTS)) {
+ time_t sec = 0, usec = 0;
+ if (timeout) {
+ sec = timeout / HZ;
+ usec = timeout % HZ;
+ usec *= (1000000/HZ);
+ }
+ put_user(sec, &tvp->tv_sec);
+ put_user(usec, &tvp->tv_usec);
+ }
+ current->state = TASK_RUNNING;
+ goto out_nofds;
+ }
+
/* max_fdset can increase, so grab it once to avoid race */
max_fdset = current->files->max_fdset;
if (n > max_fdset)
Thank you very much.
Thanks for your assistances.
Madhu K.S.
next reply other threads:[~2005-10-06 13:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-06 13:49 Madhu K.S. [this message]
2005-10-06 14:25 ` Jesper Juhl
2005-10-06 14:28 ` Jesper Juhl
2005-10-06 19:05 ` Howard Chu
2005-10-06 19:41 ` Christopher Friesen
2005-10-06 14:27 ` Alex Riesen
2005-10-06 15:26 ` Christopher Friesen
2005-10-06 15:42 ` Bernd Petrovitsch
2005-10-06 15:57 ` Christopher Friesen
2005-10-06 17:30 ` Bob Copeland
2005-10-10 18:06 ` Bill Davidsen
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=1128606546.14385.26.camel@penguin.madhu \
--to=madhu.subbaiah@wipro.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®