From patchwork Sat Mar 28 06:05:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11463419 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F00AD92A for ; Sat, 28 Mar 2020 06:06:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BD57C206F2 for ; Sat, 28 Mar 2020 06:06:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X+h/l6FE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BD57C206F2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 94DD26B0037; Sat, 28 Mar 2020 02:06:15 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 860346B006C; Sat, 28 Mar 2020 02:06:15 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 725D06B006E; Sat, 28 Mar 2020 02:06:15 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0223.hostedemail.com [216.40.44.223]) by kanga.kvack.org (Postfix) with ESMTP id 5AB056B0037 for ; Sat, 28 Mar 2020 02:06:15 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 665D9582D for ; Sat, 28 Mar 2020 06:06:14 +0000 (UTC) X-FDA: 76643735868.04.line65_5388fb80c752c X-Spam-Summary: 2,0,0,4b2b49ebdb52551a,d41d8cd98f00b204,richard.weiyang@gmail.com,,RULES_HIT:41:355:379:541:800:960:968:973:988:989:1260:1345:1359:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3866:3867:3870:3871:3872:4250:4321:5007:6119:6120:6261:6653:7514:7558:7901:9413:10004:11026:11658:11914:12043:12297:12438:12517:12519:12555:12895:13069:13311:13357:14181:14384:14394:14687:14721:21080:21444:21627:21666:30012:30054,0,RBL:209.85.128.67:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: line65_5388fb80c752c X-Filterd-Recvd-Size: 4026 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Sat, 28 Mar 2020 06:06:13 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id d1so15042157wmb.2 for ; Fri, 27 Mar 2020 23:06:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QyxtkEAHQnaf1QErBru4etFEtt1eRtjW95hNmE2s3Y4=; b=X+h/l6FE0bZBg5LxVz5E/0bUlMhHU9T1/Pty0E7jAPNp8YGpQmZuECTwXBC/STO4PS 1WrNZs7bApj1wo0UThwBWVhTIjuxuPK5tqxrrvgRcrQdntAEg2wuefW1GVTP/okQ9GPO IZ4VN9amnTEdLd9SS4jnG0IRb0Huj/ca7GzdJtWrE5k+PnNbEqTYK+hudGZrZoJ+wCpF Kcpu6zPqmdYAD+t0C0HiQwD/raXAfe0yktUjhWXlmGSRSZSKGfnDtiY3VHd83D3Y7WmW FAV86wJ80f2wVv4fqwOBPoEazwcaKQQ31RKnd/6vt1Gs4WfTXFHi3eGhowoip9IClHf8 Mjlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QyxtkEAHQnaf1QErBru4etFEtt1eRtjW95hNmE2s3Y4=; b=FxLFrs1jXLWWs+HAa9pd1sdr/5E+LH+xv3L63G+ydjX+MUzdNU009ShCbxX4mAUdG0 Mr/0AgmbCpGCaFHzsXgFWLguTH8bPfARuKL4MezqpixsQcGoCkvd+N3jDuZJpOUp4Jof qw44Kba660E6o13KBkciMYSgZEb00z84l2pD6kerTfTl0SWwaEvCLlzJ3HNc/n6hgyxL aHg9RhGftZvbPBXY4JfNrrmuTAr9tReDiVW/OqW5GnJJuLcba8B0Bs1EnifneA3wWjT/ NUBlH/e3q2N0+7V7lUybMwBfqu668WOh8AezLcOjQJVY1nqNIFYdSKHS0Dp5gWrw16Un OOTQ== X-Gm-Message-State: ANhLgQ2r1DCOFyLv+0d62UnKXmG2hkVK2RFmBFsIN4Kg93QRFB/+uaye uUR72SbcUYKycCECJ+j7mqU= X-Google-Smtp-Source: ADFU+vsnyZXOBaYycEjCrZ8ZHd1gj6YWTO9Um/rYrjUd4y77Fln6LQENeY2av+WepOyAUMPx416g7w== X-Received: by 2002:a1c:a7c4:: with SMTP id q187mr58664wme.88.1585375572913; Fri, 27 Mar 2020 23:06:12 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id d124sm10967627wmd.37.2020.03.27.23.06.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Mar 2020 23:06:12 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wei Yang Subject: [PATCH 3/3] mm/swapfile.c: remove the unnecessary goto for SSD case Date: Sat, 28 Mar 2020 06:05:20 +0000 Message-Id: <20200328060520.31449-4-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200328060520.31449-1-richard.weiyang@gmail.com> References: <20200328060520.31449-1-richard.weiyang@gmail.com> 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: 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. Signed-off-by: Wei Yang --- mm/swapfile.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index adf48d4b1b63..f903e5a165d5 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -756,9 +756,7 @@ static int scan_swap_map_slots(struct swap_info_struct *si, /* 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) { @@ -866,8 +864,6 @@ static int scan_swap_map_slots(struct swap_info_struct *si, 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;