linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>, linux-mm@kvack.org
Subject: [PATCH 15/22] mm/swap: Convert __put_page() to __folio_put()
Date: Fri, 17 Jun 2022 18:50:13 +0100	[thread overview]
Message-ID: <20220617175020.717127-16-willy@infradead.org> (raw)
In-Reply-To: <20220617175020.717127-1-willy@infradead.org>

Saves 11 bytes of text by removing a check of PageTail.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/mm.h   |  6 +++---
 mm/swap.c            | 14 +++++++-------
 net/core/page_pool.c |  2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 07a1998c3621..764dc0fdae5e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -886,7 +886,7 @@ static inline struct folio *virt_to_folio(const void *x)
 	return page_folio(page);
 }
 
-void __put_page(struct page *page);
+void __folio_put(struct folio *folio);
 
 void put_pages_list(struct list_head *pages);
 
@@ -1228,7 +1228,7 @@ static inline __must_check bool try_get_page(struct page *page)
 static inline void folio_put(struct folio *folio)
 {
 	if (folio_put_testzero(folio))
-		__put_page(&folio->page);
+		__folio_put(folio);
 }
 
 /**
@@ -1248,7 +1248,7 @@ static inline void folio_put(struct folio *folio)
 static inline void folio_put_refs(struct folio *folio, int refs)
 {
 	if (folio_ref_sub_and_test(folio, refs))
-		__put_page(&folio->page);
+		__folio_put(folio);
 }
 
 void release_pages(struct page **pages, int nr);
diff --git a/mm/swap.c b/mm/swap.c
index 3696dfbff136..0ab7a032a766 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -119,16 +119,16 @@ static void __put_compound_page(struct page *page)
 	destroy_compound_page(page);
 }
 
-void __put_page(struct page *page)
+void __folio_put(struct folio *folio)
 {
-	if (unlikely(is_zone_device_page(page)))
-		free_zone_device_page(page);
-	else if (unlikely(PageCompound(page)))
-		__put_compound_page(page);
+	if (unlikely(folio_is_zone_device(folio)))
+		free_zone_device_page(&folio->page);
+	else if (unlikely(folio_test_large(folio)))
+		__put_compound_page(&folio->page);
 	else
-		__put_single_page(page);
+		__put_single_page(&folio->page);
 }
-EXPORT_SYMBOL(__put_page);
+EXPORT_SYMBOL(__folio_put);
 
 /**
  * put_pages_list() - release a list of pages
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index f18e6e771993..db70e94c8df2 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -16,7 +16,7 @@
 #include <linux/dma-direction.h>
 #include <linux/dma-mapping.h>
 #include <linux/page-flags.h>
-#include <linux/mm.h> /* for __put_page() */
+#include <linux/mm.h> /* for put_page() */
 #include <linux/poison.h>
 #include <linux/ethtool.h>
 
-- 
2.35.1



  parent reply	other threads:[~2022-06-17 17:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-17 17:49 [PATCH 00/22] Convert the swap code to be more folio-based Matthew Wilcox (Oracle)
2022-06-17 17:49 ` [PATCH 01/22] mm: Add folios_put() Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 02/22] mm/swap: Add folio_batch_move_lru() Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 03/22] mm/swap: Make __pagevec_lru_add static Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 04/22] mm/swap: Convert lru_add to a folio_batch Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 05/22] mm/swap: Convert lru_deactivate_file " Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 06/22] mm/swap: Convert lru_deactivate " Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 07/22] mm/swap: Convert lru_lazyfree " Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 08/22] mm/swap: Convert activate_page " Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 09/22] mm/swap: Rename lru_pvecs to cpu_fbatches Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 10/22] mm/swap: Pull the CPU conditional out of __lru_add_drain_all() Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 11/22] mm/swap: Optimise lru_add_drain_cpu() Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 12/22] mm/swap: Convert try_to_free_swap to use a folio Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 13/22] mm/swap: Convert release_pages to use a folio internally Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 14/22] mm/swap: Convert put_pages_list to use folios Matthew Wilcox (Oracle)
2022-06-17 17:50 ` Matthew Wilcox (Oracle) [this message]
2022-06-17 17:50 ` [PATCH 16/22] mm/swap: Convert __put_single_page() to __folio_put_small() Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 17/22] mm/swap: Convert __put_compound_page() to __folio_put_large() Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 18/22] mm/swap: Convert __page_cache_release() to use a folio Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 19/22] mm: Convert destroy_compound_page() to destroy_large_folio() Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 20/22] mm: Convert page_swap_flags to folio_swap_flags Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 21/22] mm/swap: Convert delete_from_swap_cache() to take a folio Matthew Wilcox (Oracle)
2022-06-17 17:50 ` [PATCH 22/22] mm/swap: Convert __delete_from_swap_cache() to " Matthew Wilcox (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220617175020.717127-16-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox