The patch titled Subject: compiler.h: add support for function attribute assume_aligned has been added to the -mm tree. Its filename is compilerh-add-support-for-function-attribute-assume_aligned.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/compilerh-add-support-for-function-attribute-assume_aligned.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/compilerh-add-support-for-function-attribute-assume_aligned.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> Subject: compiler.h: add support for function attribute assume_aligned gcc 4.9 added the function attribute assume_aligned, indicating to the caller that the returned pointer may be assumed to have a certain minimal alignment. This is useful if, for example, the return value is passed to memset(). Add a shorthand macro for that. Signed-off-by: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> Cc: Christoph Lameter <cl@xxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Pekka Enberg <penberg@xxxxxxxxxx> Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/compiler-gcc.h | 17 +++++++++++++++++ include/linux/compiler.h | 8 ++++++++ 2 files changed, 25 insertions(+) diff -puN include/linux/compiler-gcc.h~compilerh-add-support-for-function-attribute-assume_aligned include/linux/compiler-gcc.h --- a/include/linux/compiler-gcc.h~compilerh-add-support-for-function-attribute-assume_aligned +++ a/include/linux/compiler-gcc.h @@ -210,6 +210,23 @@ #define __visible __attribute__((externally_visible)) #endif + +#if GCC_VERSION >= 40900 +/* + * __assume_aligned(n, k): Tell the optimizer that the returned + * pointer can be assumed to be k modulo n. The second argument is + * optional (default 0), so we use a variadic macro to make the + * shorthand. + * + * Beware: Do not apply this to functions which may return + * ERR_PTRs. Also, it is probably unwise to apply it to functions + * returning extra information in the low bits (but in that case the + * compiler should see some alignment anyway, when the return value is + * massaged by 'flags = ptr & 3; ptr &= ~3;'). + */ +#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__))) +#endif + /* * GCC 'asm goto' miscompiles certain code sequences: * diff -puN include/linux/compiler.h~compilerh-add-support-for-function-attribute-assume_aligned include/linux/compiler.h --- a/include/linux/compiler.h~compilerh-add-support-for-function-attribute-assume_aligned +++ a/include/linux/compiler.h @@ -393,6 +393,14 @@ static __always_inline void __write_once #define __visible #endif +/* + * Assume alignment of return value. + */ +#ifndef __assume_aligned +#define __assume_aligned(a, ...) +#endif + + /* Are two types/vars the same type (ignoring qualifiers)? */ #ifndef __same_type # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) _ Patches currently in -mm which might be from linux@xxxxxxxxxxxxxxxxxx are compilerh-add-support-for-function-attribute-assume_aligned.patch slabh-sprinkle-__assume_aligned-attributes.patch lib-dynamic_debugc-use-kstrdup_const.patch lib-vsprintfc-handle-invalid-format-specifiers-more-robustly.patch lib-vsprintfc-also-improve-sanity-check-in-bstr_printf.patch lib-vsprintfc-remove-special-handling-in-pointer.patch test_printf-test-printf-family-at-runtime.patch lib-introduce-kvasprintf_const.patch kobject-use-kvasprintf_const-for-formatting-name.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html