From: Jesse Gross Date: Thu, 26 May 2011 23:25:02 +0000 (-0700) Subject: flex_array: avoid divisions when accessing elements X-Git-Tag: v3.0-rc1~120 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=704f15ddb5fc2a7f25a12eb0913302d8ad9ffab3;p=pandora-kernel.git flex_array: avoid divisions when accessing elements On most architectures division is an expensive operation and accessing an element currently requires four of them. This performance penalty effectively precludes flex arrays from being used on any kind of fast path. However, two of these divisions can be handled at creation time and the others can be replaced by a reciprocal divide, completely avoiding real divisions on access. [eparis@redhat.com: rebase on top of changes to support 0 len elements] [eparis@redhat.com: initialize part_nr when array fits entirely in base] Signed-off-by: Jesse Gross Signed-off-by: Eric Paris Cc: Dave Hansen Cc: David Rientjes Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed