tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable head: 20d834c03647d421114b4bee932993890042cd77 commit: 45f3e764da28d82646f485f8908528897af4fae6 [10/179] hugetlb: optimize update_and_free_pages_bulk to avoid lock cycles config: s390-randconfig-r034-20230713 (https://download.01.org/0day-ci/archive/20230714/202307140551.1NHG7Haa-lkp@xxxxxxxxx/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a) reproduce: (https://download.01.org/0day-ci/archive/20230714/202307140551.1NHG7Haa-lkp@xxxxxxxxx/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@xxxxxxxxx> | Closes: https://lore.kernel.org/oe-kbuild-all/202307140551.1NHG7Haa-lkp@xxxxxxxxx/ All warnings (new ones prefixed by >>): In file included from mm/hugetlb.c:19: In file included from include/linux/memblock.h:13: In file included from arch/s390/include/asm/dma.h:5: In file included from include/linux/io.h:13: In file included from arch/s390/include/asm/io.h:75: include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 547 | val = __raw_readb(PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 560 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); | ~~~~~~~~~~ ^ include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu' 37 | #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x)) | ^ include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16' 102 | #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) | ^ In file included from mm/hugetlb.c:19: In file included from include/linux/memblock.h:13: In file included from arch/s390/include/asm/dma.h:5: In file included from include/linux/io.h:13: In file included from arch/s390/include/asm/io.h:75: include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 573 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); | ~~~~~~~~~~ ^ include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu' 35 | #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x)) | ^ include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32' 115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) | ^ In file included from mm/hugetlb.c:19: In file included from include/linux/memblock.h:13: In file included from arch/s390/include/asm/dma.h:5: In file included from include/linux/io.h:13: In file included from arch/s390/include/asm/io.h:75: include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 584 | __raw_writeb(value, PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 594 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 604 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 692 | readsb(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 700 | readsw(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 708 | readsl(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 717 | writesb(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 726 | writesw(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 735 | writesl(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ >> mm/hugetlb.c:1870:26: warning: variable 'folio' is uninitialized when used here [-Wuninitialized] 1870 | add_hugetlb_folio(h, folio, true); | ^~~~~ mm/hugetlb.c:1857:21: note: initialize the variable 'folio' to silence this warning 1857 | struct folio *folio; | ^ | = NULL 13 warnings generated. vim +/folio +1870 mm/hugetlb.c 1853 1854 static void update_and_free_pages_bulk(struct hstate *h, struct list_head *list) 1855 { 1856 struct page *page, *t_page; 1857 struct folio *folio; 1858 bool clear_dtor = false; 1859 1860 /* 1861 * First allocate required vmemmmap for all pages on list. If vmemmap 1862 * can not be allocated, we can not free page to lower level allocator, 1863 * so add back as hugetlb surplus page. 1864 */ 1865 list_for_each_entry_safe(page, t_page, list, lru) { 1866 if (HPageVmemmapOptimized(page)) { 1867 clear_dtor = true; 1868 if (hugetlb_vmemmap_restore(h, page)) { 1869 spin_lock_irq(&hugetlb_lock); > 1870 add_hugetlb_folio(h, folio, true); 1871 spin_unlock_irq(&hugetlb_lock); 1872 } 1873 cond_resched(); 1874 } 1875 } 1876 1877 /* 1878 * If vmemmmap allocation performed above, then take lock * to clear 1879 * destructor of all pages on list. 1880 */ 1881 if (clear_dtor) { 1882 spin_lock_irq(&hugetlb_lock); 1883 list_for_each_entry(page, list, lru) 1884 __clear_hugetlb_destructor(h, page_folio(page)); 1885 spin_unlock_irq(&hugetlb_lock); 1886 } 1887 1888 /* 1889 * Free pages back to low level allocators. vmemmap and destructors 1890 * were taken care of above, so update_and_free_hugetlb_folio will 1891 * not need to take hugetlb lock. 1892 */ 1893 list_for_each_entry_safe(page, t_page, list, lru) { 1894 folio = page_folio(page); 1895 update_and_free_hugetlb_folio(h, folio, false); 1896 } 1897 } 1898 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki