On Mon, Mar 23, 2020 at 06:55:00AM -0700, Christoph Hellwig wrote: > On Mon, Mar 23, 2020 at 06:40:32AM -0700, Matthew Wilcox wrote: > > Oh, I see that now. It uses readahead_gfp_mask(), and I was grepping for > > GFP_NORETRY so I didn't spot it. It falls back to block_read_full_page() > > which we can't do. That will allocate smaller BIOs, so there's an argument > > that we should do the same. How about this: > > That looks silly to me. This just means we'll keep iterating over > small bios for readahead.. Either we just ignore the different gfp > mask, or we need to go all the way and handle errors, although that > doesn't really look nice. I'm not sure it's silly, although I'd love to see bio_alloc() support nr_iovecs == 0 meaning "allocate me any size biovec and tell me what size I got in ->bi_max_vecs". By allocating a small biovec this time, we do one allocation rather than two, and maybe by the time we come to allocate the next readahead bio, kswapd will have succeeded in freeing up more memory for us.