Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164667
b: refs/heads/master
c: 5ae87e7
h: refs/heads/master
i:
  164665: b1365c5
  164663: d937066
v: v3
  • Loading branch information
Guillaume Knispel authored and Linus Torvalds committed Sep 23, 2009
1 parent 301e684 commit a20d4bc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f58f2fa9286db0ce9124ca9986d56aa5420b7f59
refs/heads/master: 5ae87e79ecb5baa65e9cf48be874098fafad0668
14 changes: 10 additions & 4 deletions trunk/fs/select.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,28 @@
* better solutions..
*/

#define MAX_SLACK (100 * NSEC_PER_MSEC)

static long __estimate_accuracy(struct timespec *tv)
{
long slack;
int divfactor = 1000;

if (tv->tv_sec < 0)
return 0;

if (task_nice(current) > 0)
divfactor = divfactor / 5;

if (tv->tv_sec > MAX_SLACK / (NSEC_PER_SEC/divfactor))
return MAX_SLACK;

slack = tv->tv_nsec / divfactor;
slack += tv->tv_sec * (NSEC_PER_SEC/divfactor);

if (slack > 100 * NSEC_PER_MSEC)
slack = 100 * NSEC_PER_MSEC;
if (slack > MAX_SLACK)
return MAX_SLACK;

if (slack < 0)
slack = 0;
return slack;
}

Expand Down

0 comments on commit a20d4bc

Please sign in to comment.