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 52723C433E0 for ; Tue, 2 Jun 2020 04:49:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 165F6206C3 for ; Tue, 2 Jun 2020 04:49:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="IVtixiu0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 165F6206C3 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 9D0D3280028; Tue, 2 Jun 2020 00:48:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 95BF1280012; Tue, 2 Jun 2020 00:48:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 894F5280028; Tue, 2 Jun 2020 00:48:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0030.hostedemail.com [216.40.44.30]) by kanga.kvack.org (Postfix) with ESMTP id 6D616280012 for ; Tue, 2 Jun 2020 00:48:54 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3A901181AEF0B for ; Tue, 2 Jun 2020 04:48:54 +0000 (UTC) X-FDA: 76883041788.26.eyes79_30967ef5eae3f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id 16DA31804B663 for ; Tue, 2 Jun 2020 04:48:54 +0000 (UTC) X-HE-Tag: eyes79_30967ef5eae3f X-Filterd-Recvd-Size: 2863 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Tue, 2 Jun 2020 04:48:53 +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 D66FD206C3; Tue, 2 Jun 2020 04:48:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591073333; bh=1X+E1nV4q10TYL0yBULYEG3do5ScvWP0tpCoRjj5mv8=; h=Date:From:To:Subject:In-Reply-To:From; b=IVtixiu0DbLtoM0rprS6iGbu/DDcnDGeYbnnAqXI1Pxqm/QmHN8xt3mhFFuk82Lwm DHVosnSY80/FHP0O4j9AtgKVAO0JXnZ4y2I/2WoTyK0THyOaefzcS3RAht9A2DXvyO SPZxb/HE5iXn2k94A1D45Y75muFxgoTIzJEePoiQ= Date: Mon, 01 Jun 2020 21:48:52 -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: <20200602044852.QrPiwDKfA%akpm@linux-foundation.org> In-Reply-To: <20200601214457.919c35648e96a2b46b573fe1@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Queue-Id: 16DA31804B663 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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; _