linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: kernel test robot <lkp@intel.com>
Cc: kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>,
	Mike Kravetz <mike.kravetz@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [linux-next:master 3841/3955] mm/memory.c:1678:67: sparse: sparse: incorrect type in initializer (different base types)
Date: Wed, 13 Apr 2022 15:00:19 -0400	[thread overview]
Message-ID: <Ylcdw8I1L5iAoWhb@xz-m1.local> (raw)
In-Reply-To: <202204140108.DeRAhWEn-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]

On Thu, Apr 14, 2022 at 01:16:26AM +0800, kernel test robot wrote:
>   1664		if (start != end) {
>   1665			if (unlikely(is_vm_hugetlb_page(vma))) {
>   1666				/*
>   1667				 * It is undesirable to test vma->vm_file as it
>   1668				 * should be non-null for valid hugetlb area.
>   1669				 * However, vm_file will be NULL in the error
>   1670				 * cleanup path of mmap_region. When
>   1671				 * hugetlbfs ->mmap method fails,
>   1672				 * mmap_region() nullifies vma->vm_file
>   1673				 * before calling this function to clean up.
>   1674				 * Since no pte has actually been setup, it is
>   1675				 * safe to do nothing in this case.
>   1676				 */
>   1677				if (vma->vm_file) {
> > 1678					unsigned long zap_flags = details ?
>   1679					    details->zap_flags : 0;

The hugetlb side was overlooked after we re-typed zap_flags into bitmask..

One more patch (attached) needs to be squashed into patch "mm/hugetlb: Only
drop uffd-wp special pte if required" to ease the sparse warning, sorry.

-- 
Peter Xu

[-- Attachment #2: 0001-fixup-mm-hugetlb-Only-drop-uffd-wp-special-pte-if-re.patch --]
[-- Type: text/plain, Size: 3695 bytes --]

From ebb2908f24a7e2593c84406fe48afcc5923c68c7 Mon Sep 17 00:00:00 2001
From: Peter Xu <peterx@redhat.com>
Date: Wed, 13 Apr 2022 14:50:04 -0400
Subject: [PATCH] fixup! mm/hugetlb: Only drop uffd-wp special pte if required

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 fs/hugetlbfs/inode.c    | 2 +-
 include/linux/hugetlb.h | 6 +++---
 mm/hugetlb.c            | 6 +++---
 mm/memory.c             | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 8b5b9df2be7d..c0bf65c70ade 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -405,7 +405,7 @@ static void remove_huge_page(struct page *page)
 
 static void
 hugetlb_vmdelete_list(struct rb_root_cached *root, pgoff_t start, pgoff_t end,
-		      unsigned long zap_flags)
+		      zap_flags_t zap_flags)
 {
 	struct vm_area_struct *vma;
 
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 6df51d23b7ee..3568dec16efb 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -145,11 +145,11 @@ long follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *,
 			 int *);
 void unmap_hugepage_range(struct vm_area_struct *,
 			  unsigned long, unsigned long, struct page *,
-			  unsigned long);
+			  zap_flags_t);
 void __unmap_hugepage_range_final(struct mmu_gather *tlb,
 			  struct vm_area_struct *vma,
 			  unsigned long start, unsigned long end,
-			  struct page *ref_page, unsigned long zap_flags);
+			  struct page *ref_page, zap_flags_t zap_flags);
 void hugetlb_report_meminfo(struct seq_file *);
 int hugetlb_report_node_meminfo(char *buf, int len, int nid);
 void hugetlb_show_meminfo(void);
@@ -405,7 +405,7 @@ static inline unsigned long hugetlb_change_protection(
 static inline void __unmap_hugepage_range_final(struct mmu_gather *tlb,
 			struct vm_area_struct *vma, unsigned long start,
 			unsigned long end, struct page *ref_page,
-			unsigned long zap_flags)
+			zap_flags_t zap_flags)
 {
 	BUG();
 }
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index e1571179698a..b07a4c6f16f3 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -4961,7 +4961,7 @@ int move_hugetlb_page_tables(struct vm_area_struct *vma,
 
 static void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
 				   unsigned long start, unsigned long end,
-				   struct page *ref_page, unsigned long zap_flags)
+				   struct page *ref_page, zap_flags_t zap_flags)
 {
 	struct mm_struct *mm = vma->vm_mm;
 	unsigned long address;
@@ -5095,7 +5095,7 @@ static void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct
 void __unmap_hugepage_range_final(struct mmu_gather *tlb,
 			  struct vm_area_struct *vma, unsigned long start,
 			  unsigned long end, struct page *ref_page,
-			  unsigned long zap_flags)
+			  zap_flags_t zap_flags)
 {
 	__unmap_hugepage_range(tlb, vma, start, end, ref_page, zap_flags);
 
@@ -5114,7 +5114,7 @@ void __unmap_hugepage_range_final(struct mmu_gather *tlb,
 
 void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start,
 			  unsigned long end, struct page *ref_page,
-			  unsigned long zap_flags)
+			  zap_flags_t zap_flags)
 {
 	struct mmu_gather tlb;
 
diff --git a/mm/memory.c b/mm/memory.c
index 8e7f39c651c3..63644a7b5287 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1675,7 +1675,7 @@ static void unmap_single_vma(struct mmu_gather *tlb,
 			 * safe to do nothing in this case.
 			 */
 			if (vma->vm_file) {
-				unsigned long zap_flags = details ?
+				zap_flags_t zap_flags = details ?
 				    details->zap_flags : 0;
 				i_mmap_lock_write(vma->vm_file->f_mapping);
 				__unmap_hugepage_range_final(tlb, vma, start, end,
-- 
2.32.0


      reply	other threads:[~2022-04-13 19:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13 17:16 kernel test robot
2022-04-13 19:00 ` Peter Xu [this message]

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=Ylcdw8I1L5iAoWhb@xz-m1.local \
    --to=peterx@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=mike.kravetz@oracle.com \
    /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