From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 112F2C433DF for ; Tue, 2 Jun 2020 20:13:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C342E206E2 for ; Tue, 2 Jun 2020 20:13:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="N2ClX7mp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C342E206E2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6EFEB80044; Tue, 2 Jun 2020 16:13:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 69E0380007; Tue, 2 Jun 2020 16:13:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B3AC80044; Tue, 2 Jun 2020 16:13:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0155.hostedemail.com [216.40.44.155]) by kanga.kvack.org (Postfix) with ESMTP id 4746380007 for ; Tue, 2 Jun 2020 16:13:40 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 1360DF07FB for ; Tue, 2 Jun 2020 20:13:40 +0000 (UTC) X-FDA: 76885372200.27.land80_771ae1946c82a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 947C63D668 for ; Tue, 2 Jun 2020 20:13:39 +0000 (UTC) X-HE-Tag: land80_771ae1946c82a X-Filterd-Recvd-Size: 2863 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Tue, 2 Jun 2020 20:13:38 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4EAD720823; Tue, 2 Jun 2020 20:13:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591128817; bh=1X+E1nV4q10TYL0yBULYEG3do5ScvWP0tpCoRjj5mv8=; h=Date:From:To:Subject:In-Reply-To:From; b=N2ClX7mptvDAUgIQwTXoBcUX0JTOUjO0wc4tSn3C7wGyKftghKUtIg7UmBIrjRn8y EutpbPRccyr8/mLHAUqmttlYKZObG3lvgCWVg8BOobnUrdzhCjsQXEr2xvsIx6VLsi ceiNrU1vE8h9pZm/UhTigsQLH1qpowBxmaa6L9fI= Date: Tue, 02 Jun 2020 13:13:36 -0700 From: Andrew Morton To: akpm@linux-foundation.org, linux-mm@kvack.org, mm-commits@vger.kernel.org, richard.weiyang@gmail.com, tim.c.chen@linux.intel.com, torvalds@linux-foundation.org Subject: [patch 063/128] mm/swapfile.c: remove the unnecessary goto for SSD case Message-ID: <20200602201336.PDLSwGJw5%akpm@linux-foundation.org> In-Reply-To: <20200602130930.8e8f10fa6f19e3766e70921f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Queue-Id: 947C63D668 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Wei Yang Subject: mm/swapfile.c: remove the unnecessary goto for SSD case Now we can see there is redundant goto for SSD case. In these two places, we can just let the code walk through to the correct tag instead of explicitly jump to it. Let's remove them for better readability. Link: http://lkml.kernel.org/r/20200328060520.31449-4-richard.weiyang@gmail.com Signed-off-by: Wei Yang Reviewed-by: Andrew Morton Cc: Tim Chen Signed-off-by: Andrew Morton --- mm/swapfile.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/mm/swapfile.c~mm-swapfilec-remove-the-unnecessary-goto-for-ssd-case +++ a/mm/swapfile.c @@ -759,9 +759,7 @@ static int scan_swap_map_slots(struct sw /* SSD algorithm */ if (si->cluster_info) { - if (scan_swap_map_try_ssd_cluster(si, &offset, &scan_base)) - goto checks; - else + if (!scan_swap_map_try_ssd_cluster(si, &offset, &scan_base)) goto scan; } else if (unlikely(!si->cluster_nr--)) { if (si->pages - si->inuse_pages < SWAPFILE_CLUSTER) { @@ -869,8 +867,6 @@ checks: if (si->cluster_info) { if (scan_swap_map_try_ssd_cluster(si, &offset, &scan_base)) goto checks; - else - goto done; } else if (si->cluster_nr && !si->swap_map[++offset]) { /* non-ssd case, still more slots in cluster? */ --si->cluster_nr; _