From patchwork Wed Dec 13 21:58:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491925 Return-Path: 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 3EF85C4167D for ; Wed, 13 Dec 2023 21:59:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 723048D0049; Wed, 13 Dec 2023 16:58:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 61B2E8D0063; Wed, 13 Dec 2023 16:58:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3296D8D0060; Wed, 13 Dec 2023 16:58:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 180F28D0049 for ; Wed, 13 Dec 2023 16:58:55 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id DF5D8160120 for ; Wed, 13 Dec 2023 21:58:54 +0000 (UTC) X-FDA: 81563160588.21.A653BA0 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf07.hostedemail.com (Postfix) with ESMTP id 42C114001F for ; Wed, 13 Dec 2023 21:58:52 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=oOTferP1; dmarc=none; spf=none (imf07.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504733; 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=RkqEnzS+hsG7DLgofF6q6jsv7l6fWtgv0ou350gPTRk=; b=OUFSv6rUR07A7fhW3Rz6NDaMC9vvEprvIhNM6zuuaXC9qXCknh7FZLpBP9cEohP9zdyB4P +sKXEncgX+K9nnjQo8cHHnUKGulT3RtC0ZPxkE2MXjZbiaJbh7tZ6bcxJV/9r/+eKwQzLf kjJStzUNY8cz022e/tvcpnSGjWTbljo= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=oOTferP1; dmarc=none; spf=none (imf07.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504733; a=rsa-sha256; cv=none; b=oUKJ3dzYHV97KEM5WE8eXO7Pf5xa86FZDXdZvTect4m7YvcYYGBjpwhmJVNpTiAyr0USBh CELpEuMQK8q0S9Ar9aX40pEX634Fbuvs2gUpH3sUsfsp8V60up5rDmb0xQBZLJHAhOMh5a FBscxAnGY8VvCHYP4j4bAKoVNxoHpD4= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=RkqEnzS+hsG7DLgofF6q6jsv7l6fWtgv0ou350gPTRk=; b=oOTferP13dWV3cp8hCJKnOFHhq 6dbZcysU3BPRsaHbTtGWbSyP8ffP8OYZqinAIIK9awmzbeRXtLUxa2qSuRCbz+DuLxXU3XFhJbpeH r00goynIRsyUYAaOMch+7en5oa8fV7zXEqTQXn5gY5KF0mC8FdbdqrLJhczq4v7y4lmWDZx0+wxO4 Xlf49ypcu9kUcp5cVAevjq2XeZuFtXQfs1YaTccs86ghMMW8h8vlbcGc5pffLcPgnN8oJ+z/WNxAV s9ICsbBcTpa9AsstnC5IH9bvGG3akMt4ZdNzJawLd2C3Iq2HVKVvzkiMYYhwpBq6f0g/ZBEyq76a2 VbOSOcqw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFe-002oid-2r; Wed, 13 Dec 2023 21:58:46 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 11/13] mm: Remove page_swap_info() Date: Wed, 13 Dec 2023 21:58:40 +0000 Message-Id: <20231213215842.671461-12-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 42C114001F X-Stat-Signature: ash75s1i8yarsng8sy3rdsqb6mxgpnt3 X-HE-Tag: 1702504732-113392 X-HE-Meta: U2FsdGVkX18RRVPrBz8SeOB94LzALKaKJH7O/K+7GBmq5Nz/Ik7QAtW6zwRZ24s6sqZOWBWvOfG4zWyGNJLPMe39HxnNsoXeYh1YeKzdhEDi4yYQtVq0SxEJh1ojx0YrBZ1XSI5+OgauYj24VcWz7gYo5cn2pLavKBJOFHWSbhx6RZkon1vElBCxJl+okqRZhgORN1ANrtT/An7zVvn0SQ3sGbKgTjOkPkAB4HzdQaI38WMUl0VN6Hxd3EKS9fcj0TEwYxLqbe4knuYzYPfZQn+tSwVF7fyg2N7jyFIpCJG0S0nBakXe0iiqoZiqb9iVmt+TVryqY1w4aRyYuSOyLVPbrIVBzRKSUtGdYjvAEudh/Ezlz/6pWw5Q1GG+r20b6gDlel4lD75zy9ynuO4rMcaaf+bHbfnrlhwzIrTHFU9VzbxOUmC1AaSb53TvzCVNpZKbSbIxEFk/mtumSx+SV+VPo6EgC+Rvuy70Q0P84OXihqQJtqP/UbADUssZTze3BffDN9dp3PSKllMBR+REQiq1Nb25hYJHzhmzAwRPh8MnN5aa1i+CiBKgA9CGdu6/Y0TLgrgiWQy7n2yJtSBRQHYI54RXZwvTKWCt3xs5thaFLCnBQKyXU/EO+PKqJnwyNRdYKfiZ5+7HOZWmqUW0Yge5e1sg3r5rrjXK6uhTqIxO+Fq4BPFX+CYVDB3Dif4e98WKBYFLVB8W3WwT5Wr0madZbDoDwoz+qiQeQRT6/z/q85iL9mKAcUyYX6LC52i05PN+8ENnuWzjZDBUZJVaNa8gmWk1FbdG5Wy/WUukQ8bO+CEQPTbBQuNK30n6OyCFdQaOructBN35SBu1hGKWL+DK/cHQdvecdbCLnKTo0Q+eBRea1vrzDehYpGn+3AgI+ggP7OgVzcprQltnxkKIE6E19QitTHVdDD8JnliJJsPmx2zeYgJzkJNVR2Tvcb8DP34GsFxX2jVxo4L8GQk 4MFQupTL SfdZBx11nwxuctFOjwRCVbVHwl5xzk5FP33GbThn0/gcRnmFZxq5gMhurjGufgRcyoVjpxUPzhP/M9CZ00pJcFD6xXLRwYcLsmyk3groRbwILLlDwHEI3+8QBieexOHS9ToZpgTa+1P54+Cn3Qt/zX6MH1RhSg1YZ+1X8MXZlE4NzldcqXiCP9oPLDQdEC2k0trn+LNqMfM0gss8Ncbv70HUVuQ3XzNjFkrwi 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: List-Subscribe: List-Unsubscribe: It's more efficient to get the swap_info_struct by calling swp_swap_info() directly. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/swap.h | 3 +-- mm/swap.h | 2 +- mm/swapfile.c | 8 +------- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 77c43715ad5b..fac9b80b5e32 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -487,8 +487,7 @@ extern sector_t swapdev_block(int, pgoff_t); extern int __swap_count(swp_entry_t entry); extern int swap_swapcount(struct swap_info_struct *si, swp_entry_t entry); extern int swp_swapcount(swp_entry_t entry); -extern struct swap_info_struct *page_swap_info(struct page *); -extern struct swap_info_struct *swp_swap_info(swp_entry_t entry); +struct swap_info_struct *swp_swap_info(swp_entry_t entry); struct backing_dev_info; extern int init_swap_address_space(unsigned int type, unsigned long nr_pages); extern void exit_swap_address_space(unsigned int type); diff --git a/mm/swap.h b/mm/swap.h index 859ae8f0fd2d..6bf25342589f 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -60,7 +60,7 @@ struct page *swapin_readahead(swp_entry_t entry, gfp_t flag, static inline unsigned int folio_swap_flags(struct folio *folio) { - return page_swap_info(&folio->page)->flags; + return swp_swap_info(folio->swap)->flags; } #else /* CONFIG_SWAP */ struct swap_iocb; diff --git a/mm/swapfile.c b/mm/swapfile.c index f3e23a3d26ae..2f877ca44513 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3369,18 +3369,12 @@ struct swap_info_struct *swp_swap_info(swp_entry_t entry) return swap_type_to_swap_info(swp_type(entry)); } -struct swap_info_struct *page_swap_info(struct page *page) -{ - swp_entry_t entry = page_swap_entry(page); - return swp_swap_info(entry); -} - /* * out-of-line methods to avoid include hell. */ struct address_space *swapcache_mapping(struct folio *folio) { - return page_swap_info(&folio->page)->swap_file->f_mapping; + return swp_swap_info(folio->swap)->swap_file->f_mapping; } EXPORT_SYMBOL_GPL(swapcache_mapping);