lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110826072622.406d3395@kryten>
Date:	Fri, 26 Aug 2011 07:26:22 +1000
From:	Anton Blanchard <anton@...ba.org>
To:	tytso@....edu, adilger.kernel@...ger.ca, eric.dumazet@...il.com,
	tj@...nel.org
Cc:	linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] ext4: EXT4_FREEBLOCKS_WATERMARK is overly pessimistic


When testing on a 1024 thread ppc64 box I noticed a large amount of
CPU time in ext4 code.

ext4_has_free_blocks has a fast path to avoid summing every free and
dirty block per cpu counter, but only if the global count shows more
free blocks than the maximum amount that could be stored in all the
per cpu counters.

While we are summing 2 per cpu counters we set the breakpoint at 4
times the maximum amount in the per cpu counter portion. Reduce that
to 2.

Since we fold the per cpu count of CPUs going offline into the global
count, we can use num_online_cpus() instead of nr_cpu_ids here too.

Both these changes match percpu_counter_compare() which is used to
optimise a comparison against one per cpu counter.

Signed-off-by: Anton Blanchard <anton@...ba.org>
---

Index: linux-2.6-work/fs/ext4/ext4.h
===================================================================
--- linux-2.6-work.orig/fs/ext4/ext4.h	2011-08-25 11:44:02.978785464 +1000
+++ linux-2.6-work/fs/ext4/ext4.h	2011-08-25 14:17:37.461904013 +1000
@@ -2051,10 +2051,11 @@ do {								\
 
 #ifdef CONFIG_SMP
 /* Each CPU can accumulate percpu_counter_batch blocks in their local
- * counters. So we need to make sure we have free blocks more
- * than percpu_counter_batch  * nr_cpu_ids. Also add a window of 4 times.
+ * counters. Since we sum two percpu counters (s_freeblocks_counter and
+ * s_dirtyblocks_counter), as a worst case we need to check for 2x this.
  */
-#define EXT4_FREEBLOCKS_WATERMARK (4 * (percpu_counter_batch * nr_cpu_ids))
+#define EXT4_FREEBLOCKS_WATERMARK \
+			(2 * (percpu_counter_batch * num_online_cpus()))
 #else
 #define EXT4_FREEBLOCKS_WATERMARK 0
 #endif
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ