Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'akpm' (patches from Andrew)

Merge misc fixes from Andrew Morton:
"8 patches.

Subsystems affected by this patch series: mm (madvise, pagemap,
readahead, memcg, userfaultfd), kbuild, and vfs"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
mm: fix madvise WILLNEED performance problem
libfs: fix error cast of negative value in simple_attr_write()
mm/userfaultfd: do not access vma->vm_mm after calling handle_userfault()
mm: memcg/slab: fix root memcg vmstats
mm: fix readahead_page_batch for retry entries
mm: fix phys_to_target_node() and memory_add_physaddr_to_nid() exports
compiler-clang: remove version check for BPF Tracing
mm/madvise: fix memory leak from process_madvise

+75 -49
+6
arch/ia64/include/asm/sparsemem.h
··· 18 18 #endif 19 19 20 20 #endif /* CONFIG_SPARSEMEM */ 21 + 22 + #ifdef CONFIG_MEMORY_HOTPLUG 23 + int memory_add_physaddr_to_nid(u64 addr); 24 + #define memory_add_physaddr_to_nid memory_add_physaddr_to_nid 25 + #endif 26 + 21 27 #endif /* _ASM_IA64_SPARSEMEM_H */
+5
arch/powerpc/include/asm/mmzone.h
··· 46 46 #define __HAVE_ARCH_RESERVED_KERNEL_PAGES 47 47 #endif 48 48 49 + #ifdef CONFIG_MEMORY_HOTPLUG 50 + extern int create_section_mapping(unsigned long start, unsigned long end, 51 + int nid, pgprot_t prot); 52 + #endif 53 + 49 54 #endif /* __KERNEL__ */ 50 55 #endif /* _ASM_MMZONE_H_ */
+2 -3
arch/powerpc/include/asm/sparsemem.h
··· 13 13 #endif /* CONFIG_SPARSEMEM */ 14 14 15 15 #ifdef CONFIG_MEMORY_HOTPLUG 16 - extern int create_section_mapping(unsigned long start, unsigned long end, 17 - int nid, pgprot_t prot); 18 16 extern int remove_section_mapping(unsigned long start, unsigned long end); 17 + extern int memory_add_physaddr_to_nid(u64 start); 18 + #define memory_add_physaddr_to_nid memory_add_physaddr_to_nid 19 19 20 20 #ifdef CONFIG_NUMA 21 21 extern int hot_add_scn_to_nid(unsigned long scn_addr); ··· 26 26 } 27 27 #endif /* CONFIG_NUMA */ 28 28 #endif /* CONFIG_MEMORY_HOTPLUG */ 29 - 30 29 #endif /* __KERNEL__ */ 31 30 #endif /* _ASM_POWERPC_SPARSEMEM_H */
+1
arch/powerpc/mm/mem.c
··· 50 50 #include <asm/rtas.h> 51 51 #include <asm/kasan.h> 52 52 #include <asm/svm.h> 53 + #include <asm/mmzone.h> 53 54 54 55 #include <mm/mmu_decl.h> 55 56
+10
arch/x86/include/asm/sparsemem.h
··· 28 28 #endif 29 29 30 30 #endif /* CONFIG_SPARSEMEM */ 31 + 32 + #ifndef __ASSEMBLY__ 33 + #ifdef CONFIG_NUMA_KEEP_MEMINFO 34 + extern int phys_to_target_node(phys_addr_t start); 35 + #define phys_to_target_node phys_to_target_node 36 + extern int memory_add_physaddr_to_nid(u64 start); 37 + #define memory_add_physaddr_to_nid memory_add_physaddr_to_nid 38 + #endif 39 + #endif /* __ASSEMBLY__ */ 40 + 31 41 #endif /* _ASM_X86_SPARSEMEM_H */
+2
arch/x86/mm/numa.c
··· 938 938 939 939 return meminfo_to_nid(&numa_reserved_meminfo, start); 940 940 } 941 + EXPORT_SYMBOL_GPL(phys_to_target_node); 941 942 942 943 int memory_add_physaddr_to_nid(u64 start) 943 944 { ··· 948 947 nid = numa_meminfo.blk[0].nid; 949 948 return nid; 950 949 } 950 + EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); 951 951 #endif
-1
drivers/dax/Kconfig
··· 50 50 Say M if unsure. 51 51 52 52 config DEV_DAX_HMEM_DEVICES 53 - depends on NUMA_KEEP_MEMINFO # for phys_to_target_node() 54 53 depends on DEV_DAX_HMEM && DAX=y 55 54 def_bool y 56 55
+4 -2
fs/libfs.c
··· 959 959 size_t len, loff_t *ppos) 960 960 { 961 961 struct simple_attr *attr; 962 - u64 val; 962 + unsigned long long val; 963 963 size_t size; 964 964 ssize_t ret; 965 965 ··· 977 977 goto out; 978 978 979 979 attr->set_buf[size] = '\0'; 980 - val = simple_strtoll(attr->set_buf, NULL, 0); 980 + ret = kstrtoull(attr->set_buf, 0, &val); 981 + if (ret) 982 + goto out; 981 983 ret = attr->set(attr->data, val); 982 984 if (ret == 0) 983 985 ret = len; /* on success, claim we got the whole input */
+2
include/linux/compiler-clang.h
··· 8 8 + __clang_patchlevel__) 9 9 10 10 #if CLANG_VERSION < 100001 11 + #ifndef __BPF_TRACING__ 11 12 # error Sorry, your version of Clang is too old - please use 10.0.1 or newer. 13 + #endif 12 14 #endif 13 15 14 16 /* Compiler specific definitions for Clang compiler */
-14
include/linux/memory_hotplug.h
··· 281 281 } 282 282 #endif /* ! CONFIG_MEMORY_HOTPLUG */ 283 283 284 - #ifdef CONFIG_NUMA 285 - extern int memory_add_physaddr_to_nid(u64 start); 286 - extern int phys_to_target_node(u64 start); 287 - #else 288 - static inline int memory_add_physaddr_to_nid(u64 start) 289 - { 290 - return 0; 291 - } 292 - static inline int phys_to_target_node(u64 start) 293 - { 294 - return 0; 295 - } 296 - #endif 297 - 298 284 #if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_DEFERRED_STRUCT_PAGE_INIT) 299 285 /* 300 286 * pgdat resizing functions
+29 -1
include/linux/numa.h
··· 21 21 #endif 22 22 23 23 #ifdef CONFIG_NUMA 24 + #include <linux/printk.h> 25 + #include <asm/sparsemem.h> 26 + 24 27 /* Generic implementation available */ 25 28 int numa_map_to_online_node(int node); 26 - #else 29 + 30 + #ifndef memory_add_physaddr_to_nid 31 + static inline int memory_add_physaddr_to_nid(u64 start) 32 + { 33 + pr_info_once("Unknown online node for memory at 0x%llx, assuming node 0\n", 34 + start); 35 + return 0; 36 + } 37 + #endif 38 + #ifndef phys_to_target_node 39 + static inline int phys_to_target_node(u64 start) 40 + { 41 + pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n", 42 + start); 43 + return 0; 44 + } 45 + #endif 46 + #else /* !CONFIG_NUMA */ 27 47 static inline int numa_map_to_online_node(int node) 28 48 { 29 49 return NUMA_NO_NODE; 50 + } 51 + static inline int memory_add_physaddr_to_nid(u64 start) 52 + { 53 + return 0; 54 + } 55 + static inline int phys_to_target_node(u64 start) 56 + { 57 + return 0; 30 58 } 31 59 #endif 32 60
+2
include/linux/pagemap.h
··· 906 906 xas_set(&xas, rac->_index); 907 907 rcu_read_lock(); 908 908 xas_for_each(&xas, page, rac->_index + rac->_nr_pages - 1) { 909 + if (xas_retry(&xas, page)) 910 + continue; 909 911 VM_BUG_ON_PAGE(!PageLocked(page), page); 910 912 VM_BUG_ON_PAGE(PageTail(page), page); 911 913 array[i++] = page;
+4 -5
mm/huge_memory.c
··· 710 710 transparent_hugepage_use_zero_page()) { 711 711 pgtable_t pgtable; 712 712 struct page *zero_page; 713 - bool set; 714 713 vm_fault_t ret; 715 714 pgtable = pte_alloc_one(vma->vm_mm); 716 715 if (unlikely(!pgtable)) ··· 722 723 } 723 724 vmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd); 724 725 ret = 0; 725 - set = false; 726 726 if (pmd_none(*vmf->pmd)) { 727 727 ret = check_stable_address_space(vma->vm_mm); 728 728 if (ret) { 729 729 spin_unlock(vmf->ptl); 730 + pte_free(vma->vm_mm, pgtable); 730 731 } else if (userfaultfd_missing(vma)) { 731 732 spin_unlock(vmf->ptl); 733 + pte_free(vma->vm_mm, pgtable); 732 734 ret = handle_userfault(vmf, VM_UFFD_MISSING); 733 735 VM_BUG_ON(ret & VM_FAULT_FALLBACK); 734 736 } else { 735 737 set_huge_zero_page(pgtable, vma->vm_mm, vma, 736 738 haddr, vmf->pmd, zero_page); 737 739 spin_unlock(vmf->ptl); 738 - set = true; 739 740 } 740 - } else 741 + } else { 741 742 spin_unlock(vmf->ptl); 742 - if (!set) 743 743 pte_free(vma->vm_mm, pgtable); 744 + } 744 745 return ret; 745 746 } 746 747 gfp = alloc_hugepage_direct_gfpmask(vma);
+1 -3
mm/madvise.c
··· 226 226 struct address_space *mapping) 227 227 { 228 228 XA_STATE(xas, &mapping->i_pages, linear_page_index(vma, start)); 229 - pgoff_t end_index = end / PAGE_SIZE; 229 + pgoff_t end_index = linear_page_index(vma, end + PAGE_SIZE - 1); 230 230 struct page *page; 231 231 232 232 rcu_read_lock(); ··· 1231 1231 ret = total_len - iov_iter_count(&iter); 1232 1232 1233 1233 mmput(mm); 1234 - return ret; 1235 - 1236 1234 release_task: 1237 1235 put_task_struct(task); 1238 1236 put_pid:
+7 -2
mm/memcontrol.c
··· 867 867 rcu_read_lock(); 868 868 memcg = mem_cgroup_from_obj(p); 869 869 870 - /* Untracked pages have no memcg, no lruvec. Update only the node */ 871 - if (!memcg || memcg == root_mem_cgroup) { 870 + /* 871 + * Untracked pages have no memcg, no lruvec. Update only the 872 + * node. If we reparent the slab objects to the root memcg, 873 + * when we free the slab object, we need to update the per-memcg 874 + * vmstats to keep it correct for the root memcg. 875 + */ 876 + if (!memcg) { 872 877 __mod_node_page_state(pgdat, idx, val); 873 878 } else { 874 879 lruvec = mem_cgroup_lruvec(memcg, pgdat);
-18
mm/memory_hotplug.c
··· 350 350 return err; 351 351 } 352 352 353 - #ifdef CONFIG_NUMA 354 - int __weak memory_add_physaddr_to_nid(u64 start) 355 - { 356 - pr_info_once("Unknown online node for memory at 0x%llx, assuming node 0\n", 357 - start); 358 - return 0; 359 - } 360 - EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); 361 - 362 - int __weak phys_to_target_node(u64 start) 363 - { 364 - pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n", 365 - start); 366 - return 0; 367 - } 368 - EXPORT_SYMBOL_GPL(phys_to_target_node); 369 - #endif 370 - 371 353 /* find the smallest valid pfn in the range [start_pfn, end_pfn) */ 372 354 static unsigned long find_smallest_section_pfn(int nid, struct zone *zone, 373 355 unsigned long start_pfn,