Il giorno ven 8 nov 2024 alle ore 18:35 Johannes Weiner <hannes@xxxxxxxxxxx> ha scritto: > The syzbot console output indicates a virtual environment where > swapfile is on a rotational device. In this case, clusters aren't > actually used, and si->full_clusters is not initialized. Daan's report > is from qemu, so likely rotational too. > > Make sure to only schedule the cluster reclaim work when clusters are > actually in use. > > Link: https://lore.kernel.org/lkml/672ac50b.050a0220.2edce.1517.GAE@xxxxxxxxxx/ > Link: https://github.com/systemd/systemd/issues/35044 > Fixes: 5168a68eb78f ("mm, swap: avoid over reclaim of full clusters") > Reported-by: syzbot+078be8bfa863cb9e0c6b@xxxxxxxxxxxxxxxxxxxxxxxxx > Reported-by: Daan De Meyer <daan.j.demeyer@xxxxxxxxx> > Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx> > --- > mm/swapfile.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/swapfile.c b/mm/swapfile.c > index 46bd4b1a3c07..9c85bd46ab7f 100644 > --- a/mm/swapfile.c > +++ b/mm/swapfile.c > @@ -929,7 +929,7 @@ static void swap_range_alloc(struct swap_info_struct *si, unsigned long offset, > si->highest_bit = 0; > del_from_avail_list(si); > > - if (vm_swap_full()) > + if (si->cluster_info && vm_swap_full()) > schedule_work(&si->reclaim_work); > } > } > -- I've tested the patch and now the oomd test passes: 1/1 systemd:integration-tests / TEST-55-OOMD OK 63.48s Tested-by: Matteo Croce <teknoraver@xxxxxxxx> -- Matteo Croce perl -e 'for($t=0;;$t++){print chr($t*($t>>8|$t>>13)&255)}' |aplay