Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1160707

Re: [PATCH 1/8] cfq-iosched: simplify control flow in cfq_get_queue()

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Jeff Moyer <jmoyer@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/8] cfq-iosched: simplify control flow in cfq_get_queue()
Date Mon, 08 Jun 2015 20:40:02 +0200
Message-ID <pza7M-76e-15@gated-at.bofh.it> (permalink)
References <pz14t-1Vl-9@gated-at.bofh.it> <pz1e9-2mm-7@gated-at.bofh.it>
X-Original-To Tejun Heo <tj@kernel.org>
X-PGP-Keyid 1F78E1B4
X-PGP-Certkey F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4
X-Pcloadletter What the f**k does that mean?
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
MIME-Version 1.0
Content-Type text/plain
X-Scanned-By MIMEDefang 2.68 on 10.5.11.22
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 49
Organization linux.* mail to news gateway
X-Original-Cc axboe@kernel.dk, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, vgoyal@redhat.com, avanzini.arianna@gmail.com
X-Original-Date Mon, 08 Jun 2015 14:36:52 -0400
X-Original-Message-ID <x49vbeyhwsb.fsf@segfault.boston.devel.redhat.com>
X-Original-References <1433753973-23684-1-git-send-email-tj@kernel.org> <1433753973-23684-2-git-send-email-tj@kernel.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1160707

Show key headers only | View raw


Tejun Heo <tj@kernel.org> writes:

> cfq_get_queue()'s control flow looks like the following.
>
> 	async_cfqq = NULL;
> 	cfqq = NULL;
>
> 	if (!is_sync) {
> 		...
> 		async_cfqq = ...;
> 		cfqq = *async_cfqq;
> 	}
>
> 	if (!cfqq)
> 		cfqq = ...;
>
> 	if (!is_sync && !(*async_cfqq))
> 		...;
>
> The only thing the local variable init, the second if, and the
> async_cfqq test in the third if achieves is to skip cfqq creation and
> installation if *async_cfqq was already non-NULL.  This is needlessly
> complicated with different tests examining the same condition.
> Simplify it to the following.
>
> 	if (!is_sync) {
> 		...
> 		async_cfqq = ...;
> 		cfqq = *async_cfqq;
> 		if (cfqq)
> 			goto out;
> 	}
>
> 	cfqq = ...;
>
> 	if (!is_sync)
> 		...;
>  out:
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Vivek Goyal <vgoyal@redhat.com>
> Cc: Arianna Avanzini <avanzini.arianna@gmail.com>

Acked-by: Jeff Moyer <jmoyer@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH 1/8] cfq-iosched: simplify control flow in cfq_get_queue() Jeff Moyer <jmoyer@redhat.com> - 2015-06-08 20:40 +0200

csiph-web