From: Yevgeny Kliteynik <kliteyn-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Cc: "Hefty,
Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Linux RDMA <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
<alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH 2/8] opensm/complib: define "if" statements with branch prediction hints
Date: Sun, 26 Aug 2012 16:43:48 +0300 [thread overview]
Message-ID: <503A2814.6030709@dev.mellanox.co.il> (raw)
In-Reply-To: <20120814215413.GA29245-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Hi,
Sorry for the delay with a response - just got back from a long vacation.
On 8/15/2012 12:54 AM, Jason Gunthorpe wrote:
> On Tue, Aug 14, 2012 at 09:39:23PM +0000, Hefty, Sean wrote:
>>> +#define if_PF(cond) if(CL_PREDICT_FALSE(cond))
>>> +#define if_PT(cond) if(CL_PREDICT_TRUE(cond))
>>
>> If CL_PREDICT_TRUE/FALSE are too long, why not just shorten those,
>> rather than abstract if statements behind a macro?
It's not the size - it's just the readability of the macro.
First macro (CL_PREDICT_*) is close to the GCC's way to define
it. Second macro (if_PF/T) is close to the usual 'if' statement
syntax.
If you think it's a deal breaker, I can lose the first macro and
have everything in one macro.
> If you are typing these so often (ie more than in some datastructure
> kernels) that the length is a problem then you really should be using
> profile guided optimization instead...
I'm trying to optimize all the 'if' conditions in the SM.
As I described in patch 3/8 (next patch in these series),
I don't touch all the non-fatal cases. The goal is not to
help SM to perform better in general (in which case I agree
than PGO would be the right way to go), but to make sure
that the fatal cases will never be predicted wrong, so any
fatal check (existing or a newly added one) won't affect
the SM performance.
Also, the plan is to define a new ASSERT macro that will
use this if_PF thing to make sure that ASSERT statement
doesn't cost much (if any).
-- YK
> Jason
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-08-26 13:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-14 21:32 [PATCH 2/8] opensm/complib: define "if" statements with branch prediction hints Yevgeny Kliteynik
[not found] ` <502AC3DC.9090102-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
2012-08-14 21:39 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A8237346A892A4-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2012-08-14 21:54 ` Jason Gunthorpe
[not found] ` <20120814215413.GA29245-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2012-08-26 13:43 ` Yevgeny Kliteynik [this message]
[not found] ` <503A2814.6030709-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2012-08-26 13:56 ` Yevgeny Kliteynik
2012-08-27 17:51 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A8237346A8B2AD-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2012-09-11 15:23 ` Yevgeny Kliteynik
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=503A2814.6030709@dev.mellanox.co.il \
--to=kliteyn-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
--cc=alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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).