···1612716127M: Mike Rapoport <rppt@kernel.org>1612816128L: linux-mm@kvack.org1612916129S: Maintained1613016130+T: git git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock.git1613016131F: include/linux/numa_memblks.h1613116132F: mm/numa.c1613216133F: mm/numa_emulation.c···1619516194R: Liam R. Howlett <Liam.Howlett@oracle.com>1619616195R: Vlastimil Babka <vbabka@suse.cz>1619716196R: Harry Yoo <harry.yoo@oracle.com>1619716197+R: Jann Horn <jannh@google.com>1619816198L: linux-mm@kvack.org1619916199S: Maintained1620016200F: include/linux/rmap.h···1624116239R: Ryan Roberts <ryan.roberts@arm.com>1624216240R: Dev Jain <dev.jain@arm.com>1624316241R: Barry Song <baohua@kernel.org>1624216242+R: Lance Yang <lance.yang@linux.dev>1624416243L: linux-mm@kvack.org1624516244S: Maintained1624616245W: http://www.linux-mm.org
···706706 * it not only handles the fiemap for inlined files, but also deals707707 * with the fast symlink, cause they have no difference for extent708708 * mapping per se.709709+ *710710+ * Must be called with ip_alloc_sem semaphore held.709711 */710712static int ocfs2_fiemap_inline(struct inode *inode, struct buffer_head *di_bh,711713 struct fiemap_extent_info *fieinfo,···719717 u64 phys;720718 u32 flags = FIEMAP_EXTENT_DATA_INLINE|FIEMAP_EXTENT_LAST;721719 struct ocfs2_inode_info *oi = OCFS2_I(inode);720720+ lockdep_assert_held_read(&oi->ip_alloc_sem);722721723722 di = (struct ocfs2_dinode *)di_bh->b_data;724723 if (ocfs2_inode_is_fast_symlink(inode))···735732 phys += offsetof(struct ocfs2_dinode,736733 id2.i_data.id_data);737734735735+ /* Release the ip_alloc_sem to prevent deadlock on page fault */736736+ up_read(&OCFS2_I(inode)->ip_alloc_sem);738737 ret = fiemap_fill_next_extent(fieinfo, 0, phys, id_count,739738 flags);739739+ down_read(&OCFS2_I(inode)->ip_alloc_sem);740740 if (ret < 0)741741 return ret;742742 }···808802 len_bytes = (u64)le16_to_cpu(rec.e_leaf_clusters) << osb->s_clustersize_bits;809803 phys_bytes = le64_to_cpu(rec.e_blkno) << osb->sb->s_blocksize_bits;810804 virt_bytes = (u64)le32_to_cpu(rec.e_cpos) << osb->s_clustersize_bits;811811-805805+ /* Release the ip_alloc_sem to prevent deadlock on page fault */806806+ up_read(&OCFS2_I(inode)->ip_alloc_sem);812807 ret = fiemap_fill_next_extent(fieinfo, virt_bytes, phys_bytes,813808 len_bytes, fe_flags);809809+ down_read(&OCFS2_I(inode)->ip_alloc_sem);814810 if (ret)815811 break;816812
+2-1
fs/proc/generic.c
···393393 if (proc_alloc_inum(&dp->low_ino))394394 goto out_free_entry;395395396396- pde_set_flags(dp);396396+ if (!S_ISDIR(dp->mode))397397+ pde_set_flags(dp);397398398399 write_lock(&proc_subdir_lock);399400 dp->parent = dir;
+25-6
include/linux/compiler-clang.h
···1818#define KASAN_ABI_VERSION 519192020/*2121+ * Clang 22 added preprocessor macros to match GCC, in hopes of eventually2222+ * dropping __has_feature support for sanitizers:2323+ * https://github.com/llvm/llvm-project/commit/568c23bbd3303518c5056d7f03444dae4fdc8a9c2424+ * Create these macros for older versions of clang so that it is easy to clean2525+ * up once the minimum supported version of LLVM for building the kernel always2626+ * creates these macros.2727+ *2128 * Note: Checking __has_feature(*_sanitizer) is only true if the feature is2229 * enabled. Therefore it is not required to additionally check defined(CONFIG_*)2330 * to avoid adding redundant attributes in other configurations.2431 */2525-2626-#if __has_feature(address_sanitizer) || __has_feature(hwaddress_sanitizer)2727-/* Emulate GCC's __SANITIZE_ADDRESS__ flag */3232+#if __has_feature(address_sanitizer) && !defined(__SANITIZE_ADDRESS__)2833#define __SANITIZE_ADDRESS__3434+#endif3535+#if __has_feature(hwaddress_sanitizer) && !defined(__SANITIZE_HWADDRESS__)3636+#define __SANITIZE_HWADDRESS__3737+#endif3838+#if __has_feature(thread_sanitizer) && !defined(__SANITIZE_THREAD__)3939+#define __SANITIZE_THREAD__4040+#endif4141+4242+/*4343+ * Treat __SANITIZE_HWADDRESS__ the same as __SANITIZE_ADDRESS__ in the kernel.4444+ */4545+#ifdef __SANITIZE_HWADDRESS__4646+#define __SANITIZE_ADDRESS__4747+#endif4848+4949+#ifdef __SANITIZE_ADDRESS__2950#define __no_sanitize_address \3051 __attribute__((no_sanitize("address", "hwaddress")))3152#else3253#define __no_sanitize_address3354#endif34553535-#if __has_feature(thread_sanitizer)3636-/* emulate gcc's __SANITIZE_THREAD__ flag */3737-#define __SANITIZE_THREAD__5656+#ifdef __SANITIZE_THREAD__3857#define __no_sanitize_thread \3958 __attribute__((no_sanitize("thread")))4059#else
+2
include/linux/damon.h
···636636 * @data: Data that will be passed to @fn.637637 * @repeat: Repeat invocations.638638 * @return_code: Return code from @fn invocation.639639+ * @dealloc_on_cancel: De-allocate when canceled.639640 *640641 * Control damon_call(), which requests specific kdamond to invoke a given641642 * function. Refer to damon_call() for more details.···646645 void *data;647646 bool repeat;648647 int return_code;648648+ bool dealloc_on_cancel;649649/* private: internal use only */650650 /* informs if the kdamond finished handling of the request */651651 struct completion completion;
+3-3
include/linux/kasan.h
···562562#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)563563564564void kasan_populate_early_vm_area_shadow(void *start, unsigned long size);565565-int kasan_populate_vmalloc(unsigned long addr, unsigned long size);565565+int kasan_populate_vmalloc(unsigned long addr, unsigned long size, gfp_t gfp_mask);566566void kasan_release_vmalloc(unsigned long start, unsigned long end,567567 unsigned long free_region_start,568568 unsigned long free_region_end,···574574 unsigned long size)575575{ }576576static inline int kasan_populate_vmalloc(unsigned long start,577577- unsigned long size)577577+ unsigned long size, gfp_t gfp_mask)578578{579579 return 0;580580}···610610static inline void kasan_populate_early_vm_area_shadow(void *start,611611 unsigned long size) { }612612static inline int kasan_populate_vmalloc(unsigned long start,613613- unsigned long size)613613+ unsigned long size, gfp_t gfp_mask)614614{615615 return 0;616616}
+10
include/linux/swap.h
···381381void mark_page_accessed(struct page *);382382void folio_mark_accessed(struct folio *);383383384384+static inline bool folio_may_be_lru_cached(struct folio *folio)385385+{386386+ /*387387+ * Holding PMD-sized folios in per-CPU LRU cache unbalances accounting.388388+ * Holding small numbers of low-order mTHP folios in per-CPU LRU cache389389+ * will be sensible, but nobody has implemented and tested that yet.390390+ */391391+ return !folio_test_large(folio);392392+}393393+384394extern atomic_t lru_disable_count;385395386396static inline bool lru_cache_disabled(void)
+1-1
init/main.c
···956956 sort_main_extable();957957 trap_init();958958 mm_core_init();959959+ maple_tree_init();959960 poking_init();960961 ftrace_init();961962···974973 "Interrupts were enabled *very* early, fixing it\n"))975974 local_irq_disable();976975 radix_tree_init();977977- maple_tree_init();978976979977 /*980978 * Set up housekeeping before setting up workqueues to allow the unbound
+10-2
mm/damon/core.c
···21412141 if (!quota->ms && !quota->sz && list_empty("a->goals))21422142 return;2143214321442144+ /* First charge window */21452145+ if (!quota->total_charged_sz && !quota->charged_from)21462146+ quota->charged_from = jiffies;21472147+21442148 /* New charge window starts */21452149 if (time_after_eq(jiffies, quota->charged_from +21462150 msecs_to_jiffies(quota->reset_interval))) {···25102506 mutex_lock(&ctx->call_controls_lock);25112507 list_del(&control->list);25122508 mutex_unlock(&ctx->call_controls_lock);25132513- if (!control->repeat)25092509+ if (!control->repeat) {25142510 complete(&control->completion);25152515- else25112511+ } else if (control->canceled && control->dealloc_on_cancel) {25122512+ kfree(control);25132513+ continue;25142514+ } else {25162515 list_add(&control->list, &repeat_controls);25162516+ }25172517 }25182518 control = list_first_entry_or_null(&repeat_controls,25192519 struct damon_call_control, list);
+5
mm/damon/lru_sort.c
···198198 if (err)199199 return err;200200201201+ if (!damon_lru_sort_mon_attrs.sample_interval) {202202+ err = -EINVAL;203203+ goto out;204204+ }205205+201206 err = damon_set_attrs(ctx, &damon_lru_sort_mon_attrs);202207 if (err)203208 goto out;
+5
mm/damon/reclaim.c
···194194 if (err)195195 return err;196196197197+ if (!damon_reclaim_mon_attrs.aggr_interval) {198198+ err = -EINVAL;199199+ goto out;200200+ }201201+197202 err = damon_set_attrs(param_ctx, &damon_reclaim_mon_attrs);198203 if (err)199204 goto out;
···22872287 struct pages_or_folios *pofs)22882288{22892289 unsigned long collected = 0;22902290- bool drain_allow = true;22912290 struct folio *folio;22912291+ int drained = 0;22922292 long i = 0;2293229322942294 for (folio = pofs_get_folio(pofs, i); folio;···23072307 continue;23082308 }2309230923102310- if (!folio_test_lru(folio) && drain_allow) {23102310+ if (drained == 0 && folio_may_be_lru_cached(folio) &&23112311+ folio_ref_count(folio) !=23122312+ folio_expected_ref_count(folio) + 1) {23132313+ lru_add_drain();23142314+ drained = 1;23152315+ }23162316+ if (drained == 1 && folio_may_be_lru_cached(folio) &&23172317+ folio_ref_count(folio) !=23182318+ folio_expected_ref_count(folio) + 1) {23112319 lru_add_drain_all();23122312- drain_allow = false;23202320+ drained = 2;23132321 }2314232223152323 if (!folio_isolate_lru(folio))
+6-3
mm/hugetlb.c
···58545854 spinlock_t *ptl;58555855 struct hstate *h = hstate_vma(vma);58565856 unsigned long sz = huge_page_size(h);58575857- bool adjust_reservation = false;58575857+ bool adjust_reservation;58585858 unsigned long last_addr_mask;58595859 bool force_flush = false;58605860···59475947 sz);59485948 hugetlb_count_sub(pages_per_huge_page(h), mm);59495949 hugetlb_remove_rmap(folio);59505950+ spin_unlock(ptl);5950595159515952 /*59525953 * Restore the reservation for anonymous page, otherwise the···59555954 * If there we are freeing a surplus, do not set the restore59565955 * reservation bit.59575956 */59575957+ adjust_reservation = false;59585958+59595959+ spin_lock_irq(&hugetlb_lock);59585960 if (!h->surplus_huge_pages && __vma_private_lock(vma) &&59595961 folio_test_anon(folio)) {59605962 folio_set_hugetlb_restore_reserve(folio);59615963 /* Reservation to be adjusted after the spin lock */59625964 adjust_reservation = true;59635965 }59645964-59655965- spin_unlock(ptl);59665966+ spin_unlock_irq(&hugetlb_lock);5966596759675968 /*59685969 * Adjust the reservation for the region that will have the
+24-7
mm/kasan/shadow.c
···336336 }337337}338338339339-static int ___alloc_pages_bulk(struct page **pages, int nr_pages)339339+static int ___alloc_pages_bulk(struct page **pages, int nr_pages, gfp_t gfp_mask)340340{341341 unsigned long nr_populated, nr_total = nr_pages;342342 struct page **page_array = pages;343343344344 while (nr_pages) {345345- nr_populated = alloc_pages_bulk(GFP_KERNEL, nr_pages, pages);345345+ nr_populated = alloc_pages_bulk(gfp_mask, nr_pages, pages);346346 if (!nr_populated) {347347 ___free_pages_bulk(page_array, nr_total - nr_pages);348348 return -ENOMEM;···354354 return 0;355355}356356357357-static int __kasan_populate_vmalloc(unsigned long start, unsigned long end)357357+static int __kasan_populate_vmalloc(unsigned long start, unsigned long end, gfp_t gfp_mask)358358{359359 unsigned long nr_pages, nr_total = PFN_UP(end - start);360360 struct vmalloc_populate_data data;361361+ unsigned int flags;361362 int ret = 0;362363363363- data.pages = (struct page **)__get_free_page(GFP_KERNEL | __GFP_ZERO);364364+ data.pages = (struct page **)__get_free_page(gfp_mask | __GFP_ZERO);364365 if (!data.pages)365366 return -ENOMEM;366367367368 while (nr_total) {368369 nr_pages = min(nr_total, PAGE_SIZE / sizeof(data.pages[0]));369369- ret = ___alloc_pages_bulk(data.pages, nr_pages);370370+ ret = ___alloc_pages_bulk(data.pages, nr_pages, gfp_mask);370371 if (ret)371372 break;372373373374 data.start = start;375375+376376+ /*377377+ * page tables allocations ignore external gfp mask, enforce it378378+ * by the scope API379379+ */380380+ if ((gfp_mask & (__GFP_FS | __GFP_IO)) == __GFP_IO)381381+ flags = memalloc_nofs_save();382382+ else if ((gfp_mask & (__GFP_FS | __GFP_IO)) == 0)383383+ flags = memalloc_noio_save();384384+374385 ret = apply_to_page_range(&init_mm, start, nr_pages * PAGE_SIZE,375386 kasan_populate_vmalloc_pte, &data);387387+388388+ if ((gfp_mask & (__GFP_FS | __GFP_IO)) == __GFP_IO)389389+ memalloc_nofs_restore(flags);390390+ else if ((gfp_mask & (__GFP_FS | __GFP_IO)) == 0)391391+ memalloc_noio_restore(flags);392392+376393 ___free_pages_bulk(data.pages, nr_pages);377394 if (ret)378395 break;···403386 return ret;404387}405388406406-int kasan_populate_vmalloc(unsigned long addr, unsigned long size)389389+int kasan_populate_vmalloc(unsigned long addr, unsigned long size, gfp_t gfp_mask)407390{408391 unsigned long shadow_start, shadow_end;409392 int ret;···432415 shadow_start = PAGE_ALIGN_DOWN(shadow_start);433416 shadow_end = PAGE_ALIGN(shadow_end);434417435435- ret = __kasan_populate_vmalloc(shadow_start, shadow_end);418418+ ret = __kasan_populate_vmalloc(shadow_start, shadow_end, gfp_mask);436419 if (ret)437420 return ret;438421
···17741774 if (!vrm->new_len)17751775 return -EINVAL;1776177617771777- /* Is the new length or address silly? */17781778- if (vrm->new_len > TASK_SIZE ||17791779- vrm->new_addr > TASK_SIZE - vrm->new_len)17771777+ /* Is the new length silly? */17781778+ if (vrm->new_len > TASK_SIZE)17801779 return -EINVAL;1781178017821781 /* Remainder of checks are for cases with specific new_addr. */17831782 if (!vrm_implies_new_addr(vrm))17841783 return 0;17841784+17851785+ /* Is the new address silly? */17861786+ if (vrm->new_addr > TASK_SIZE - vrm->new_len)17871787+ return -EINVAL;1785178817861789 /* The new address must be page-aligned. */17871790 if (offset_in_page(vrm->new_addr))
+12-8
mm/percpu.c
···17341734 bool is_atomic;17351735 bool do_warn;17361736 struct obj_cgroup *objcg = NULL;17371737- static int warn_limit = 10;17371737+ static atomic_t warn_limit = ATOMIC_INIT(10);17381738 struct pcpu_chunk *chunk, *next;17391739 const char *err;17401740 int slot, off, cpu, ret;···19041904fail:19051905 trace_percpu_alloc_percpu_fail(reserved, is_atomic, size, align);1906190619071907- if (do_warn && warn_limit) {19081908- pr_warn("allocation failed, size=%zu align=%zu atomic=%d, %s\n",19091909- size, align, is_atomic, err);19101910- if (!is_atomic)19111911- dump_stack();19121912- if (!--warn_limit)19131913- pr_info("limit reached, disable warning\n");19071907+ if (do_warn) {19081908+ int remaining = atomic_dec_if_positive(&warn_limit);19091909+19101910+ if (remaining >= 0) {19111911+ pr_warn("allocation failed, size=%zu align=%zu atomic=%d, %s\n",19121912+ size, align, is_atomic, err);19131913+ if (!is_atomic)19141914+ dump_stack();19151915+ if (remaining == 0)19161916+ pr_info("limit reached, disable warning\n");19171917+ }19141918 }1915191919161920 if (is_atomic) {
···20262026 if (unlikely(!vmap_initialized))20272027 return ERR_PTR(-EBUSY);2028202820292029+ /* Only reclaim behaviour flags are relevant. */20302030+ gfp_mask = gfp_mask & GFP_RECLAIM_MASK;20292031 might_sleep();2030203220312033 /*···20402038 */20412039 va = node_alloc(size, align, vstart, vend, &addr, &vn_id);20422040 if (!va) {20432043- gfp_mask = gfp_mask & GFP_RECLAIM_MASK;20442044-20452041 va = kmem_cache_alloc_node(vmap_area_cachep, gfp_mask, node);20462042 if (unlikely(!va))20472043 return ERR_PTR(-ENOMEM);···20892089 BUG_ON(va->va_start < vstart);20902090 BUG_ON(va->va_end > vend);2091209120922092- ret = kasan_populate_vmalloc(addr, size);20922092+ ret = kasan_populate_vmalloc(addr, size, gfp_mask);20932093 if (ret) {20942094 free_vmap_area(va);20952095 return ERR_PTR(ret);···4845484548464846 /* populate the kasan shadow space */48474847 for (area = 0; area < nr_vms; area++) {48484848- if (kasan_populate_vmalloc(vas[area]->va_start, sizes[area]))48484848+ if (kasan_populate_vmalloc(vas[area]->va_start, sizes[area], GFP_KERNEL))48494849 goto err_free_shadow;48504850 }48514851
+1-1
mm/vmscan.c
···45004500 }4501450145024502 /* ineligible */45034503- if (!folio_test_lru(folio) || zone > sc->reclaim_idx) {45034503+ if (zone > sc->reclaim_idx) {45044504 gen = folio_inc_gen(lruvec, folio, false);45054505 list_move_tail(&folio->lru, &lrugen->folios[gen][type][zone]);45064506 return true;
+3
samples/damon/mtier.c
···208208 if (enabled == is_enabled)209209 return 0;210210211211+ if (!init_called)212212+ return 0;213213+211214 if (enabled) {212215 err = damon_sample_mtier_start();213216 if (err)
+3
samples/damon/prcl.c
···137137 if (enabled == is_enabled)138138 return 0;139139140140+ if (!init_called)141141+ return 0;142142+140143 if (enabled) {141144 err = damon_sample_prcl_start();142145 if (err)