The patch titled Subject: mm-swap-remove-boilerplate-fix has been added to the -mm mm-unstable branch. Its filename is mm-swap-remove-boilerplate-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-swap-remove-boilerplate-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Yu Zhao <yuzhao@xxxxxxxxxx> Subject: mm-swap-remove-boilerplate-fix Date: Fri, 26 Jul 2024 00:50:04 -0600 fix "BUG: using smp_processor_id() in preemptible" Link: https://lkml.kernel.org/r/ZqNHHMiHn-9vy_II@xxxxxxxxxx Signed-off-by: Yu Zhao <yuzhao@xxxxxxxxxx> Reported-by: Barry Song <21cnbao@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/swap.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) --- a/mm/swap.c~mm-swap-remove-boilerplate-fix +++ a/mm/swap.c @@ -220,7 +220,7 @@ static void folio_batch_move_lru(struct folios_put(fbatch); } -static void __folio_batch_add_and_move(struct folio_batch *fbatch, +static void __folio_batch_add_and_move(struct folio_batch __percpu *fbatch, struct folio *folio, move_fn_t move_fn, bool on_lru, bool disable_irq) { @@ -233,16 +233,14 @@ static void __folio_batch_add_and_move(s return; } - if (folio_batch_add(fbatch, folio) && !folio_test_large(folio) && - !lru_cache_disabled()) - return; - if (disable_irq) local_lock_irqsave(&cpu_fbatches.lock_irq, flags); else local_lock(&cpu_fbatches.lock); - folio_batch_move_lru(fbatch, move_fn); + if (!folio_batch_add(this_cpu_ptr(fbatch), folio) || folio_test_large(folio) || + lru_cache_disabled()) + folio_batch_move_lru(this_cpu_ptr(fbatch), move_fn); if (disable_irq) local_unlock_irqrestore(&cpu_fbatches.lock_irq, flags); @@ -252,7 +250,7 @@ static void __folio_batch_add_and_move(s #define folio_batch_add_and_move(folio, op, on_lru) \ __folio_batch_add_and_move( \ - this_cpu_ptr(&cpu_fbatches.op), \ + &cpu_fbatches.op, \ folio, \ op, \ on_lru, \ _ Patches currently in -mm which might be from yuzhao@xxxxxxxxxx are mm-hugetlb_vmemmap-dont-synchronize_rcu-without-hvo.patch mm-swap-reduce-indentation-level.patch mm-swap-rename-cpu_fbatches-activate.patch mm-swap-fold-lru_rotate-into-cpu_fbatches.patch mm-swap-remove-remaining-_fn-suffix.patch mm-swap-remove-boilerplate.patch mm-swap-remove-boilerplate-fix.patch