From: Miaohe Lin <linmiaohe@huawei.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Joao Martins <joao.m.martins@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>,
Dan Williams <dan.j.williams@intel.com>
Subject: Re: [PATCH] mm/page_alloc: make calling prep_compound_head more reliable
Date: Thu, 16 Jun 2022 11:21:55 +0800 [thread overview]
Message-ID: <1483de08-321c-41da-e098-8defd6ae4f11@huawei.com> (raw)
In-Reply-To: <YqnTtGDt+NdQ3Jxf@casper.infradead.org>
On 2022/6/15 20:42, Matthew Wilcox wrote:
> On Wed, Jun 15, 2022 at 03:44:06PM +0800, Miaohe Lin wrote:
>>> We definitely don't need the unlikely here.
>>
>> Could you please give me a more detailed explanation? IIUC, the above if condition
>> will only meet at a probability of 1/512. So unlikely tells the compiler to do some
>> optimization around it. Or am I miss something?
>
> Only add unlikely() when the compiler can't figure out for itself that
> it's unlikely. You should also check the generated code and/or
> benchmark the results to be sure that it's actually an improvement.
> Using unlikely() needs to be backed up with more than just a feeling.
I see. Many thanks for clarifying. Will keep it in mind. :)
>
> .
>
prev parent reply other threads:[~2022-06-16 3:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-07 14:41 [PATCH] mm/page_alloc: make calling prep_compound_head more reliable Miaohe Lin
2022-06-07 18:32 ` Andrew Morton
2022-06-07 19:17 ` Joao Martins
2022-06-08 12:17 ` Miaohe Lin
2022-06-14 13:13 ` Matthew Wilcox
2022-06-15 7:44 ` Miaohe Lin
2022-06-15 12:42 ` Matthew Wilcox
2022-06-16 3:21 ` Miaohe Lin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1483de08-321c-41da-e098-8defd6ae4f11@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=joao.m.martins@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).