[PATCH] 6/6 cacheline align files_lock

Martin J. Bligh (mbligh@aracnet.com)
Fri, 07 Mar 2003 15:36:16 -0800


I'm getting a lot of cacheline bounce from .text.lock.file_table due to
false sharing of the cahceline. The following patch just aligns the lock
in it's own cacheline.

only changes in profile under 50 ticks are:

-4832 -22.2% .text.lock.file_table
-6357 -12.8% default_idle
-10374 -6.2% total

Difference in results below (note system times as well as elapsed).

Kernbench: (make -j N vmlinux, where N = 2 x num_cpus)
Elapsed System User CPU
no-align 44.09 94.38 557.26 1477.00
align 44.38 94.18 558.00 1468.25

Kernbench: (make -j N vmlinux, where N = 16 x num_cpus)
Elapsed System User CPU
no-align 45.53 118.06 560.48 1489.50
align 44.84 111.77 560.63 1502.50

Kernbench: (make -j vmlinux, maximal tasks)
Elapsed System User CPU
no-align 45.17 117.80 560.62 1500.50
align 44.94 113.36 560.59 1500.00

diff -urpN -X /home/fletch/.diff.exclude 020-prof_docs/fs/file_table.c 030-align_files_lock/fs/file_table.c
--- 020-prof_docs/fs/file_table.c Tue Feb 25 23:03:49 2003
+++ 030-align_files_lock/fs/file_table.c Wed Mar 5 07:49:20 2003
@@ -27,7 +27,7 @@ static LIST_HEAD(anon_list);
/* And here the free ones sit */
static LIST_HEAD(free_list);
/* public *and* exported. Not pretty! */
-spinlock_t files_lock = SPIN_LOCK_UNLOCKED;
+spinlock_t files_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;

/* Find an unused file structure and return a pointer to it.
* Returns NULL, if there are no more free file structures or

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