From: kernel test robot <lkp@intel.com>
To: Vineet Gupta <vgupta@synopsys.com>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
linux-kernel@vger.kernel.org
Subject: [vgupta-arc:topic-zol-remove 112/188] mm/memory.c:773:1: warning: no previous prototype for function 'copy_nonpresent_pte'
Date: Sun, 17 Oct 2021 09:01:01 +0800 [thread overview]
Message-ID: <202110170921.3gtGPUAf-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 15444 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git topic-zol-remove
head: 5d273f5d5109b942d3be84a4db0ffe05feb901d4
commit: b55091ec6890b580d5ca97add1bb56b5502e67df [112/188] xxx: dbg: uninline copy_p*_range() functions
config: hexagon-randconfig-r041-20211015 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project a49f5386ce6b091da66ea7c3a1d9a588d53becf7)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git/commit/?id=b55091ec6890b580d5ca97add1bb56b5502e67df
git remote add vgupta-arc https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git
git fetch --no-tags vgupta-arc topic-zol-remove
git checkout b55091ec6890b580d5ca97add1bb56b5502e67df
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> mm/memory.c:773:1: warning: no previous prototype for function 'copy_nonpresent_pte' [-Wmissing-prototypes]
copy_nonpresent_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
^
mm/memory.c:772:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline unsigned long
^
static
>> mm/memory.c:1005:1: warning: no previous prototype for function 'copy_pte_range' [-Wmissing-prototypes]
copy_pte_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma,
^
mm/memory.c:1004:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline int
^
static
>> mm/memory.c:1129:1: warning: no previous prototype for function 'copy_pmd_range' [-Wmissing-prototypes]
copy_pmd_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma,
^
mm/memory.c:1128:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline int
^
static
>> mm/memory.c:1166:1: warning: no previous prototype for function 'copy_pud_range' [-Wmissing-prototypes]
copy_pud_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma,
^
mm/memory.c:1165:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline int
^
static
>> mm/memory.c:1203:1: warning: no previous prototype for function 'copy_p4d_range' [-Wmissing-prototypes]
copy_p4d_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma,
^
mm/memory.c:1202:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline int
^
static
mm/memory.c:3717:21: warning: no previous prototype for function 'do_anonymous_page' [-Wmissing-prototypes]
noinline vm_fault_t do_anonymous_page(struct vm_fault *vmf)
^
mm/memory.c:3717:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline vm_fault_t do_anonymous_page(struct vm_fault *vmf)
^
static
mm/memory.c:3833:21: warning: no previous prototype for function '__do_fault' [-Wmissing-prototypes]
noinline vm_fault_t __do_fault(struct vm_fault *vmf)
^
mm/memory.c:3833:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline vm_fault_t __do_fault(struct vm_fault *vmf)
^
static
mm/memory.c:4157:21: warning: no previous prototype for function 'do_read_fault' [-Wmissing-prototypes]
noinline vm_fault_t do_read_fault(struct vm_fault *vmf)
^
mm/memory.c:4157:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline vm_fault_t do_read_fault(struct vm_fault *vmf)
^
static
mm/memory.c:4186:21: warning: no previous prototype for function 'do_cow_fault' [-Wmissing-prototypes]
noinline vm_fault_t do_cow_fault(struct vm_fault *vmf)
^
mm/memory.c:4186:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline vm_fault_t do_cow_fault(struct vm_fault *vmf)
^
static
mm/memory.c:4224:21: warning: no previous prototype for function 'do_shared_fault' [-Wmissing-prototypes]
noinline vm_fault_t do_shared_fault(struct vm_fault *vmf)
^
mm/memory.c:4224:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline vm_fault_t do_shared_fault(struct vm_fault *vmf)
^
static
mm/memory.c:4267:21: warning: no previous prototype for function 'do_fault' [-Wmissing-prototypes]
noinline vm_fault_t do_fault(struct vm_fault *vmf)
^
mm/memory.c:4267:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline vm_fault_t do_fault(struct vm_fault *vmf)
^
static
mm/memory.c:4506:21: warning: no previous prototype for function 'handle_pte_fault' [-Wmissing-prototypes]
noinline vm_fault_t handle_pte_fault(struct vm_fault *vmf)
^
mm/memory.c:4506:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline vm_fault_t handle_pte_fault(struct vm_fault *vmf)
^
static
mm/memory.c:4610:21: warning: no previous prototype for function '__handle_mm_fault' [-Wmissing-prototypes]
noinline vm_fault_t __handle_mm_fault(struct vm_area_struct *vma,
^
mm/memory.c:4610:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline vm_fault_t __handle_mm_fault(struct vm_area_struct *vma,
^
static
13 warnings generated.
vim +/copy_nonpresent_pte +773 mm/memory.c
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 765
^1da177e4c3f4152 Linus Torvalds 2005-04-16 766 /*
^1da177e4c3f4152 Linus Torvalds 2005-04-16 767 * copy one vm_area from one task to the other. Assumes the page tables
^1da177e4c3f4152 Linus Torvalds 2005-04-16 768 * already present in the new task to be cleared in the whole range
^1da177e4c3f4152 Linus Torvalds 2005-04-16 769 * covered by this vma.
^1da177e4c3f4152 Linus Torvalds 2005-04-16 770 */
^1da177e4c3f4152 Linus Torvalds 2005-04-16 771
b55091ec6890b580 Vineet Gupta 2020-12-17 772 noinline unsigned long
df3a57d1f6072d07 Linus Torvalds 2020-09-23 @773 copy_nonpresent_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
8f34f1eac3820fc2 Peter Xu 2021-06-30 774 pte_t *dst_pte, pte_t *src_pte, struct vm_area_struct *dst_vma,
8f34f1eac3820fc2 Peter Xu 2021-06-30 775 struct vm_area_struct *src_vma, unsigned long addr, int *rss)
^1da177e4c3f4152 Linus Torvalds 2005-04-16 776 {
8f34f1eac3820fc2 Peter Xu 2021-06-30 777 unsigned long vm_flags = dst_vma->vm_flags;
^1da177e4c3f4152 Linus Torvalds 2005-04-16 778 pte_t pte = *src_pte;
^1da177e4c3f4152 Linus Torvalds 2005-04-16 779 struct page *page;
0697212a411c1dae Christoph Lameter 2006-06-23 780 swp_entry_t entry = pte_to_swp_entry(pte);
0697212a411c1dae Christoph Lameter 2006-06-23 781
2022b4d18a491a57 Hugh Dickins 2014-12-02 782 if (likely(!non_swap_entry(entry))) {
570a335b8e22579e Hugh Dickins 2009-12-14 783 if (swap_duplicate(entry) < 0)
9a5cc85c407402ae Alistair Popple 2021-06-30 784 return -EIO;
570a335b8e22579e Hugh Dickins 2009-12-14 785
^1da177e4c3f4152 Linus Torvalds 2005-04-16 786 /* make sure dst_mm is on swapoff's mmlist. */
^1da177e4c3f4152 Linus Torvalds 2005-04-16 787 if (unlikely(list_empty(&dst_mm->mmlist))) {
^1da177e4c3f4152 Linus Torvalds 2005-04-16 788 spin_lock(&mmlist_lock);
f412ac08c9861b47 Hugh Dickins 2005-10-29 789 if (list_empty(&dst_mm->mmlist))
f412ac08c9861b47 Hugh Dickins 2005-10-29 790 list_add(&dst_mm->mmlist,
f412ac08c9861b47 Hugh Dickins 2005-10-29 791 &src_mm->mmlist);
^1da177e4c3f4152 Linus Torvalds 2005-04-16 792 spin_unlock(&mmlist_lock);
^1da177e4c3f4152 Linus Torvalds 2005-04-16 793 }
b084d4353ff99d82 KAMEZAWA Hiroyuki 2010-03-05 794 rss[MM_SWAPENTS]++;
2022b4d18a491a57 Hugh Dickins 2014-12-02 795 } else if (is_migration_entry(entry)) {
af5cdaf82238fb36 Alistair Popple 2021-06-30 796 page = pfn_swap_entry_to_page(entry);
9f9f1acd713d69fa Konstantin Khlebnikov 2012-01-20 797
eca56ff906bdd023 Jerome Marchand 2016-01-14 798 rss[mm_counter(page)]++;
9f9f1acd713d69fa Konstantin Khlebnikov 2012-01-20 799
4dd845b5a3e57ad0 Alistair Popple 2021-06-30 800 if (is_writable_migration_entry(entry) &&
0697212a411c1dae Christoph Lameter 2006-06-23 801 is_cow_mapping(vm_flags)) {
0697212a411c1dae Christoph Lameter 2006-06-23 802 /*
9f9f1acd713d69fa Konstantin Khlebnikov 2012-01-20 803 * COW mappings require pages in both
9f9f1acd713d69fa Konstantin Khlebnikov 2012-01-20 804 * parent and child to be set to read.
0697212a411c1dae Christoph Lameter 2006-06-23 805 */
4dd845b5a3e57ad0 Alistair Popple 2021-06-30 806 entry = make_readable_migration_entry(
4dd845b5a3e57ad0 Alistair Popple 2021-06-30 807 swp_offset(entry));
0697212a411c1dae Christoph Lameter 2006-06-23 808 pte = swp_entry_to_pte(entry);
c3d16e16522fe3fe Cyrill Gorcunov 2013-10-16 809 if (pte_swp_soft_dirty(*src_pte))
c3d16e16522fe3fe Cyrill Gorcunov 2013-10-16 810 pte = pte_swp_mksoft_dirty(pte);
f45ec5ff16a75f96 Peter Xu 2020-04-06 811 if (pte_swp_uffd_wp(*src_pte))
f45ec5ff16a75f96 Peter Xu 2020-04-06 812 pte = pte_swp_mkuffd_wp(pte);
0697212a411c1dae Christoph Lameter 2006-06-23 813 set_pte_at(src_mm, addr, src_pte, pte);
0697212a411c1dae Christoph Lameter 2006-06-23 814 }
5042db43cc26f51e Jérôme Glisse 2017-09-08 815 } else if (is_device_private_entry(entry)) {
af5cdaf82238fb36 Alistair Popple 2021-06-30 816 page = pfn_swap_entry_to_page(entry);
5042db43cc26f51e Jérôme Glisse 2017-09-08 817
5042db43cc26f51e Jérôme Glisse 2017-09-08 818 /*
5042db43cc26f51e Jérôme Glisse 2017-09-08 819 * Update rss count even for unaddressable pages, as
5042db43cc26f51e Jérôme Glisse 2017-09-08 820 * they should treated just like normal pages in this
5042db43cc26f51e Jérôme Glisse 2017-09-08 821 * respect.
5042db43cc26f51e Jérôme Glisse 2017-09-08 822 *
5042db43cc26f51e Jérôme Glisse 2017-09-08 823 * We will likely want to have some new rss counters
5042db43cc26f51e Jérôme Glisse 2017-09-08 824 * for unaddressable pages, at some point. But for now
5042db43cc26f51e Jérôme Glisse 2017-09-08 825 * keep things as they are.
5042db43cc26f51e Jérôme Glisse 2017-09-08 826 */
5042db43cc26f51e Jérôme Glisse 2017-09-08 827 get_page(page);
5042db43cc26f51e Jérôme Glisse 2017-09-08 828 rss[mm_counter(page)]++;
5042db43cc26f51e Jérôme Glisse 2017-09-08 829 page_dup_rmap(page, false);
5042db43cc26f51e Jérôme Glisse 2017-09-08 830
5042db43cc26f51e Jérôme Glisse 2017-09-08 831 /*
5042db43cc26f51e Jérôme Glisse 2017-09-08 832 * We do not preserve soft-dirty information, because so
5042db43cc26f51e Jérôme Glisse 2017-09-08 833 * far, checkpoint/restore is the only feature that
5042db43cc26f51e Jérôme Glisse 2017-09-08 834 * requires that. And checkpoint/restore does not work
5042db43cc26f51e Jérôme Glisse 2017-09-08 835 * when a device driver is involved (you cannot easily
5042db43cc26f51e Jérôme Glisse 2017-09-08 836 * save and restore device driver state).
5042db43cc26f51e Jérôme Glisse 2017-09-08 837 */
4dd845b5a3e57ad0 Alistair Popple 2021-06-30 838 if (is_writable_device_private_entry(entry) &&
5042db43cc26f51e Jérôme Glisse 2017-09-08 839 is_cow_mapping(vm_flags)) {
4dd845b5a3e57ad0 Alistair Popple 2021-06-30 840 entry = make_readable_device_private_entry(
4dd845b5a3e57ad0 Alistair Popple 2021-06-30 841 swp_offset(entry));
5042db43cc26f51e Jérôme Glisse 2017-09-08 842 pte = swp_entry_to_pte(entry);
f45ec5ff16a75f96 Peter Xu 2020-04-06 843 if (pte_swp_uffd_wp(*src_pte))
f45ec5ff16a75f96 Peter Xu 2020-04-06 844 pte = pte_swp_mkuffd_wp(pte);
5042db43cc26f51e Jérôme Glisse 2017-09-08 845 set_pte_at(src_mm, addr, src_pte, pte);
5042db43cc26f51e Jérôme Glisse 2017-09-08 846 }
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 847 } else if (is_device_exclusive_entry(entry)) {
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 848 /*
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 849 * Make device exclusive entries present by restoring the
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 850 * original entry then copying as for a present pte. Device
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 851 * exclusive entries currently only support private writable
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 852 * (ie. COW) mappings.
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 853 */
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 854 VM_BUG_ON(!is_cow_mapping(src_vma->vm_flags));
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 855 if (try_restore_exclusive_pte(src_pte, src_vma, addr))
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 856 return -EBUSY;
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 857 return -ENOENT;
^1da177e4c3f4152 Linus Torvalds 2005-04-16 858 }
8f34f1eac3820fc2 Peter Xu 2021-06-30 859 if (!userfaultfd_wp(dst_vma))
8f34f1eac3820fc2 Peter Xu 2021-06-30 860 pte = pte_swp_clear_uffd_wp(pte);
df3a57d1f6072d07 Linus Torvalds 2020-09-23 861 set_pte_at(dst_mm, addr, dst_pte, pte);
df3a57d1f6072d07 Linus Torvalds 2020-09-23 862 return 0;
^1da177e4c3f4152 Linus Torvalds 2005-04-16 863 }
^1da177e4c3f4152 Linus Torvalds 2005-04-16 864
:::::: The code at line 773 was first introduced by commit
:::::: df3a57d1f6072d07978bafa7dbd9904cdf8f3e13 mm: split out the non-present case from copy_one_pte()
:::::: TO: Linus Torvalds <torvalds@linux-foundation.org>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37254 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [vgupta-arc:topic-zol-remove 112/188] mm/memory.c:773:1: warning: no previous prototype for function 'copy_nonpresent_pte'
Date: Sun, 17 Oct 2021 09:01:01 +0800 [thread overview]
Message-ID: <202110170921.3gtGPUAf-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 15724 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git topic-zol-remove
head: 5d273f5d5109b942d3be84a4db0ffe05feb901d4
commit: b55091ec6890b580d5ca97add1bb56b5502e67df [112/188] xxx: dbg: uninline copy_p*_range() functions
config: hexagon-randconfig-r041-20211015 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project a49f5386ce6b091da66ea7c3a1d9a588d53becf7)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git/commit/?id=b55091ec6890b580d5ca97add1bb56b5502e67df
git remote add vgupta-arc https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git
git fetch --no-tags vgupta-arc topic-zol-remove
git checkout b55091ec6890b580d5ca97add1bb56b5502e67df
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> mm/memory.c:773:1: warning: no previous prototype for function 'copy_nonpresent_pte' [-Wmissing-prototypes]
copy_nonpresent_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
^
mm/memory.c:772:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline unsigned long
^
static
>> mm/memory.c:1005:1: warning: no previous prototype for function 'copy_pte_range' [-Wmissing-prototypes]
copy_pte_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma,
^
mm/memory.c:1004:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline int
^
static
>> mm/memory.c:1129:1: warning: no previous prototype for function 'copy_pmd_range' [-Wmissing-prototypes]
copy_pmd_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma,
^
mm/memory.c:1128:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline int
^
static
>> mm/memory.c:1166:1: warning: no previous prototype for function 'copy_pud_range' [-Wmissing-prototypes]
copy_pud_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma,
^
mm/memory.c:1165:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline int
^
static
>> mm/memory.c:1203:1: warning: no previous prototype for function 'copy_p4d_range' [-Wmissing-prototypes]
copy_p4d_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma,
^
mm/memory.c:1202:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline int
^
static
mm/memory.c:3717:21: warning: no previous prototype for function 'do_anonymous_page' [-Wmissing-prototypes]
noinline vm_fault_t do_anonymous_page(struct vm_fault *vmf)
^
mm/memory.c:3717:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline vm_fault_t do_anonymous_page(struct vm_fault *vmf)
^
static
mm/memory.c:3833:21: warning: no previous prototype for function '__do_fault' [-Wmissing-prototypes]
noinline vm_fault_t __do_fault(struct vm_fault *vmf)
^
mm/memory.c:3833:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline vm_fault_t __do_fault(struct vm_fault *vmf)
^
static
mm/memory.c:4157:21: warning: no previous prototype for function 'do_read_fault' [-Wmissing-prototypes]
noinline vm_fault_t do_read_fault(struct vm_fault *vmf)
^
mm/memory.c:4157:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline vm_fault_t do_read_fault(struct vm_fault *vmf)
^
static
mm/memory.c:4186:21: warning: no previous prototype for function 'do_cow_fault' [-Wmissing-prototypes]
noinline vm_fault_t do_cow_fault(struct vm_fault *vmf)
^
mm/memory.c:4186:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline vm_fault_t do_cow_fault(struct vm_fault *vmf)
^
static
mm/memory.c:4224:21: warning: no previous prototype for function 'do_shared_fault' [-Wmissing-prototypes]
noinline vm_fault_t do_shared_fault(struct vm_fault *vmf)
^
mm/memory.c:4224:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline vm_fault_t do_shared_fault(struct vm_fault *vmf)
^
static
mm/memory.c:4267:21: warning: no previous prototype for function 'do_fault' [-Wmissing-prototypes]
noinline vm_fault_t do_fault(struct vm_fault *vmf)
^
mm/memory.c:4267:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline vm_fault_t do_fault(struct vm_fault *vmf)
^
static
mm/memory.c:4506:21: warning: no previous prototype for function 'handle_pte_fault' [-Wmissing-prototypes]
noinline vm_fault_t handle_pte_fault(struct vm_fault *vmf)
^
mm/memory.c:4506:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline vm_fault_t handle_pte_fault(struct vm_fault *vmf)
^
static
mm/memory.c:4610:21: warning: no previous prototype for function '__handle_mm_fault' [-Wmissing-prototypes]
noinline vm_fault_t __handle_mm_fault(struct vm_area_struct *vma,
^
mm/memory.c:4610:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
noinline vm_fault_t __handle_mm_fault(struct vm_area_struct *vma,
^
static
13 warnings generated.
vim +/copy_nonpresent_pte +773 mm/memory.c
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 765
^1da177e4c3f4152 Linus Torvalds 2005-04-16 766 /*
^1da177e4c3f4152 Linus Torvalds 2005-04-16 767 * copy one vm_area from one task to the other. Assumes the page tables
^1da177e4c3f4152 Linus Torvalds 2005-04-16 768 * already present in the new task to be cleared in the whole range
^1da177e4c3f4152 Linus Torvalds 2005-04-16 769 * covered by this vma.
^1da177e4c3f4152 Linus Torvalds 2005-04-16 770 */
^1da177e4c3f4152 Linus Torvalds 2005-04-16 771
b55091ec6890b580 Vineet Gupta 2020-12-17 772 noinline unsigned long
df3a57d1f6072d07 Linus Torvalds 2020-09-23 @773 copy_nonpresent_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
8f34f1eac3820fc2 Peter Xu 2021-06-30 774 pte_t *dst_pte, pte_t *src_pte, struct vm_area_struct *dst_vma,
8f34f1eac3820fc2 Peter Xu 2021-06-30 775 struct vm_area_struct *src_vma, unsigned long addr, int *rss)
^1da177e4c3f4152 Linus Torvalds 2005-04-16 776 {
8f34f1eac3820fc2 Peter Xu 2021-06-30 777 unsigned long vm_flags = dst_vma->vm_flags;
^1da177e4c3f4152 Linus Torvalds 2005-04-16 778 pte_t pte = *src_pte;
^1da177e4c3f4152 Linus Torvalds 2005-04-16 779 struct page *page;
0697212a411c1dae Christoph Lameter 2006-06-23 780 swp_entry_t entry = pte_to_swp_entry(pte);
0697212a411c1dae Christoph Lameter 2006-06-23 781
2022b4d18a491a57 Hugh Dickins 2014-12-02 782 if (likely(!non_swap_entry(entry))) {
570a335b8e22579e Hugh Dickins 2009-12-14 783 if (swap_duplicate(entry) < 0)
9a5cc85c407402ae Alistair Popple 2021-06-30 784 return -EIO;
570a335b8e22579e Hugh Dickins 2009-12-14 785
^1da177e4c3f4152 Linus Torvalds 2005-04-16 786 /* make sure dst_mm is on swapoff's mmlist. */
^1da177e4c3f4152 Linus Torvalds 2005-04-16 787 if (unlikely(list_empty(&dst_mm->mmlist))) {
^1da177e4c3f4152 Linus Torvalds 2005-04-16 788 spin_lock(&mmlist_lock);
f412ac08c9861b47 Hugh Dickins 2005-10-29 789 if (list_empty(&dst_mm->mmlist))
f412ac08c9861b47 Hugh Dickins 2005-10-29 790 list_add(&dst_mm->mmlist,
f412ac08c9861b47 Hugh Dickins 2005-10-29 791 &src_mm->mmlist);
^1da177e4c3f4152 Linus Torvalds 2005-04-16 792 spin_unlock(&mmlist_lock);
^1da177e4c3f4152 Linus Torvalds 2005-04-16 793 }
b084d4353ff99d82 KAMEZAWA Hiroyuki 2010-03-05 794 rss[MM_SWAPENTS]++;
2022b4d18a491a57 Hugh Dickins 2014-12-02 795 } else if (is_migration_entry(entry)) {
af5cdaf82238fb36 Alistair Popple 2021-06-30 796 page = pfn_swap_entry_to_page(entry);
9f9f1acd713d69fa Konstantin Khlebnikov 2012-01-20 797
eca56ff906bdd023 Jerome Marchand 2016-01-14 798 rss[mm_counter(page)]++;
9f9f1acd713d69fa Konstantin Khlebnikov 2012-01-20 799
4dd845b5a3e57ad0 Alistair Popple 2021-06-30 800 if (is_writable_migration_entry(entry) &&
0697212a411c1dae Christoph Lameter 2006-06-23 801 is_cow_mapping(vm_flags)) {
0697212a411c1dae Christoph Lameter 2006-06-23 802 /*
9f9f1acd713d69fa Konstantin Khlebnikov 2012-01-20 803 * COW mappings require pages in both
9f9f1acd713d69fa Konstantin Khlebnikov 2012-01-20 804 * parent and child to be set to read.
0697212a411c1dae Christoph Lameter 2006-06-23 805 */
4dd845b5a3e57ad0 Alistair Popple 2021-06-30 806 entry = make_readable_migration_entry(
4dd845b5a3e57ad0 Alistair Popple 2021-06-30 807 swp_offset(entry));
0697212a411c1dae Christoph Lameter 2006-06-23 808 pte = swp_entry_to_pte(entry);
c3d16e16522fe3fe Cyrill Gorcunov 2013-10-16 809 if (pte_swp_soft_dirty(*src_pte))
c3d16e16522fe3fe Cyrill Gorcunov 2013-10-16 810 pte = pte_swp_mksoft_dirty(pte);
f45ec5ff16a75f96 Peter Xu 2020-04-06 811 if (pte_swp_uffd_wp(*src_pte))
f45ec5ff16a75f96 Peter Xu 2020-04-06 812 pte = pte_swp_mkuffd_wp(pte);
0697212a411c1dae Christoph Lameter 2006-06-23 813 set_pte_at(src_mm, addr, src_pte, pte);
0697212a411c1dae Christoph Lameter 2006-06-23 814 }
5042db43cc26f51e Jérôme Glisse 2017-09-08 815 } else if (is_device_private_entry(entry)) {
af5cdaf82238fb36 Alistair Popple 2021-06-30 816 page = pfn_swap_entry_to_page(entry);
5042db43cc26f51e Jérôme Glisse 2017-09-08 817
5042db43cc26f51e Jérôme Glisse 2017-09-08 818 /*
5042db43cc26f51e Jérôme Glisse 2017-09-08 819 * Update rss count even for unaddressable pages, as
5042db43cc26f51e Jérôme Glisse 2017-09-08 820 * they should treated just like normal pages in this
5042db43cc26f51e Jérôme Glisse 2017-09-08 821 * respect.
5042db43cc26f51e Jérôme Glisse 2017-09-08 822 *
5042db43cc26f51e Jérôme Glisse 2017-09-08 823 * We will likely want to have some new rss counters
5042db43cc26f51e Jérôme Glisse 2017-09-08 824 * for unaddressable pages, at some point. But for now
5042db43cc26f51e Jérôme Glisse 2017-09-08 825 * keep things as they are.
5042db43cc26f51e Jérôme Glisse 2017-09-08 826 */
5042db43cc26f51e Jérôme Glisse 2017-09-08 827 get_page(page);
5042db43cc26f51e Jérôme Glisse 2017-09-08 828 rss[mm_counter(page)]++;
5042db43cc26f51e Jérôme Glisse 2017-09-08 829 page_dup_rmap(page, false);
5042db43cc26f51e Jérôme Glisse 2017-09-08 830
5042db43cc26f51e Jérôme Glisse 2017-09-08 831 /*
5042db43cc26f51e Jérôme Glisse 2017-09-08 832 * We do not preserve soft-dirty information, because so
5042db43cc26f51e Jérôme Glisse 2017-09-08 833 * far, checkpoint/restore is the only feature that
5042db43cc26f51e Jérôme Glisse 2017-09-08 834 * requires that. And checkpoint/restore does not work
5042db43cc26f51e Jérôme Glisse 2017-09-08 835 * when a device driver is involved (you cannot easily
5042db43cc26f51e Jérôme Glisse 2017-09-08 836 * save and restore device driver state).
5042db43cc26f51e Jérôme Glisse 2017-09-08 837 */
4dd845b5a3e57ad0 Alistair Popple 2021-06-30 838 if (is_writable_device_private_entry(entry) &&
5042db43cc26f51e Jérôme Glisse 2017-09-08 839 is_cow_mapping(vm_flags)) {
4dd845b5a3e57ad0 Alistair Popple 2021-06-30 840 entry = make_readable_device_private_entry(
4dd845b5a3e57ad0 Alistair Popple 2021-06-30 841 swp_offset(entry));
5042db43cc26f51e Jérôme Glisse 2017-09-08 842 pte = swp_entry_to_pte(entry);
f45ec5ff16a75f96 Peter Xu 2020-04-06 843 if (pte_swp_uffd_wp(*src_pte))
f45ec5ff16a75f96 Peter Xu 2020-04-06 844 pte = pte_swp_mkuffd_wp(pte);
5042db43cc26f51e Jérôme Glisse 2017-09-08 845 set_pte_at(src_mm, addr, src_pte, pte);
5042db43cc26f51e Jérôme Glisse 2017-09-08 846 }
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 847 } else if (is_device_exclusive_entry(entry)) {
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 848 /*
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 849 * Make device exclusive entries present by restoring the
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 850 * original entry then copying as for a present pte. Device
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 851 * exclusive entries currently only support private writable
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 852 * (ie. COW) mappings.
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 853 */
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 854 VM_BUG_ON(!is_cow_mapping(src_vma->vm_flags));
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 855 if (try_restore_exclusive_pte(src_pte, src_vma, addr))
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 856 return -EBUSY;
b756a3b5e7ead8f6 Alistair Popple 2021-06-30 857 return -ENOENT;
^1da177e4c3f4152 Linus Torvalds 2005-04-16 858 }
8f34f1eac3820fc2 Peter Xu 2021-06-30 859 if (!userfaultfd_wp(dst_vma))
8f34f1eac3820fc2 Peter Xu 2021-06-30 860 pte = pte_swp_clear_uffd_wp(pte);
df3a57d1f6072d07 Linus Torvalds 2020-09-23 861 set_pte_at(dst_mm, addr, dst_pte, pte);
df3a57d1f6072d07 Linus Torvalds 2020-09-23 862 return 0;
^1da177e4c3f4152 Linus Torvalds 2005-04-16 863 }
^1da177e4c3f4152 Linus Torvalds 2005-04-16 864
:::::: The code at line 773 was first introduced by commit
:::::: df3a57d1f6072d07978bafa7dbd9904cdf8f3e13 mm: split out the non-present case from copy_one_pte()
:::::: TO: Linus Torvalds <torvalds@linux-foundation.org>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 37254 bytes --]
next reply other threads:[~2021-10-17 1:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-17 1:01 kernel test robot [this message]
2021-10-17 1:01 ` [vgupta-arc:topic-zol-remove 112/188] mm/memory.c:773:1: warning: no previous prototype for function 'copy_nonpresent_pte' kernel test robot
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=202110170921.3gtGPUAf-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=vgupta@synopsys.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.