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] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A5EDD81.6060409@panasas.com>
Date:	Thu, 16 Jul 2009 10:57:53 +0300
From:	Boaz Harrosh <bharrosh@...asas.com>
To:	Tejun Heo <tj@...nel.org>
CC:	Linux Kernel <linux-kernel@...r.kernel.org>,
	Jens Axboe <jens.axboe@...cle.com>,
	FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
	Jeff Garzik <jeff@...zik.org>
Subject: Re: [PATCH #tj-block-for-linus] block: fix failfast merge testing
 in elv_rq_merge_ok()

On 07/16/2009 09:44 AM, Tejun Heo wrote:
> Commit ab0fd1debe730ec9998678a0c53caefbd121ed10 tries to prevent merge
> of requests with different failfast settings.  In elv_rq_merge_ok(),
> it compares new bio's failfast flags against the merge target
> request's.  However, the flag testing accessors for bio and blk don't
> return boolean but the tested bit value directly and FAILFAST on bio
> and blk don't match, so directly comparing them with == results in
> false negative unnecessary preventing merge of readahead requests.
> 
> This patch convert the results to boolean by negating them before
> comparison.

I don't like that at all. Please fix the accessors to return
boolean. They look and regarded as boolean. I've never seen
them used as their bit value.

if you are concerned with performance don't
an if(flag & bit) is even slightly slower then
   if(0 != (flag & bit)) on some processors

> Signed-off-by: Tejun Heo <tj@...nel.org>
> Cc: Jens Axboe <jens.axboe@...cle.com>
> Cc: Boaz Harrosh <bharrosh@...asas.com>
> Cc: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
> Cc: James Bottomley <James.Bottomley@...senPartnership.com>
> Cc: Jeff Garzik <jeff@...zik.org>
> ---
> Eh... talk about being obscure. :-( I've put this onto the following
> temp block tree I'm running and will push toward Linus in a few days.
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git tj-block-for-linus
> 
> Thanks.
> 
>  block/elevator.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/block/elevator.c b/block/elevator.c
> index 6f23753..977aa7c 100644
> --- a/block/elevator.c
> +++ b/block/elevator.c
> @@ -103,9 +103,9 @@ int elv_rq_merge_ok(struct request *rq, struct bio *bio)
>  	/*
>  	 * Don't merge if failfast settings don't match
>  	 */
> -	if (bio_failfast_dev(bio)	!= blk_failfast_dev(rq)		||
> -	    bio_failfast_transport(bio)	!= blk_failfast_transport(rq)	||
> -	    bio_failfast_driver(bio)	!= blk_failfast_driver(rq))
> +	if (!bio_failfast_dev(bio)	 != !blk_failfast_dev(rq)	||
> +	    !bio_failfast_transport(bio) != !blk_failfast_transport(rq)	||
> +	    !bio_failfast_driver(bio)	 != !blk_failfast_driver(rq))
>  		return 0;
> 
>  	if (!elv_iosched_allow_merge(rq, bio))

Boaz
--
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