From patchwork Sun Apr 19 01:39:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11497077 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 A547792C for ; Sun, 19 Apr 2020 01:39:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 71ED621927 for ; Sun, 19 Apr 2020 01:39:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JWi1xbRp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71ED621927 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 D87258E0007; Sat, 18 Apr 2020 21:39:33 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D37268E0003; Sat, 18 Apr 2020 21:39:33 -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 C28958E0007; Sat, 18 Apr 2020 21:39:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0239.hostedemail.com [216.40.44.239]) by kanga.kvack.org (Postfix) with ESMTP id A71CC8E0003 for ; Sat, 18 Apr 2020 21:39:33 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 6326E181AEF2A for ; Sun, 19 Apr 2020 01:39:33 +0000 (UTC) X-FDA: 76722897426.10.bat42_364fe588ef352 X-Spam-Summary: 2,0,0,f26bf8569d634132,d41d8cd98f00b204,richard.weiyang@gmail.com,,RULES_HIT:41:355:379:541:800:960:965:966:973:988:989:1260:1345:1359:1437:1534:1540:1711:1714:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3350:3503:3865:3867:3871:3872:4321:4385:4390:4395:5007:6261:6653:7514:9413:10004:11026:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:12986:13069:13311:13357:14096:14181:14384:14394:14687:14721:21080:21444:21627:21666:30054:30070,0,RBL:209.85.208.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:24,LUA_SUMMARY:none X-HE-Tag: bat42_364fe588ef352 X-Filterd-Recvd-Size: 3680 Received: from mail-ed1-f67.google.com (mail-ed1-f67.google.com [209.85.208.67]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Sun, 19 Apr 2020 01:39:33 +0000 (UTC) Received: by mail-ed1-f67.google.com with SMTP id l3so1592091edq.13 for ; Sat, 18 Apr 2020 18:39:33 -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=BQFU3HkYECZtzmLCZGRzFVrW3CLq1ebiJ2ruTF8YJ+o=; b=JWi1xbRpg1gcYErF+rSn53PAiJKAfS7QbtMyFZ4RgGkL7u1vUcNQgkZ378kFXNRilg SdrSiY3vuCQiU+gV7fMtrgOxrT/saiVyvk46pIvPLSRfbC2ERmaiYh7Zj/im+axtnW2g vRPhUjuTseEEKI0RGvYSidchsVXWMNQO4fVBPLkjN3Tps4VrSqeG49kZ8DKWCZcjuk6U jKbOrKephz+itE7eW5fNOtSgP/QzkagitR0YlUaeM3GR+r8mLxN9xydsVvWuphKQXNsI yyWzjhoP/QmXOW05LRIGrM5blgbq0qVqjUk1KAdl4i3TpcKNfPao9KDuRyUSkgAzd938 QbTA== 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=BQFU3HkYECZtzmLCZGRzFVrW3CLq1ebiJ2ruTF8YJ+o=; b=Tc4/ic7CjiDxuvXqmVleZvQWdWsd6uJYyvbCfH4xI6KQv5SYqr6SKL2+0iKuc6RVxN 8lMZnnDd/OFe2zmvg4hS5NKx4txceP2tVFsan+UgqjLt/KO+/aPGDTocUz2hzmgPyT00 zaAy439O8a08zkJhfWCMc3lMF/JOJqbnN11K7nhRoUJvwOgTT99AhARsLYRpwsgD0+5/ /z+sfM0urN3JbHUItgVE8MYSi075yOekP+mNCbsQ4DGAdzLnEiCoIkdR1OThV4zyYGCi OuqDv3Z2dFAZg7IbiQTwApTizujCPU31gtbmP6C0ajMf723PhbXYLqQmRHxgg3pBHyzr yEnA== X-Gm-Message-State: AGi0Puao2/Gbp19OOevjq5IE+Z3irWPKSvS2eBrkibxDRurWSuwL39Xr lzfYRhnMuY+Y+wARVGkuJyM= X-Google-Smtp-Source: APiQypJJFRIBBVlp00jXau9ACyNbh3FER9denpX7MQqcJOLHpwlzdltDRqQr0Xkszo+o6+DdWKhGnQ== X-Received: by 2002:aa7:d14e:: with SMTP id r14mr9159841edo.200.1587260372227; Sat, 18 Apr 2020 18:39:32 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id r10sm396631edm.55.2020.04.18.18.39.31 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Apr 2020 18:39:31 -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 4/4] mm/swapfile.c: move new_cluster to check free_clusters directly Date: Sun, 19 Apr 2020 01:39:21 +0000 Message-Id: <20200419013921.14390-4-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> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Each time it needs jump to new_cluster, it is sure current percpu_cluster is null. Move the new_cluster to check free_clusters directly. Signed-off-by: Wei Yang --- mm/swapfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 07b0bc095411..78e92ff14c79 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -603,9 +603,9 @@ static bool scan_swap_map_try_ssd_cluster(struct swap_info_struct *si, struct swap_cluster_info *ci; unsigned long tmp, max; -new_cluster: cluster = this_cpu_ptr(si->percpu_cluster); if (cluster_is_null(&cluster->index)) { +new_cluster: if (!cluster_list_empty(&si->free_clusters)) { cluster->index = si->free_clusters.head; cluster->next = cluster_next(&cluster->index) *