diff options
author | Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | 2011-03-16 19:05:47 -0400 |
---|---|---|
committer | Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> | 2011-03-16 19:05:47 -0400 |
commit | cc2898f8c9b1ebaa11805886ab1f8c595ed13c2f (patch) | |
tree | bede784cffd73e945cda19009b24891756be7ff1 /arch | |
parent | 6d51e0479178242e9a7a8671cec352f743ce4538 (diff) |
Create generic alignment API (v11)
Rather than re-doing the "alignment on a type size" trick all over again at
different levels, import the "ltt_align" from LTTng into kernel.h and make this
available to everyone. Renaming to:
- object_align()
- object_align_floor()
- offset_align()
- offset_align_floor()
Changelog since v10:
- Remove stale comment.
- Fix parenthesis in the MAYBE_BUILD_BUG_ON test.
Changelog since v9:
- Hardcode MAYBE_BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) rather than
creating a helper macro in kernel.h, by popular request.
- Remove unneeded log2.h include.
- Now that offset_align_floor and offset_align are macros (needed for
MAYBE_BUILD_BUG_ON()), add the appropriate braces around parameters used.
Changelog since v8:
- Remove unnecessary braces.
- Update object_align/object_align_floor comments.
Changelog since v7:
- Add missing include/linux/Kconfig header-y.
Changelog since v6:
- Adapt to changes introduced by
commit a79ff731a1b277d0e92d9453bdf374e04cec717a
- Use __alignof__() instead of sizeof() to support compound types.
Changelog since v5:
- moved alignment apis to a separate header file so that it is possible
to use them from other header files which are, for example, included
from kernel.h.
Changelog since v4:
- add missing ( ) around parameters within object_align() and
object_align_floor().
- More coding style cleanups to ALIGN() (checkpatch.pl is happy now).
Changelog since v3:
- optimize object_align*() so fewer instructions are needed for alignment of
addresses known dynamically. Use the (already existing) "ALIGN()", and create
the "ALIGN_FLOOR()" macro.
- While we are there, let's clean up the ALIGN() macros wrt coding style. e.g.
missing parenthesis around the first use of the "x" parameter in ALIGN().
Changelog since v2:
- Fix object_align*(): should use object size alignment, not pointer alignment.
Changelog since v1:
- Align on the object natural alignment
(rather than min(arch word alignment, natural alignment))
The advantage of separating the API in "object alignment" and "offset alignment"
is that it gives more freedom to play with offset alignment. Very useful to
implement a tracer ring-buffer alignment. (hint hint)
Typical users will use "object alignment", but infrastructures like tracers
which need to perform alignment of statically known base+offsets will typically
use "offset alignment", because it allows to align with respect to a base rather
than to pass an absolute address.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Reviewed-by: "Kirill A. Shutemov" <kirill@shutemov.name>
CC: Russell King - ARM Linux <linux@arm.linux.org.uk>
CC: linux-arm-kernel@lists.infradead.org
CC: Imre Deak <imre.deak@nokia.com>
CC: Jamie Lokier <jamie@shareable.org>
CC: mingo@elte.hu
CC: Alexey Dobriyan <adobriyan@gmail.com>
Diffstat (limited to 'arch')
0 files changed, 0 insertions, 0 deletions