linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: David Hildenbrand <david@redhat.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	linux-fscrypt@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH 6/6] mm: Remove page_mapping()
Date: Wed, 24 Apr 2024 16:34:23 -0700	[thread overview]
Message-ID: <20240424163423.ad6e23a984deb731e2de497c@linux-foundation.org> (raw)
In-Reply-To: <7c52ae2a-8f72-4c3c-b4b3-24b50bdb5486@redhat.com>

On Wed, 24 Apr 2024 13:55:32 +0200 David Hildenbrand <david@redhat.com> wrote:

> On 24.04.24 00:55, Matthew Wilcox (Oracle) wrote:
> > All callers are now converted, delete this compatibility wrapper.
> > 

For some reason,

mm/hugetlb.c: In function 'hugetlb_page_mapping_lock_write':
mm/hugetlb.c:2164:41: error: implicit declaration of function 'page_mapping'; did you mean 'page_mapped'? [-Werror=implicit-function-declaration]
 2164 |         struct address_space *mapping = page_mapping(hpage);
      |                                         ^~~~~~~~~~~~
      |                                         page_mapped
mm/hugetlb.c:2164:41: error: initialization of 'struct address_space *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion]


I'll disable "mm: Remove page_mapping()" pending review of the below,
please.


From: Andrew Morton <akpm@linux-foundation.org>
Subject: mm: convert hugetlb_page_mapping_lock_write() to hugetlb_folio_mapping_lock_write
Date: Wed Apr 24 04:20:30 PM PDT 2024

Convert this to use folios, so we can remove page_mapping()

Cc: David Hildenbrand <david@redhat.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/hugetlb.h |    6 +++---
 mm/hugetlb.c            |    6 +++---
 mm/memory-failure.c     |    4 ++--
 mm/migrate.c            |    2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

--- a/mm/hugetlb.c~mm-convert-hugetlb_page_mapping_lock_write-to-hugetlb_folio_mapping_lock_write
+++ a/mm/hugetlb.c
@@ -2155,13 +2155,13 @@ static bool prep_compound_gigantic_folio
 /*
  * Find and lock address space (mapping) in write mode.
  *
- * Upon entry, the page is locked which means that page_mapping() is
+ * Upon entry, the folio is locked which means that folio_mapping() is
  * stable.  Due to locking order, we can only trylock_write.  If we can
  * not get the lock, simply return NULL to caller.
  */
-struct address_space *hugetlb_page_mapping_lock_write(struct page *hpage)
+struct address_space *hugetlb_folio_mapping_lock_write(struct folio *folio)
 {
-	struct address_space *mapping = page_mapping(hpage);
+	struct address_space *mapping = folio_mapping(folio);
 
 	if (!mapping)
 		return mapping;
--- a/mm/memory-failure.c~mm-convert-hugetlb_page_mapping_lock_write-to-hugetlb_folio_mapping_lock_write
+++ a/mm/memory-failure.c
@@ -1595,7 +1595,7 @@ static bool hwpoison_user_mappings(struc
 	 * XXX: the dirty test could be racy: set_page_dirty() may not always
 	 * be called inside page lock (it's recommended but not enforced).
 	 */
-	mapping = page_mapping(hpage);
+	mapping = folio_mapping(folio);
 	if (!(flags & MF_MUST_KILL) && !PageDirty(hpage) && mapping &&
 	    mapping_can_writeback(mapping)) {
 		if (page_mkclean(hpage)) {
@@ -1622,7 +1622,7 @@ static bool hwpoison_user_mappings(struc
 		 * TTU_RMAP_LOCKED to indicate we have taken the lock
 		 * at this higher level.
 		 */
-		mapping = hugetlb_page_mapping_lock_write(hpage);
+		mapping = hugetlb_folio_mapping_lock_write(folio);
 		if (mapping) {
 			try_to_unmap(folio, ttu|TTU_RMAP_LOCKED);
 			i_mmap_unlock_write(mapping);
--- a/include/linux/hugetlb.h~mm-convert-hugetlb_page_mapping_lock_write-to-hugetlb_folio_mapping_lock_write
+++ a/include/linux/hugetlb.h
@@ -178,7 +178,7 @@ bool hugetlbfs_pagecache_present(struct
 				 struct vm_area_struct *vma,
 				 unsigned long address);
 
-struct address_space *hugetlb_page_mapping_lock_write(struct page *hpage);
+struct address_space *hugetlb_folio_mapping_lock_write(struct folio *folio);
 
 extern int sysctl_hugetlb_shm_group;
 extern struct list_head huge_boot_pages[MAX_NUMNODES];
@@ -297,8 +297,8 @@ static inline unsigned long hugetlb_tota
 	return 0;
 }
 
-static inline struct address_space *hugetlb_page_mapping_lock_write(
-							struct page *hpage)
+static inline struct address_space *hugetlb_folio_mapping_lock_write(
+							struct folio *folio)
 {
 	return NULL;
 }
--- a/mm/migrate.c~mm-convert-hugetlb_page_mapping_lock_write-to-hugetlb_folio_mapping_lock_write
+++ a/mm/migrate.c
@@ -1425,7 +1425,7 @@ static int unmap_and_move_huge_page(new_
 			 * semaphore in write mode here and set TTU_RMAP_LOCKED
 			 * to let lower levels know we have taken the lock.
 			 */
-			mapping = hugetlb_page_mapping_lock_write(&src->page);
+			mapping = hugetlb_folio_mapping_lock_write(src);
 			if (unlikely(!mapping))
 				goto unlock_put_anon;
 
_



  reply	other threads:[~2024-04-24 23:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 22:55 [PATCH 0/6] " Matthew Wilcox (Oracle)
2024-04-23 22:55 ` [PATCH 1/6] fscrypt: Convert bh_get_inode_and_lblk_num to use a folio Matthew Wilcox (Oracle)
2024-04-23 23:34   ` Eric Biggers
2024-04-23 22:55 ` [PATCH 2/6] f2fs: Convert f2fs_clear_page_cache_dirty_tag " Matthew Wilcox (Oracle)
2024-04-24 11:53   ` David Hildenbrand
2024-04-23 22:55 ` [PATCH 3/6] memory-failure: Remove calls to page_mapping() Matthew Wilcox (Oracle)
2024-04-23 23:52   ` Sidhartha Kumar
2024-04-24 11:54   ` David Hildenbrand
2024-04-25  6:21   ` Miaohe Lin
2024-04-23 22:55 ` [PATCH 4/6] migrate: Expand the use of folio in __migrate_device_pages() Matthew Wilcox (Oracle)
2024-04-24 11:54   ` David Hildenbrand
2024-04-23 22:55 ` [PATCH 5/6] userfault; Expand folio use in mfill_atomic_install_pte() Matthew Wilcox (Oracle)
2024-04-24 11:55   ` David Hildenbrand
2024-04-23 22:55 ` [PATCH 6/6] mm: Remove page_mapping() Matthew Wilcox (Oracle)
2024-04-24 11:55   ` David Hildenbrand
2024-04-24 23:34     ` Andrew Morton [this message]
2024-04-24 23:59       ` Matthew Wilcox
2024-05-20 21:16 ` [f2fs-dev] [PATCH 0/6] " patchwork-bot+f2fs
2024-07-24  2:16 ` patchwork-bot+f2fs

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=20240424163423.ad6e23a984deb731e2de497c@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.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