SLIP performance: a simpler fix

SLIP performance: a simpler fix

Post by Charles Hedri » Tue, 21 Jul 1992 11:36:28



Since Linus was unwilling to take the fix I described earlier this
afternoon, I decided to see what I could do that would be less
disturbing.  I was able to find a combination of optimizations that
works on my system.  Since my hardware is the slowest that is capable
of running Linux, I assume it will work elsewhere.  However since it's
clearly a matter of borderline timing, it's possible that under load
it won't work as well.  I've got several more drastic solutions that
would save even more CPU, but I have a feeling Linus wouldn't like
them either.  If all you're running is KA9Q, this fix as as good as
the one posted earlier (unless my patches for previous releases, which
made things better, but didn't quite fix them).  The patch is entirely
optimizations to tty_io.c.  The function whose performance is critical
is copy_to_cooked.  My changes are a combination of making functions
inline and moving a copy of TTY_WRITE_FLUSH's inside the conditionals
where they are actually needed (I think).  With this fix, you don't
need the new KA9Q.  (It just sets the line discipline, which in this
implementation is irrelevant.)  Thus I'm removing the stuff I put out
this afternoon, and asking the folks at tsx-11 to do so as well.

There are more things that could be done, e.g. moving the inlines back
into tty.h (as I have them now, only the calls within tty_io.c are
inline -- putting the definitions in tty.h would make calls in
console.c and other modules inline), and writing special-case code in
copy_to_cooked for use in the case where all the various I_ and L_
flags are off.  (In that case the function degenerates to a very
simple loop.  I've actually done the implementation as a test.)
However for the moment it looks like this is good enough.  If I find I
need more optimizations, I may post revised versions.  

The original code still has its good points.  By having KA9Q activate
only once per packet rather than once per character, it clearly
decreases the overall system load.  However I can't see any way to
make that happen without adding basic facilities to the tty input
interface.  But that benefit isn't worth maintaining my own version of
the kernel.

This file will be on cs.rutgers.edu and tsx-11 (if they take it)
as serial-opt.

*** tty_io.c.O  Sat Jul 18 22:38:11 1992
--- tty_io.c    Mon Jul 20 02:08:22 1992
***************
*** 60,66 ****
   */
  struct tty_queue * table_list[] = { NULL, NULL };

! void put_tty_queue(char c, struct tty_queue * queue)
  {
        int head;
        unsigned long flags;
--- 60,66 ----
   */
  struct tty_queue * table_list[] = { NULL, NULL };

! void inline put_tty_queue(char c, struct tty_queue * queue)
  {
        int head;
        unsigned long flags;
***************
*** 74,80 ****
        __asm__ __volatile__("pushl %0 ; popfl"::"r" (flags));
  }

! int get_tty_queue(struct tty_queue * queue)
  {
        int result = -1;
        unsigned long flags;
--- 74,80 ----
        __asm__ __volatile__("pushl %0 ; popfl"::"r" (flags));
  }

! int inline get_tty_queue(struct tty_queue * queue)
  {
        int result = -1;
        unsigned long flags;
***************
*** 88,94 ****
        return result;
  }

! void tty_write_flush(struct tty_struct * tty)
  {
        if (EMPTY(tty->write_q))
                return;
--- 88,94 ----
        return result;
  }

! void inline tty_write_flush(struct tty_struct * tty)
  {
        if (EMPTY(tty->write_q))
                return;
***************
*** 244,249 ****
--- 244,250 ----
                if ((L_ECHO(tty) || (L_CANON(tty) && L_ECHONL(tty))) && (c==10)) {
                        put_tty_queue(10,tty->write_q);
                        put_tty_queue(13,tty->write_q);
+                       TTY_WRITE_FLUSH(tty);
                } else if (L_ECHO(tty)) {
                        if (c<32 && L_ECHOCTL(tty)) {
                                put_tty_queue('^',tty->write_q);
***************
*** 250,263 ****
                                put_tty_queue(c+64,tty->write_q);
                        } else
                                put_tty_queue(c,tty->write_q);
                }
                put_tty_queue(c,tty->secondary);
-               TTY_WRITE_FLUSH(tty);
        }
        TTY_WRITE_FLUSH(tty);
        if (!EMPTY(tty->secondary))
                wake_up(&tty->secondary->proc_list);
!       if (LEFT(tty->write_q) > TTY_BUF_SIZE/2)
                wake_up(&tty->write_q->proc_list);
  }

--- 251,264 ----
                                put_tty_queue(c+64,tty->write_q);
                        } else
                                put_tty_queue(c,tty->write_q);
+                       TTY_WRITE_FLUSH(tty);
                }
                put_tty_queue(c,tty->secondary);
        }
        TTY_WRITE_FLUSH(tty);
        if (!EMPTY(tty->secondary))
                wake_up(&tty->secondary->proc_list);
!       if (tty->write_q->proc_list && LEFT(tty->write_q) > TTY_BUF_SIZE/2)
                wake_up(&tty->write_q->proc_list);
  }

 
 
 

SLIP performance: a simpler fix

Post by m.. » Thu, 30 Jul 1992 06:22:48


Somebody already posted where I could get the driver for ATI Wonder XL.
I think it was a beta copy that someone was developing.  Could that
kind individual please send me a copy of the server for ATI Wonder XL??


Thanks all you linuxers out there.

---

 
 
 

1. terrible slip performance

I am using slip between an hp9000/720 hpux9.01 system and a linux box
running pl99.13.  I got slip to start, but the performance is
terrible.  Pings take >1sec.  Eventually it just hangs.

Has anyone ever gotten good results using slip to an hp box (hp calls
this ppl)?

2. Redhat 5.2 does not see all my RAM(memory)!

3. slip/ppp performance

4. Weird NMI Problem - Hardware?

5. SLIP lousy performance, why?

6. Problems with gcc/dbx

7. Help: Slip performance tuning??

8. Poweredge 1600SC SCSI

9. improving SLIP performance

10. Slip performance under DIP?

11. How can I improve SLIP performance?

12. Anybody compared SLIP, CLSIP, PPP performance?

13. new KA9Q, kernel patch - major performance improvement for SLIP