From patchwork Sun Apr 19 01:39:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11497073 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 CD64992C for ; Sun, 19 Apr 2020 01:39:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7FE2A21D7E for ; Sun, 19 Apr 2020 01:39:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tD75O/Fh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7FE2A21D7E 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 7BB9B8E0005; Sat, 18 Apr 2020 21:39:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 76CBC8E0003; Sat, 18 Apr 2020 21:39:31 -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 6A95F8E0005; Sat, 18 Apr 2020 21:39:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0246.hostedemail.com [216.40.44.246]) by kanga.kvack.org (Postfix) with ESMTP id 508F08E0003 for ; Sat, 18 Apr 2020 21:39:31 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 05571824556B for ; Sun, 19 Apr 2020 01:39:31 +0000 (UTC) X-FDA: 76722897342.24.cord30_35f31cb3efd60 X-Spam-Summary: 2,0,0,ec416b2fac85664f,d41d8cd98f00b204,richard.weiyang@gmail.com,,RULES_HIT:41:355:379:541:800:960:965:966:973:988:989:1260:1345:1437:1534:1541:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3867:3868:3870:3871:4385:4390:4395:5007:6119:6120:6261:6653:7514:7901:7903:9413:9592:10004:11026:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:13069:13311:13357:14181:14384:14394:14687:14721:21080:21324:21444:21627:21666:21990:30046: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: cord30_35f31cb3efd60 X-Filterd-Recvd-Size: 4138 Received: from mail-ed1-f67.google.com (mail-ed1-f67.google.com [209.85.208.67]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Sun, 19 Apr 2020 01:39:30 +0000 (UTC) Received: by mail-ed1-f67.google.com with SMTP id r7so4515046edo.11 for ; Sat, 18 Apr 2020 18:39:30 -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; bh=YQ0IcD0MJa87Cl5cTZ+wxBcgc8xap3RC76BVjfIWVzU=; b=tD75O/FhAiU4tZlZn9qCLTOtwiBMTsQyy00zKr8jfD0SDT/f3eOlUGzOufRnPAAoF9 I1st4PwIcwVtGKwAMlZ4my/xrbNqmEQtJhw6/jhriv0h185vZFB7nPbIG5FJ+u16OqZn cGAtjUJqvcLR8hzRG97pFV4xaPf4qVTGK3WtUa43hyU1OwHZzQ54+ARTkj865FqFrcBg FthwoEEPalDoI6PZu9z1/93deBEl2du4YAFaAvz2NZx+odT7qSOwE5Imk6bhd9B0LKV0 8UW4n/TEPNKHzxXVr2LwrB6rPCb9Y0gxpJoFh055ywb0OcJOjrKukGTAD4DcgJ2sSSGr aIaA== 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; bh=YQ0IcD0MJa87Cl5cTZ+wxBcgc8xap3RC76BVjfIWVzU=; b=O2HMN6Wr59HRtvR8yV6y8Ajp97fKyksEfuP3cKys5rucP7Qy1d+/R2yUM5VJ5uwdti yrV8VXNsd9QRx1AixwVF95CbBv4hoPj7OiY6Eeq8ks29VdBy4cFyVwcnUfCf96l9wqFn xR4xbELTG+IUcJpri8TrOEWmi3krQHcgTsQxe1cPBabzCzISKBNYe05nRHTR4czjHg2x E7T9ykMFY2NBFW8u67uYnQqDamtGgUVMALAkBV1Bups8GdiuGQxGOOA93yIxlS+vQ8gt BB+fw7oSPoAAG9j0fA0L6ZepQaO7cWKm7Nl2+xPPTXASWC6s6wOOkt1bSwS1iKoVTdMd 7qrw== X-Gm-Message-State: AGi0PubVoopeO6IpQt16BeQUjk64TllmBX/VVsyn9rYIc3uOgN0v8LDP 7Jez/6JQ8KImVBJpjAZKBhw= X-Google-Smtp-Source: APiQypKtrQeAtBQk489goKZCmTEe3TzZzMjbpTdAWBmVki5DbC5eT0gEuTu4vqJXhH84TKEqepnGNA== X-Received: by 2002:a50:cd89:: with SMTP id p9mr8914024edi.188.1587260369506; Sat, 18 Apr 2020 18:39:29 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id k33sm3345395edc.18.2020.04.18.18.39.28 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Apr 2020 18:39:28 -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 1/4] mm/swapfile.c: found_free could be represented by (tmp < max) Date: Sun, 19 Apr 2020 01:39:18 +0000 Message-Id: <20200419013921.14390-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 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: This is not necessary to use the variable found_free to record the status. Just check tmp and max is enough. Signed-off-by: Wei Yang --- mm/swapfile.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index c457f3be6944..654bad5173bc 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -601,7 +601,6 @@ static bool scan_swap_map_try_ssd_cluster(struct swap_info_struct *si, { struct percpu_cluster *cluster; struct swap_cluster_info *ci; - bool found_free; unsigned long tmp, max; new_cluster: @@ -623,8 +622,6 @@ static bool scan_swap_map_try_ssd_cluster(struct swap_info_struct *si, return false; } - found_free = false; - /* * Other CPUs can use our cluster if they can't find a free cluster, * check if there is still free entry in the cluster @@ -638,21 +635,19 @@ static bool scan_swap_map_try_ssd_cluster(struct swap_info_struct *si, } ci = lock_cluster(si, tmp); while (tmp < max) { - if (!si->swap_map[tmp]) { - found_free = true; + if (!si->swap_map[tmp]) break; - } tmp++; } unlock_cluster(ci); - if (!found_free) { + if (tmp >= max) { cluster_set_null(&cluster->index); goto new_cluster; } cluster->next = tmp + 1; *offset = tmp; *scan_base = tmp; - return found_free; + return tmp < max; } static void __del_from_avail_list(struct swap_info_struct *p) From patchwork Sun Apr 19 01:39:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11497075 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 4F95281 for ; Sun, 19 Apr 2020 01:39:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 12B4421927 for ; Sun, 19 Apr 2020 01:39:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ic9YCn4h" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 12B4421927 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 5C0CD8E0006; Sat, 18 Apr 2020 21:39:32 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 549558E0003; Sat, 18 Apr 2020 21:39:32 -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 413D08E0006; Sat, 18 Apr 2020 21:39:32 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0231.hostedemail.com [216.40.44.231]) by kanga.kvack.org (Postfix) with ESMTP id 2ABE78E0003 for ; Sat, 18 Apr 2020 21:39:32 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id CD1C7249B for ; Sun, 19 Apr 2020 01:39:31 +0000 (UTC) X-FDA: 76722897342.13.tax50_3610586270e58 X-Spam-Summary: 2,0,0,5d47bb9f6b077dd8,d41d8cd98f00b204,richard.weiyang@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1359:1437:1534:1539:1568:1711:1714:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3867:3871:4321:5007:6119:6120:6261:6653:7514:7901:7903:9413:10004:11026:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:12986:13069:13311:13357:14181:14384:14394:14687:14721:21080:21444:21627:21666:21990:30054,0,RBL:209.85.218.68:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.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: tax50_3610586270e58 X-Filterd-Recvd-Size: 3456 Received: from mail-ej1-f68.google.com (mail-ej1-f68.google.com [209.85.218.68]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Sun, 19 Apr 2020 01:39:31 +0000 (UTC) Received: by mail-ej1-f68.google.com with SMTP id re23so4826448ejb.4 for ; Sat, 18 Apr 2020 18:39:31 -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=0z07W0i5lACCA4tx1d7PSEMm+ePwZcbmHDi4QNrUNW8=; b=ic9YCn4huKX1BFpVVvXT8DU2gGd9dOXFhlxx+eI5j2c8I66fl2T9LdK7jfq6A+6O1G g6NigPIbVwqrMeayiy1hOuVAsNSAK/syvhsRpHAcLVXTQ92vHZOMXIhTFN2rQlTPPs1g Fk0gmRH5mYwtlJ8Cb3Jk7IhBLkrMThnNerPRpsoaFPh6/9S6UiEqnN7UV55Iys++dfy0 N+kgHg44B7jxTywaF354O0y+V9RySlEotFj1cQcULPCgUoYD0fTD/WAiXjTk58xGIvDn LAyGTl+QKyn1RlgVTZRWLktRVYXJ6f1zj0ssPKGfIZzRFqntvnZ7LAgWMObcvUUouil7 fBPg== 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=0z07W0i5lACCA4tx1d7PSEMm+ePwZcbmHDi4QNrUNW8=; b=bDfteboGOPwM3iNoM//XG5dDRUJ9IXeShKhjBR0wOIC18GYk2ILycp/6lRTyZAHyJa l98KoS+u4vG45mYYX7qYm2xF81cV5GHnB9Fk7i3XqwbdOny+X7J2BZNxfQvcrTyqdh4j 5mgSAychOOou1yyIMkUS2kzgs6cKMxmjPFZWuht+djVR9B6L93kjMafHsGwxKwUMJsrU 1XApmfsqDteYgFLdksIF3F+bLyoFnnYVsA8S3htcZQ2mdZngAYE4yxZlzsoojde0A1he 3AsFkGoFoihNwXjws3tCpj1YX6RSuHgBuzDdrDqOAqtIaYImebzJCBqr/Xh5AQtcYDkM aJZQ== X-Gm-Message-State: AGi0PuZUPFYkdnuXEPXy+qrZteFTdSR9A1udmIQYpPdIccEJGAqaPowI p8QFdxgE58f0/y9mCbHbqOE= X-Google-Smtp-Source: APiQypLgDnYl2t/SpoaWdQtu4L+o6/wPL0v2CiO4qkeVDBcDEAQB5xhqxU7g3SeBX5A/86vcildY3w== X-Received: by 2002:a17:906:1641:: with SMTP id n1mr9988302ejd.365.1587260370404; Sat, 18 Apr 2020 18:39:30 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id e5sm3452394edq.76.2020.04.18.18.39.29 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Apr 2020 18:39:29 -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 2/4] mm/swapfile.c: tmp is always smaller than max Date: Sun, 19 Apr 2020 01:39:19 +0000 Message-Id: <20200419013921.14390-2-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.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: If tmp is bigger or equal to max, we would jump to new_cluster. Return true 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 654bad5173bc..3aae700f9931 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -647,7 +647,7 @@ static bool scan_swap_map_try_ssd_cluster(struct swap_info_struct *si, cluster->next = tmp + 1; *offset = tmp; *scan_base = tmp; - return tmp < max; + return true; } static void __del_from_avail_list(struct swap_info_struct *p) 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) *