Skip to contentSkip to conversation

+ spinlock_debug-dont-recompute-jiffies_per_loop.patch added to -mm tree

DISCUSSION Dave Jones 2 participants 2 messages Jul 25, 2006 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]

Dave Jones

author
#1 lore raw
Quoted 6 lines · Andrew Morton

The patch titled

spinlock_debug: don't recompute (jiffies_per_loop applied-patches arch backup bin block config-x COPYING CREDITS CREDITS~git-gfs2 crypto CVS Documentation drivers fs include init ipc Kbuild kernel lib linus-series log mach MAINTAINERS MAINTAINERS~avr32-arch MAINTAINERS~edac-new-opteron-athlon64-memory-controller-driver MAINTAINERS~git-gfs2 MAINTAINERS~git-klibc MAINTAINERS.orig MAINTAINERS~origin MAINTAINERS~qla3xxx-NIC-driver MAINTAINERS~x86_64-mm-add-a-maintainers-entry-for-calgary Makefile Makefile~git-kbuild Makefile~git-klibc Makefile~mm Makefile.orig Makefile.rej mm net notes patches pc README REPORTING-BUGS scripts security series 'series sound Tags test.img txt usr HZ) in spinloop

has been added to the -mm tree. Its filename is

Wow, that's umm, spectacular ;-)

Quoted 8 lines

------------------------------------------------------
Subject: spinlock_debug: don't recompute (jiffies_per_loop applied-patches arch backup bin block config-x COPYING CREDITS CREDITS~git-gfs2 crypto CVS Documentation drivers fs include init ipc Kbuild kernel lib linus-series log mach MAINTAINERS MAINTAINERS~avr32-arch MAINTAINERS~edac-new-opteron-athlon64-memory-controller-driver MAINTAINERS~git-gfs2 MAINTAINERS~git-klibc MAINTAINERS.orig MAINTAINERS~origin MAINTAINERS~qla3xxx-NIC-driver MAINTAINERS~x86_64-mm-add-a-maintainers-entry-for-calgary Makefile Makefile~git-kbuild Makefile~git-klibc Makefile~mm Makefile.orig Makefile.rej mm net notes patches pc README REPORTING-BUGS scripts security series 'series sound Tags test.img txt usr HZ) in spinloop
From: Chuck Ebbert <[email protected]>

In spinlock_debug.c, the spinloops call __delay() on every iteration. Because that is an external function, (jiffies_per_loop * HZ), the loop's iteration limit, gets recomputed every time. Caching it explicitly prevents that.

What is the purpose of those __delays being there at all ? Seems odd to be waiting that long when the spinlock could become available a lot sooner. (These also make spinlock debug really painful on boxes with huge numbers of CPUs).

Dave

Signature · 1 line
http://www.codemonkey.org.uk
#2 lore raw
Quoted 7 lines · Dave Jones
Quoted 2 lines

iteration limit, gets recomputed every time. Caching it explicitly prevents that.

What is the purpose of those __delays being there at all ? Seems odd to be waiting that long when the spinlock could become available a lot sooner. (These also make spinlock debug really painful on boxes with huge numbers of CPUs).

the debug code has to figure out when to trigger a deadlock warning message. If we are looping in a deadlock with irqs disabled on all CPUs, there's nothing that advances jiffies. The TSC is not reliable. The thing that remains is to use __delay(1). We could calibrate the loop separately perhaps?

Ingo