From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753330AbbFHShD (ORCPT ); Mon, 8 Jun 2015 14:37:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59316 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752905AbbFHSgy (ORCPT ); Mon, 8 Jun 2015 14:36:54 -0400 From: Jeff Moyer To: Tejun Heo Cc: axboe@kernel.dk, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, vgoyal@redhat.com, avanzini.arianna@gmail.com Subject: Re: [PATCH 1/8] cfq-iosched: simplify control flow in cfq_get_queue() References: <1433753973-23684-1-git-send-email-tj@kernel.org> <1433753973-23684-2-git-send-email-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? Date: Mon, 08 Jun 2015 14:36:52 -0400 In-Reply-To: <1433753973-23684-2-git-send-email-tj@kernel.org> (Tejun Heo's message of "Mon, 8 Jun 2015 17:59:26 +0900") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tejun Heo 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 > Cc: Vivek Goyal > Cc: Arianna Avanzini Acked-by: Jeff Moyer