* [linux-next:master 7701/8232] mm/huge_memory.c:2735:31: warning: variable 'page' is uninitialized when used here
@ 2024-06-25 21:39 kernel test robot
2024-06-25 21:52 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2024-06-25 21:39 UTC (permalink / raw)
To: Lance Yang
Cc: llvm, oe-kbuild-all, Linux Memory Management List, Andrew Morton
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 0fc4bfab2cd45f9acb86c4f04b5191e114e901ed
commit: 4627108658d68fad359600dbe667b88b501cee71 [7701/8232] mm/vmscan: avoid split lazyfree THP during shrink_folio_list()
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20240626/202406260514.SLhNM9kQ-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240626/202406260514.SLhNM9kQ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406260514.SLhNM9kQ-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> mm/huge_memory.c:2735:31: warning: variable 'page' is uninitialized when used here [-Wuninitialized]
2735 | folio_remove_rmap_pmd(folio, page, vma);
| ^~~~
mm/huge_memory.c:2699:19: note: initialize the variable 'page' to silence this warning
2699 | struct page *page;
| ^
| = NULL
1 warning generated.
vim +/page +2735 mm/huge_memory.c
2691
2692 static bool __discard_anon_folio_pmd_locked(struct vm_area_struct *vma,
2693 unsigned long addr, pmd_t *pmdp,
2694 struct folio *folio)
2695 {
2696 struct mm_struct *mm = vma->vm_mm;
2697 int ref_count, map_count;
2698 pmd_t orig_pmd = *pmdp;
2699 struct page *page;
2700
2701 if (folio_test_dirty(folio) || pmd_dirty(orig_pmd))
2702 return false;
2703
2704 orig_pmd = pmdp_huge_clear_flush(vma, addr, pmdp);
2705
2706 /*
2707 * Syncing against concurrent GUP-fast:
2708 * - clear PMD; barrier; read refcount
2709 * - inc refcount; barrier; read PMD
2710 */
2711 smp_mb();
2712
2713 ref_count = folio_ref_count(folio);
2714 map_count = folio_mapcount(folio);
2715
2716 /*
2717 * Order reads for folio refcount and dirty flag
2718 * (see comments in __remove_mapping()).
2719 */
2720 smp_rmb();
2721
2722 /*
2723 * If the folio or its PMD is redirtied at this point, or if there
2724 * are unexpected references, we will give up to discard this folio
2725 * and remap it.
2726 *
2727 * The only folio refs must be one from isolation plus the rmap(s).
2728 */
2729 if (folio_test_dirty(folio) || pmd_dirty(orig_pmd) ||
2730 ref_count != map_count + 1) {
2731 set_pmd_at(mm, addr, pmdp, orig_pmd);
2732 return false;
2733 }
2734
> 2735 folio_remove_rmap_pmd(folio, page, vma);
2736 zap_deposited_table(mm, pmdp);
2737 add_mm_counter(mm, MM_ANONPAGES, -HPAGE_PMD_NR);
2738 if (vma->vm_flags & VM_LOCKED)
2739 mlock_drain_local();
2740 folio_put(folio);
2741
2742 return true;
2743 }
2744
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [linux-next:master 7701/8232] mm/huge_memory.c:2735:31: warning: variable 'page' is uninitialized when used here
2024-06-25 21:39 [linux-next:master 7701/8232] mm/huge_memory.c:2735:31: warning: variable 'page' is uninitialized when used here kernel test robot
@ 2024-06-25 21:52 ` Andrew Morton
2024-06-26 1:26 ` Lance Yang
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2024-06-25 21:52 UTC (permalink / raw)
To: kernel test robot
Cc: Lance Yang, llvm, oe-kbuild-all, Linux Memory Management List
On Wed, 26 Jun 2024 05:39:54 +0800 kernel test robot <lkp@intel.com> wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head: 0fc4bfab2cd45f9acb86c4f04b5191e114e901ed
> commit: 4627108658d68fad359600dbe667b88b501cee71 [7701/8232] mm/vmscan: avoid split lazyfree THP during shrink_folio_list()
> config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20240626/202406260514.SLhNM9kQ-lkp@intel.com/config)
> compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240626/202406260514.SLhNM9kQ-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202406260514.SLhNM9kQ-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> mm/huge_memory.c:2735:31: warning: variable 'page' is uninitialized when used here [-Wuninitialized]
> 2735 | folio_remove_rmap_pmd(folio, page, vma);
> | ^~~~
> mm/huge_memory.c:2699:19: note: initialize the variable 'page' to silence this warning
> 2699 | struct page *page;
> | ^
> | = NULL
> 1 warning generated.
>
>
um yes.
https://lore.kernel.org/all/20240622100057.3352-1-ioworker0@gmail.com/T/#u
removed the initialization.
I'll do this, because I'm about to push a tree out:
--- a/mm/huge_memory.c~hack
+++ a/mm/huge_memory.c
@@ -2697,7 +2697,6 @@ static bool __discard_anon_folio_pmd_loc
struct mm_struct *mm = vma->vm_mm;
int ref_count, map_count;
pmd_t orig_pmd = *pmdp;
- struct page *page;
if (folio_test_dirty(folio) || pmd_dirty(orig_pmd))
return false;
@@ -2733,7 +2732,7 @@ static bool __discard_anon_folio_pmd_loc
return false;
}
- folio_remove_rmap_pmd(folio, page, vma);
+ folio_remove_rmap_pmd(folio, pmd_page(orig_pmd), vma);
zap_deposited_table(mm, pmdp);
add_mm_counter(mm, MM_ANONPAGES, -HPAGE_PMD_NR);
if (vma->vm_flags & VM_LOCKED)
_
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [linux-next:master 7701/8232] mm/huge_memory.c:2735:31: warning: variable 'page' is uninitialized when used here
2024-06-25 21:52 ` Andrew Morton
@ 2024-06-26 1:26 ` Lance Yang
0 siblings, 0 replies; 3+ messages in thread
From: Lance Yang @ 2024-06-26 1:26 UTC (permalink / raw)
To: Andrew Morton
Cc: kernel test robot, llvm, oe-kbuild-all, Linux Memory Management List
On Wed, Jun 26, 2024 at 5:52 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Wed, 26 Jun 2024 05:39:54 +0800 kernel test robot <lkp@intel.com> wrote:
>
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head: 0fc4bfab2cd45f9acb86c4f04b5191e114e901ed
> > commit: 4627108658d68fad359600dbe667b88b501cee71 [7701/8232] mm/vmscan: avoid split lazyfree THP during shrink_folio_list()
> > config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20240626/202406260514.SLhNM9kQ-lkp@intel.com/config)
> > compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240626/202406260514.SLhNM9kQ-lkp@intel.com/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202406260514.SLhNM9kQ-lkp@intel.com/
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> mm/huge_memory.c:2735:31: warning: variable 'page' is uninitialized when used here [-Wuninitialized]
> > 2735 | folio_remove_rmap_pmd(folio, page, vma);
> > | ^~~~
> > mm/huge_memory.c:2699:19: note: initialize the variable 'page' to silence this warning
> > 2699 | struct page *page;
> > | ^
> > | = NULL
> > 1 warning generated.
> >
> >
>
> um yes.
> https://lore.kernel.org/all/20240622100057.3352-1-ioworker0@gmail.com/T/#u
> removed the initialization.
My bad. I could have done better :(
>
> I'll do this, because I'm about to push a tree out:
>
> --- a/mm/huge_memory.c~hack
> +++ a/mm/huge_memory.c
> @@ -2697,7 +2697,6 @@ static bool __discard_anon_folio_pmd_loc
> struct mm_struct *mm = vma->vm_mm;
> int ref_count, map_count;
> pmd_t orig_pmd = *pmdp;
> - struct page *page;
>
> if (folio_test_dirty(folio) || pmd_dirty(orig_pmd))
> return false;
> @@ -2733,7 +2732,7 @@ static bool __discard_anon_folio_pmd_loc
> return false;
> }
>
> - folio_remove_rmap_pmd(folio, page, vma);
> + folio_remove_rmap_pmd(folio, pmd_page(orig_pmd), vma);
Thanks a lot for jumping in!
Lance
> zap_deposited_table(mm, pmdp);
> add_mm_counter(mm, MM_ANONPAGES, -HPAGE_PMD_NR);
> if (vma->vm_flags & VM_LOCKED)
> _
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-26 1:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-25 21:39 [linux-next:master 7701/8232] mm/huge_memory.c:2735:31: warning: variable 'page' is uninitialized when used here kernel test robot
2024-06-25 21:52 ` Andrew Morton
2024-06-26 1:26 ` Lance Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox