Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2214664ybz; Sat, 18 Apr 2020 18:41:52 -0700 (PDT) X-Google-Smtp-Source: APiQypK2XhYR9VCO0fZbns4ImBJnssXXxk0ruli8zzXJfLFK+/VLFzXjfzmrj/r6knrrDWVrXi8b X-Received: by 2002:a17:906:7d02:: with SMTP id u2mr10024291ejo.48.1587260512650; Sat, 18 Apr 2020 18:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587260512; cv=none; d=google.com; s=arc-20160816; b=0Tu7I8afLuy6gMYGR6c+a+44qhr+8t75NETmz97LTnA55A1CrOVsP+yURz/1PY2oLA c2LCgZhqB/iBi4fX6kWYFDK/IYKwAD4T+wNe6FWEL4cFb9H1XtgiAEMJEmMg+oEunf9m oXthntCgWilFGAcneSdWvciK/ALUZbIZVXVFKDKEjVwFF+AJhon0vcss6lyWM2pO4bla k6cETfW6bhd6Vt6UQdcHhW8iefDSFkcFSluQ1HCnnUNVtUhHTba3leHuBG5Otyc/28bs fUkzmI+mzstPwhaqQzn/LP7qybt/8M4Xz/7BWcUXt+69KJmXp7AhB3/Z1hELYDNz0wPC 8d2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=bEpAYCD5bOLpZUQC8vcQ6f94jMBWQvvy2nCjFU0ls9c=; b=frF7air1cmChQXywcX+HHqMxfCnDSua7SSX7PiGUaithO8DJM1PX4/4vVrqYpc7xYs GJEI0j3I24fSp09dQW3FGpSJGInno+1iEQzXJiAxDADJU8w5xRPf70/V9KipBjRpwQAg CHS9rQlGGeYbAD0/FIuTrqoLtOJJSBVQEkzDz2UotvpcovOTtPtphWY2qTtX+NBD5XET /wM0a0krIRvKbqUSqRelhf6pRPd8ZCjfB70wYVAriGdBwDATQ+0LZ74Q7ct/bbMeAhnW Bq2PZ7iNi8V4yKn/eCO/vipqeK28FGFgTaWmFknqnhxQVyH8nM6xt6NmYmEpBkcrxhuF je5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t4fK9jlK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pv20si13449937ejb.295.2020.04.18.18.41.30; Sat, 18 Apr 2020 18:41:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t4fK9jlK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726079AbgDSBji (ORCPT + 99 others); Sat, 18 Apr 2020 21:39:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726012AbgDSBjd (ORCPT ); Sat, 18 Apr 2020 21:39:33 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0B7EC061A0C for ; Sat, 18 Apr 2020 18:39:32 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id pg17so4820181ejb.9 for ; Sat, 18 Apr 2020 18:39:32 -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=bEpAYCD5bOLpZUQC8vcQ6f94jMBWQvvy2nCjFU0ls9c=; b=t4fK9jlK1wgUSy+Pp+/3CzqaLFZ/PyK13I1ufEUVNj/FijAUxfHLltfr5bpd84ZhCS 3PUKQlbLSBRxWVL13fRsFXBu5QuoCjnlHC76ighBdO67VY96Se4SQvZutSJGHvP3JB8K duGuAycRktDcEnZ+jhMTw0wrLBn+wQ6JN5xLnzMPjUy+B6hFHS3cYC3ZgliyE7tWl6bz 2qL++6iy73Rj6+ZbC601D9vsRxPWYunk6L6NbTykXXRZ2kyN0LJAOV+0FG6vy/b4O96V +0ibXSLhcis1geYfN3aija8bdcn35ZVhqCfnQM/qTp/m5AI+8RWMdXSPsXkr95fkXZta 8zpQ== 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=bEpAYCD5bOLpZUQC8vcQ6f94jMBWQvvy2nCjFU0ls9c=; b=gtpo3/bpxXV39dQSOtPadbUWbimKAkQTQphE+4qBHpjc8jo3QWPvTu8LA/zhl0hI4P F3r6cdo6zs5b4Wt11dU5v+vKE6ebaSUp1dXiZTOFaUSMEOi5uB516pqv86SzhwAQw+Fv QdSexp/LBdaZxc2RvFUHgdINAxhAOT1oIIt2pzvI8YZe+KjtnOKZUbeWWXw02/m/xUe2 U5iA6nkIPh3LfWl6kafcUPpYHdcZv1zurQ1+Yvsk2XuS5EUmyBt7EILnXQFVu7GKI4gY bDSxQ8204P6ksgJ+n9nLJTBrUm6Q1egy6j76TNZAVuvObJD0Pz2Eld/efQZtZV4yPD35 Mv/g== X-Gm-Message-State: AGi0PuYCv2Oe0Z8iRh1kG5lAmr+k/1UNLvsGIh+/7ZKfVPeORI/2r8Lv ueqp7SpQCSTtevdbEFRyX+g= X-Received: by 2002:a17:906:a441:: with SMTP id cb1mr10262872ejb.242.1587260371291; Sat, 18 Apr 2020 18:39:31 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id l2sm3615505ejz.29.2020.04.18.18.39.30 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Apr 2020 18:39:30 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, tim.c.chen@linux.intel.com, ying.huang@intel.com, Wei Yang Subject: [PATCH 3/4] mm/swapfile.c: compare tmp and max after trying to iterate on swap_map Date: Sun, 19 Apr 2020 01:39:20 +0000 Message-Id: <20200419013921.14390-3-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200419013921.14390-1-richard.weiyang@gmail.com> References: <20200419013921.14390-1-richard.weiyang@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are two duplicate code to handle the case when there is no available swap entry. Just let the code go through and do the check at second place. No functional change is expected. Signed-off-by: Wei Yang --- mm/swapfile.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 3aae700f9931..07b0bc095411 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -629,10 +629,6 @@ static bool scan_swap_map_try_ssd_cluster(struct swap_info_struct *si, tmp = cluster->next; max = min_t(unsigned long, si->max, (cluster_next(&cluster->index) + 1) * SWAPFILE_CLUSTER); - if (tmp >= max) { - cluster_set_null(&cluster->index); - goto new_cluster; - } ci = lock_cluster(si, tmp); while (tmp < max) { if (!si->swap_map[tmp]) -- 2.23.0