Re: Patches to speed up SLIP and PPP

Chel van Gennip (linux@vangennip.nl)
Wed, 30 Apr 1997 14:22:03 +0100 (WETDST)


On Sat, 26 Apr 1997 Linus Torvalds wrote
>In short, I'd much rather see a patch that
> (a) gets rid of the "fast" vs "slow" interrupts. They used to make sense,
> but they don't much do that any more. They only result in problems.

I have such a patch (experimental) available at http://www.vangennip.nl
This patch has been tested on my single processor hardware with a
limitted number of interface cards.

> (b) make the interrupt handler routine return a flag whether we should do
> bottom half processing after this interrupt. This flag is "or"ed
> together for all shared interrupts, and upon exit from the interrupt
> we then decide whether we should do the bottom half or not.

This could be done easely see attached code example.
Some questions:
- should all interrupts be disabled like in the FAST irq handling?
if so the service routine should return real fast.
- what should be handled in the service routine, what after reactivating
the process? With modern processors the load of a task switch can be
high due to cache effects. It is hard to measure the real effect of this
extra load.

> (c) make "ret_from_interrupt" be different from "ret_from_sys_call",
> because we no longer want to return to ret_from_sys_call() because we
> already did bottom half handling.

I think it would be nice to have some way to indicate directly a task that
should be restarted. If a process is waiting for data it makes sense to restart
it immediately after the data is available. This is however a design issue and
depends on the load of the system (I/O bound, CPU bound, or memory bound).

Chel

=========== sample code of do_IRQ ==================================
/*
* do_IRQ handles IRQ's that have been installed with and
* without the * SA_INTERRUPT flag:
* first the fast interrupts are handled (with SA_INTERRUPT flag):
* the handler is running with interrupts disabled
* then normal interrupts are handled (without SA_INTERRUPT flag):
* the handler uses the full signal-handling return
* and runs with other interrupts enabled.
* added new interface: SA_NEWIRQ
* Function let the IRQ service routine decide whether we have to
* do the bottom half of the IRQ handling should be done
*/
asmlinkage int do_IRQ(int irq, struct pt_regs * regs)
{
struct irqaction * action = *(irq + irq_action);
int do_random = 0;
int irq_status = 0;
#ifdef __SMP__
if(smp_threads_ready && active_kernel_processor!=smp_processor_id())
panic("IRQ %d: active processor set wrongly(%d not %d).\n", irq$
#endif

kstat.interrupts[irq]++;
#ifdef __SMP_PROF__
int_count[smp_processor_id()][irq]++;
#endif
/* First handle fast interupts with other interrupts disabled */
while (action) {
do_random |= action->flags;
if (action->flags & SA_NEWIRQ){
irq_status |= action->handler(irq, action->dev_id, NULL);
} else if (action->flags & SA_INTERRUPT) {
action->handler(irq, action->dev_id, NULL);
}
action = action->next;

}
/* Then enable other interrupts an handle normal interrupts */
action = *(irq + irq_action);
sti();
while (action) {
do_random |= action->flags;
if (!(action->flags & SA_INTERRUPT)){
action->handler(irq, action->dev_id, regs);
irq_status |= 1;
}
action = action->next;
}
if (do_random & SA_SAMPLE_RANDOM)
add_interrupt_randomness(irq);
return(irq_status);
}