lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140904205810.3daf3a87@as>
Date:	Thu, 4 Sep 2014 20:58:10 -0500
From:	Chuck Ebbert <cebbert.lkml@...il.com>
To:	Jens Axboe <axboe@...nel.dk>
Cc:	Alexander Gordeev <agordeev@...hat.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] blk-mq: Cleanup blk_mq_tag_busy() and
 blk_mq_tag_idle()

On Thu, 04 Sep 2014 19:30:18 -0600
Jens Axboe <axboe@...nel.dk> wrote:

> On 09/04/2014 07:26 PM, Chuck Ebbert wrote:
> > On Wed, 03 Sep 2014 14:35:29 -0600
> > Jens Axboe <axboe@...nel.dk> wrote:
> > 
> >> On 09/03/2014 02:33 PM, Alexander Gordeev wrote:
> > <snip>
> >>> diff --git a/block/blk-mq-tag.h b/block/blk-mq-tag.h
> >>> index 6206ed1..795ec3f 100644
> >>> --- a/block/blk-mq-tag.h
> >>> +++ b/block/blk-mq-tag.h
> >>> @@ -66,23 +66,22 @@ enum {
> >>>  	BLK_MQ_TAG_MAX		= BLK_MQ_TAG_FAIL - 1,
> >>>  };
> >>>  
> >>> -extern bool __blk_mq_tag_busy(struct blk_mq_hw_ctx *);
> >>> +extern void __blk_mq_tag_busy(struct blk_mq_hw_ctx *);
> >>>  extern void __blk_mq_tag_idle(struct blk_mq_hw_ctx *);
> >>>  
> >>>  static inline bool blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
> >>>  {
> >>> -	if (!(hctx->flags & BLK_MQ_F_TAG_SHARED))
> >>> -		return false;
> >>> -
> >>> -	return __blk_mq_tag_busy(hctx);
> >>> +	if (hctx->flags & BLK_MQ_F_TAG_SHARED) {
> >>> +		__blk_mq_tag_busy(hctx);
> >>> +		return true;
> >>> +	}
> >>> +	return false;
> >>>  }
> >>
> >> The normal/fast path here is the flag NOT being set, which is why
> >> it was coded that way to put the fast path inline.
> >>
> >>>  
> >>>  static inline void blk_mq_tag_idle(struct blk_mq_hw_ctx *hctx)
> >>>  {
> >>> -	if (!(hctx->flags & BLK_MQ_F_TAG_SHARED))
> >>> -		return;
> >>> -
> >>> -	__blk_mq_tag_idle(hctx);
> >>> +	if (hctx->flags & BLK_MQ_F_TAG_SHARED)
> >>> +		__blk_mq_tag_idle(hctx);
> >>>  }
> >>
> >> Ditto
> > 
> > Shouldn't it just add unlikely() then? That way it's obvious what
> > the common case is, instead of relying on convoluted code.
> 
> It's a common construct. Besides, if you find a flag-not-set check
> convoluted, then I hope you are not programming anything I use.
> That's a bit of a straw man, imho.
> 

Sure, it's a common construct. But there's nothing there to prevent the
optimizer from rearranging things any way it pleases. Nor is there
anything keeping a human from doing the same. ;)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ