From patchwork Fri May 1 01:52:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11522009 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 BFAFD913 for ; Fri, 1 May 2020 01:53:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8BDDD2074A for ; Fri, 1 May 2020 01:53:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IklgJ3X+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8BDDD2074A 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 AF1778E0006; Thu, 30 Apr 2020 21:53:17 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A521A8E0001; Thu, 30 Apr 2020 21:53:17 -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 8CC7C8E0006; Thu, 30 Apr 2020 21:53:17 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0058.hostedemail.com [216.40.44.58]) by kanga.kvack.org (Postfix) with ESMTP id 71AF38E0001 for ; Thu, 30 Apr 2020 21:53:17 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 343A2180AD80F for ; Fri, 1 May 2020 01:53:17 +0000 (UTC) X-FDA: 76766477634.21.nest72_9112db65b7a25 X-Spam-Summary: 2,0,0,47a97faba893ec09,d41d8cd98f00b204,richard.weiyang@gmail.com,,RULES_HIT:41:355:379:541:800:960:965:966:968:973:988:989:1260:1345:1359:1534:1541:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:4321:4385:4390:4395:4605:5007:6261:6653:7514:9413:10004:11026:11473:11658:11914:12043:12297:12438:12517:12519:12555:12895:13069:13311:13357:14096:14181:14384:14394:14687:14721:21080:21444:21627:21666:30054,0,RBL:209.85.208.66:@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: nest72_9112db65b7a25 X-Filterd-Recvd-Size: 4245 Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Fri, 1 May 2020 01:53:16 +0000 (UTC) Received: by mail-ed1-f66.google.com with SMTP id k22so6224259eds.6 for ; Thu, 30 Apr 2020 18:53:16 -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=qmO2teDKNVVM1SwTPbEO3I1g0qYZy8+bZ8T5vEIKOEA=; b=IklgJ3X+Nn1j2h4folWHbFv3GAF2mbpLt8qjUfZ6kM5BtiPNTD7swT8UthYE09my8B IdfjfoxhHKiu9+Hj9cHuEep5hOAV5j0d8z3oM1FctJ8QcLiZLU2QyHIc7hOd8/6Ffsma 4DxurCOjIu31jMBHVXUVvU5/qHn3RlY3PAoduJ/YHDI7lltf1EakLiHEjuSlh41JZfDy Ed0JaQ6FhIj7sIRGAHGop49RLpmKu/Za8gJ52ssiQPcb5XV+VU66G9x/E0XqanK5ztVq kbY3nBP0kcDPQ61ajaMGdy+Uk+kKanjsfYQDCAdMz5d4s8TznqGeZe7nsvymw6lX+Plo KulQ== 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=qmO2teDKNVVM1SwTPbEO3I1g0qYZy8+bZ8T5vEIKOEA=; b=V5ai0A8a2miYYxl7TtTdrOqDrFJQZ9dmqYsVBMnWL9+dqlIt1x/maWZ/uNJND1FzLc 7jlIQGqyX5s2cXYOTu14UYWbfLwOxr6K4B/4l+Ej4AJI8hXfnd9pbJ7qptqjXj9PKVeh RhmxjMyEEwfEgkw7phR1Mn4U3Rke1h24hJHcjqBzQLapH9x+guKsI5kTUZZ6vgNZWVjA yKt/vgRGw+qVAmD5FAsJMskI35QrXwEpfIrj46LD9HR7sho5VxL9jXKUN/JAqpEH9UsL oXbCacZo2HKiE4BDaGJEunuHabTRQb5xwA5/+kMlGv33ezW9pn+TbtssXlU0Uw/Hmh3h QpJQ== X-Gm-Message-State: AGi0PuajmLmX2ZWzg+ZHooYH0L/lfMvpVlETPKBMEY1SW567FmTJ2AU7 wL9lu/DU17qBR7AXk9SoP8I= X-Google-Smtp-Source: APiQypIq9ryOlak/rz39kcVg8Q7gUgSUakpIFnzLSrGRze3GlvQuw8lQICCABQYv3QaFwSjh/f3KvA== X-Received: by 2002:aa7:d9d8:: with SMTP id v24mr1605224eds.27.1588297995873; Thu, 30 Apr 2020 18:53:15 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id n17sm165098eja.9.2020.04.30.18.53.15 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Apr 2020 18:53:15 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, ying.huang@intel.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Wei Yang Subject: [PATCH 2/3] mm/swapfile.c: __swap_entry_free() always free 1 entry Date: Fri, 1 May 2020 01:52:58 +0000 Message-Id: <20200501015259.32237-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200501015259.32237-1-richard.weiyang@gmail.com> References: <20200501015259.32237-1-richard.weiyang@gmail.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000300, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: __swap_entry_free() always free 1 entry, let's remove the usage. Signed-off-by: Wei Yang --- mm/swapfile.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index f73e0c11fab9..1a877d1d40e3 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1251,13 +1251,14 @@ struct swap_info_struct *get_swap_device(swp_entry_t entry) } static unsigned char __swap_entry_free(struct swap_info_struct *p, - swp_entry_t entry, unsigned char usage) + swp_entry_t entry) { struct swap_cluster_info *ci; unsigned long offset = swp_offset(entry); + unsigned char usage; ci = lock_cluster_or_swap_info(p, offset); - usage = __swap_entry_free_locked(p, offset, usage); + usage = __swap_entry_free_locked(p, offset, 1); unlock_cluster_or_swap_info(p, ci); if (!usage) free_swap_slot(entry); @@ -1292,7 +1293,7 @@ void swap_free(swp_entry_t entry) p = _swap_info_get(entry); if (p) - __swap_entry_free(p, entry, 1); + __swap_entry_free(p, entry); } /* @@ -1715,7 +1716,7 @@ int free_swap_and_cache(swp_entry_t entry) p = _swap_info_get(entry); if (p) { - count = __swap_entry_free(p, entry, 1); + count = __swap_entry_free(p, entry); if (count == SWAP_HAS_CACHE && !swap_page_trans_huge_swapped(p, entry)) __try_to_reclaim_swap(p, swp_offset(entry),