Re: [PATCH] f2fs: add unlikely() macro for compiler more aggressively

From: Andi Kleen
Date: Fri Dec 06 2013 - 13:24:37 EST


Jaegeuk Kim <jaegeuk.kim@xxxxxxxxxxx> writes:
> struct page *page;
> repeat:
> page = grab_cache_page(mapping, index);
> - if (!page) {
> + if (unlikely(!page)) {

This is completely pointless, gcc already considers any test for NULL
unlikely.

In general i would advise against splattering unlikely all over your
code, the benefits are very minimal and programers often get it wrong.

-Andi

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