Skip to contentSkip to conversation

Low latency for recent kernels

DISCUSSION Dan Maas 3 participants 5 messages Jan 24, 2002 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Dan Maas

author
#1 lore raw
Quoted 4 lines

I'm a little surprised that desktop users do notice significant benefits with all the latency/preempt patches. If you actually instrument the kernel's behaviour, the stalls are in fact quite small and infrequent.

Havoc Pennington, Soeren Sandmann, and I have been investigating causes of UI unresponsiveness in Xfree86/Linux. I would agree that in most situations, on a mostly-idle machine, low-latency/preempt patches should *not* enhance the overall feel of the desktop. (if they do measurably increase responsiveness, then that would suggest inefficiencies in X/the WM/the X client - a definite possibility, of course).

Two situations where I would expect low-latency/preemption to have a positive effect on responsiveness are 1) when the system is under heavy CPU and disk load (e.g. kernel compile); due to the interactive tasks being able to run earlier/more often, and 2) when performing UI operations that depend on tight synchronization between X/the WM/the X client, particularly opaque window resizing. (my theory is that low-latency/preemption results in the CPU switching more rapidly or evenly among these processes, reducing the perceptible "lag" between the client window and its WM frame)

Regards,
Dan

#2 lore raw
Quoted 8 lines · Dan Maas

Two situations where I would expect low-latency/preemption to have a positive effect on responsiveness are 1) when the system is under heavy CPU and disk load (e.g. kernel compile); due to the interactive tasks being able to run earlier/more often, and 2) when performing UI operations that depend on tight synchronization between X/the WM/the X client, particularly opaque window resizing. (my theory is that low-latency/preemption results in the CPU switching more rapidly or evenly among these processes, reducing the perceptible "lag" between the client window and its WM frame)

This is exactly the area preempt/low-latency helps and I think your theory is pretty much dead on.

With preempt-kernel, ideally, an interactive task finds itself runnable like this: user event causes interrupt, interrupt sets need_resched, on return from interrupt we cause a preemption of current task (which can happen whether task is in kernel or userland, now), and schedule the interactive task onto the CPU.

This leads to better scheduling fairness and short scheduling latency.

If you or Havoc are interested in any tests or further work with the preemptive kernel, I'd be more than willing. Hey, I use GNOME ;)

Robert Love

#3 lore raw

Is this patch available for 2.5.2 ? or is it already part of the tree?

Quoted 33 lines · Robert Love
Quoted 8 lines · Dan Maas

Two situations where I would expect low-latency/preemption to have a positive effect on responsiveness are 1) when the system is under heavy CPU and disk load (e.g. kernel compile); due to the interactive tasks being able to run earlier/more often, and 2) when performing UI operations that depend on tight synchronization between X/the WM/the X client, particularly opaque window resizing. (my theory is that low-latency/preemption results in the CPU switching more rapidly or evenly among these processes, reducing the perceptible "lag" between the client window and its WM frame)

This is exactly the area preempt/low-latency helps and I think your theory is pretty much dead on.

With preempt-kernel, ideally, an interactive task finds itself runnable like this: user event causes interrupt, interrupt sets need_resched, on return from interrupt we cause a preemption of current task (which can happen whether task is in kernel or userland, now), and schedule the interactive task onto the CPU.

This leads to better scheduling fairness and short scheduling latency.

If you or Havoc are interested in any tests or further work with the preemptive kernel, I'd be more than willing. Hey, I use GNOME ;)

Robert Love

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#4 lore raw
Quoted 1 line · Glendon Gross

Is this patch available for 2.5.2 ? or is it already part of the tree?

No, its not in 2.5 at the moment. 2.5.2 patch is available at:

ftp://ftp.kernel.org/pub/linux/kernel/people/rml/preempt-kernel/v2.5

Robert Love

#5 lore raw

I was able to build kernel 2.5.2 after applying the patch, but only after editing out a line from /usr/src/linux/arch/i386/kernel/i387.c. After applying the patch, the system does seem a little faster. (This is a P-II/233 with 512k cache.)

Prior to the edit, I got this:

Script started on Wed Jan 23 21:58:40 2002
gross@mail:/usr/src/2.5.2/linux > make bzImage
. scripts/mkversion > .tmpversion
gcc -D__KERNEL__ -I/usr/src/2.5.2/linux/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=i686 -DUTS_MACHINE='"i386"' -c -o init/version.o init/version.c make CFLAGS="-D__KERNEL__ -I/usr/src/2.5.2/linux/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=i686 " -C kernel make[1]: Entering directory `/usr/src/2.5.2/linux/kernel'
make all_targets

(snip)

make[2]: Entering directory /usr/src/2.5.2/linux/kernel' make[1]: Leaving directory /usr/src/2.5.2/linux/arch/i386/math-emu'

ld -m elf_i386 -T /usr/src/2.5.2/linux/arch/i386/vmlinux.lds -e stext arch/i386/kernel/head.o arch/i386/kernel/init_task.o init/main.o init/version.o init/do_mounts.o \
	--start-group \
	arch/i386/kernel/kernel.o arch/i386/mm/mm.o kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o \
	/usr/src/2.5.2/linux/arch/i386/lib/lib.a /usr/src/2.5.2/linux/lib/lib.a /usr/src/2.5.2/linux/arch/i386/lib/lib.a \
	 drivers/acpi/acpi.o drivers/parport/driver.o drivers/char/char.o drivers/block/block.o drivers/misc/misc.o drivers/net/net.o drivers/media/media.o drivers/char/agp/agp.o drivers/char/drm/drm.o drivers/atm/atm.o drivers/ide/idedriver.o drivers/scsi/scsidrv.o drivers/cdrom/driver.o drivers/pci/driver.o drivers/net/pcmcia/pcmcia_net.o drivers/pnp/pnp.o drivers/video/video.o drivers/net/hamradio/hamradio.o drivers/telephony/telephony.o arch/i386/math-emu/math.o \
	net/network.o \
	--end-group \
	-o vmlinux

arch/i386/kernel/kernel.o: In function `kernel_fpu_begin':
arch/i386/kernel/kernel.o(.text+0x7ccd): undefined reference to `preempt_disable'
make: *** [vmlinux] Error 1
gross@mail:/usr/src/2.5.2/linux > exit

Script done on Wed Jan 23 22:01:56 2002

So I looked at i387.c and commented out this line:

Script started on Wed Jan 23 22:31:34 2002 gross@mail:/usr/src/linux/arch/i386/kernel > pwd /usr/src/linux/arch/i386/kernel gross@mail:/usr/src/linux/arch/i386/kernel > grep preempt i387.c
/* preempt_disable(); */
gross@mail:/usr/src/linux/arch/i386/kernel > exit

Script done on Wed Jan 23 22:31:51 2002

Quoted 16 lines · Robert Love
Quoted 1 line · Glendon Gross

Is this patch available for 2.5.2 ? or is it already part of the tree?

No, its not in 2.5 at the moment. 2.5.2 patch is available at:

ftp://ftp.kernel.org/pub/linux/kernel/people/rml/preempt-kernel/v2.5

Robert Love

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/