Message ID | 20230529061355.125791-2-ying.huang@intel.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0693EC7EE23 for <linux-mm@archiver.kernel.org>; Mon, 29 May 2023 06:14:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9293B900004; Mon, 29 May 2023 02:14:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 88C53900002; Mon, 29 May 2023 02:14:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6DD89280002; Mon, 29 May 2023 02:14:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 59E73280001 for <linux-mm@kvack.org>; Mon, 29 May 2023 02:14:22 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 255DCC01F2 for <linux-mm@kvack.org>; Mon, 29 May 2023 06:14:22 +0000 (UTC) X-FDA: 80842277964.12.A214265 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf12.hostedemail.com (Postfix) with ESMTP id 1ECBC40005 for <linux-mm@kvack.org>; Mon, 29 May 2023 06:14:19 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=GQIwOG2F; spf=pass (imf12.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685340860; a=rsa-sha256; cv=none; b=XNwS8FC2mtIga5Kla4/rYxnzK77FfuCLST/60JiDMsfauW9sQM6OihFHzSJE3NjbYIincs c7FwKDgdqUpJGnC2zuAJelzIdGnqcklFRXfUOjizb/7xSLUR9nfZU0LFjuUsMyyOe1EjPa tWfmD3Q1vn9vmxjjSfcMXM0GvIUq1SA= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=GQIwOG2F; spf=pass (imf12.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685340860; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gTjWga6OsszRk2MnRlZS+LYEg6py10ZYIDqkJr0/juk=; b=1vU81vcAWgCdQchalydZ4AXraRqFchwSd4I/N1qgQY6I/NqsC3CixcX2bwfiQDRTaLOKku zzIZuBQ9j+tGFiKpHJE9q3nFfsjp1hhccM6QYo05yL+sJzFL4B37KPcgpF8lX8SJMF0p2u 2keqdiZ9bo2yQ554ciH1fO4ZAGQ7qag= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685340860; x=1716876860; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Kl6+gAKi9abH9eFCSqmd4OqB2g+JQSA7OXalXR3MGok=; b=GQIwOG2F7Tj5a/0df1l4BkiAKJB+Gi/J24ohc7wofsFTswcd5irnHLFq njt1sPkM9N8DIQ7PM1m28DYaN8vHWe2yYenXMYSvRG43/N0YqYTxW1mSF ZBf7R1JElSO60ltyAzqj/v9LI1XD2E8xkWZirkpl5TqNu4N/wzMjpp7yd dAHqpLV+7ovUR7GBwxBMNS752kBBhl9IEvlMTS5sFPW0u7m6rowpWQ5fI WdySvhLXuukbs/YEh/Ad6dcl1pEf9jBAZ0gNIJ3UBeXLTloOkz/wgqtMi mbihH4gH3kb33x0il6gKGNrGkmooI70mgFRsE7MRQKWEhNylzXDqWQ4FF Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10724"; a="357881790" X-IronPort-AV: E=Sophos;i="6.00,200,1681196400"; d="scan'208";a="357881790" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2023 23:14:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10724"; a="1036079982" X-IronPort-AV: E=Sophos;i="6.00,200,1681196400"; d="scan'208";a="1036079982" Received: from azhao3-mobl1.ccr.corp.intel.com (HELO yhuang6-mobl2.ccr.corp.intel.com) ([10.255.28.126]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2023 23:14:15 -0700 From: Huang Ying <ying.huang@intel.com> To: Andrew Morton <akpm@linux-foundation.org> Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying <ying.huang@intel.com>, Yosry Ahmed <yosryahmed@google.com>, David Hildenbrand <david@redhat.com>, Hugh Dickins <hughd@google.com>, Johannes Weiner <hannes@cmpxchg.org>, Matthew Wilcox <willy@infradead.org>, Michal Hocko <mhocko@suse.com>, Minchan Kim <minchan@kernel.org>, Tim Chen <tim.c.chen@linux.intel.com>, Yang Shi <shy828301@gmail.com>, Yu Zhao <yuzhao@google.com>, Chris Li <chrisl@kernel.org> Subject: [PATCH -V3 1/5] swap: Remove get/put_swap_device() in __swap_count() Date: Mon, 29 May 2023 14:13:51 +0800 Message-Id: <20230529061355.125791-2-ying.huang@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230529061355.125791-1-ying.huang@intel.com> References: <20230529061355.125791-1-ying.huang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 1ECBC40005 X-Stat-Signature: e83tqkcnje7y3mgqsuuiu9x7581uceeq X-Rspam-User: X-HE-Tag: 1685340859-378228 X-HE-Meta: U2FsdGVkX1+U3TFa1KHMNvNXkqstdBgZIY19PD4PItpUXQ0+je6an41wchhJZ3TNF8Wrgl4ULNOlq4GAybZAHMfmrTcDEvMFsxhrNIWcI1QQ1lxfb93G6PHssFjy6yUp5Wc11ZX5S6SnDhsqI3bZac+0i7ZtsgJlbZIjv+fqTPJ+Vw8Vh6895QZaFuNftjv0Rn7/E7u3XGLiasKDmVbpnJfldFc6TRs72b4hvPr9hc9qhAfC03VhYJQCc2gcMLBe6zRbsGl+2/d5RIvqu7+Xds51/weaBcQKowGg7W4pSfxCFydz5opx6oz3C9NGtzNrQuR0DWpcjD/Br0giDjB3YoGoEEgIjdMB1bpiHz896Qr6VUbORnA2T9DndxUGLo1zDyeH4oJzG4VeTXSKdzaBERcuwx76liQIM23Yhc+jl4xawBQtSz7/1XGJ0DrX4oLR9a3Vp554SDHETWhrxF5juQxYuaCfYdHyVx5sEfWGbtTgIBgL3vb5r/MmLDoV93o7XuV57hfya0CDq+Q54fudG54KqQ8kL+rA48MKPmTg4yw8ghdRHkJUwNAzh+Z+SnQCsDBUx9orxlz57Qa3vpZd6L1qeaa03AU/xueJ+ZsOrvCV/7zYpcN4puLj8PcR3BvGZiV4xlk7ZoiVS8hRrN+CYgX1wnh1jqN4LJ4MuikWv6SmxuPT1vtTDHPhJqdprbEvVS6kWCX+V76w37Qhntlu/lSCuJSuUZcmhG88AZ9BFfThuTajafPlBTehuTG9C9Hy0yBVv4FwU3ZI+8T8DcADQM3pN8sScuW71DNJ26XGJQpmy/v6KfZvaLdWYytys1LAPzkOI9ohO2Ryd4cZXqHxKQt2CKBoOJcftqjZ7Q12gVkLDgdyG6P2v3Kvz7m/aSYZDAYrUIf5IrY8usjQmEaDbSc3xSCR1jZDgNJu6+a+M2QsmHslkoAAV48ZFxZQiJuoySUeTBBGBwB20O7eEWY OwWxfjTe dMv8tnlKGZd8ICjeI/Xz/Z78FAU7YgFyVNpfDv1BvYvZ0bWtxr7i/pNRM2WTvlu3CiKRmFvvd5Y9yG7zYnbpdHIOs4YahdiHWWLtwZvUoZdfVmWl2VF7OnI0d3o1BPq8+lG8qHPiBT3vvCmUC0BKqh+sXYn+SDbqn1rfhu/p4pA/ByNladi80gp2pcgtNqbxHnYVWuEOVYmq3Y+dLMKyGI3twFi/k7Y034/OmeY/0oK0p9u9scbshLY8AFa4QlQ7Ry+Vcjq4geJsYRU9UuJ+rlXuPC29097bq9u1gceMvbV0dVL84ILfN68oR8j1gzquxxs86qmh1YPE4s+VI97aB69MWIGHxZ6jU26/387blWobimLA+Mz52pg5mbL2pwly/Bkd+toTKD4glQFOXIUCnwFRRwEZJDcGIZF+JqorIW0LJKZ0o4rF+gh05AtpsLiSaGxN8yelOV2NnqJsR2m/VSHeoevOfk6bFrVnagmiQkK2zZ4jZJEvNuTH6poJarN5No/Hv 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: <linux-mm.kvack.org> |
Series |
swap: cleanup get/put_swap_device() usage
|
expand
|
diff --git a/mm/swapfile.c b/mm/swapfile.c index 274bbf797480..8419cba9c192 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1432,16 +1432,10 @@ void swapcache_free_entries(swp_entry_t *entries, int n) int __swap_count(swp_entry_t entry) { - struct swap_info_struct *si; + struct swap_info_struct *si = swp_swap_info(entry); pgoff_t offset = swp_offset(entry); - int count = 0; - si = get_swap_device(entry); - if (si) { - count = swap_count(si->swap_map[offset]); - put_swap_device(si); - } - return count; + return swap_count(si->swap_map[offset]); } /*