diff options
author | Will Schmidt <will_schmidt@vnet.ibm.com> | 2007-04-17 10:44:46 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-04-24 07:31:43 -0400 |
commit | b791072ba3c3b29bab1890963bde52eb944a8451 (patch) | |
tree | f0a506318d8ea653057d6f99387c163b526ebeb3 /drivers/char | |
parent | b3a6d2a54b8be331b36d849577a716867895ca75 (diff) |
[POWERPC] hvc_console: Polling mode timer backoff
Add a back-off mechanism to hvc_console's polling logic. This change
drops the timers/second ratio from ~90 to ~1/2 while the console is
idle.
This change is most noticeable when watching /proc/timer_stats output.
This only affects when the hvc_console is running in poll mode, i.e.
power4 and cell systems.
I've tested on Power4, Michael Ellerman has both contributed to the
patch and tested on cell.
Signed-off-by: Will Schmidt <will_schmidt@vnet.ibm.com>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/hvc_console.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index a0a88aa23f5b..fc9bc7709fd9 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -47,8 +47,6 @@ | |||
47 | #define HVC_MAJOR 229 | 47 | #define HVC_MAJOR 229 |
48 | #define HVC_MINOR 0 | 48 | #define HVC_MINOR 0 |
49 | 49 | ||
50 | #define TIMEOUT (10) | ||
51 | |||
52 | /* | 50 | /* |
53 | * Wait this long per iteration while trying to push buffered data to the | 51 | * Wait this long per iteration while trying to push buffered data to the |
54 | * hypervisor before allowing the tty to complete a close operation. | 52 | * hypervisor before allowing the tty to complete a close operation. |
@@ -550,6 +548,18 @@ static int hvc_chars_in_buffer(struct tty_struct *tty) | |||
550 | return hp->n_outbuf; | 548 | return hp->n_outbuf; |
551 | } | 549 | } |
552 | 550 | ||
551 | /* | ||
552 | * timeout will vary between the MIN and MAX values defined here. By default | ||
553 | * and during console activity we will use a default MIN_TIMEOUT of 10. When | ||
554 | * the console is idle, we increase the timeout value on each pass through | ||
555 | * msleep until we reach the max. This may be noticeable as a brief (average | ||
556 | * one second) delay on the console before the console responds to input when | ||
557 | * there has been no input for some time. | ||
558 | */ | ||
559 | #define MIN_TIMEOUT (10) | ||
560 | #define MAX_TIMEOUT (2000) | ||
561 | static u32 timeout = MIN_TIMEOUT; | ||
562 | |||
553 | #define HVC_POLL_READ 0x00000001 | 563 | #define HVC_POLL_READ 0x00000001 |
554 | #define HVC_POLL_WRITE 0x00000002 | 564 | #define HVC_POLL_WRITE 0x00000002 |
555 | 565 | ||
@@ -642,9 +652,14 @@ static int hvc_poll(struct hvc_struct *hp) | |||
642 | bail: | 652 | bail: |
643 | spin_unlock_irqrestore(&hp->lock, flags); | 653 | spin_unlock_irqrestore(&hp->lock, flags); |
644 | 654 | ||
645 | if (read_total) | 655 | if (read_total) { |
656 | /* Activity is occurring, so reset the polling backoff value to | ||
657 | a minimum for performance. */ | ||
658 | timeout = MIN_TIMEOUT; | ||
659 | |||
646 | tty_flip_buffer_push(tty); | 660 | tty_flip_buffer_push(tty); |
647 | 661 | } | |
662 | |||
648 | return poll_mask; | 663 | return poll_mask; |
649 | } | 664 | } |
650 | 665 | ||
@@ -688,8 +703,12 @@ int khvcd(void *unused) | |||
688 | if (!hvc_kicked) { | 703 | if (!hvc_kicked) { |
689 | if (poll_mask == 0) | 704 | if (poll_mask == 0) |
690 | schedule(); | 705 | schedule(); |
691 | else | 706 | else { |
692 | msleep_interruptible(TIMEOUT); | 707 | if (timeout < MAX_TIMEOUT) |
708 | timeout += (timeout >> 6) + 1; | ||
709 | |||
710 | msleep_interruptible(timeout); | ||
711 | } | ||
693 | } | 712 | } |
694 | __set_current_state(TASK_RUNNING); | 713 | __set_current_state(TASK_RUNNING); |
695 | } while (!kthread_should_stop()); | 714 | } while (!kthread_should_stop()); |