On Fri, 11 Dec 2020, Johannes Thumshirn wrote: > On 11/12/2020 15:57, SelvaKumar S wrote: > [...] > > +int blk_copy_emulate(struct block_device *bdev, struct blk_copy_payload *payload, > > + gfp_t gfp_mask) > > +{ > > + struct request_queue *q = bdev_get_queue(bdev); > > + struct bio *bio; > > + void *buf = NULL; > > + int i, nr_srcs, max_range_len, ret, cur_dest, cur_size; > > + > > + nr_srcs = payload->copy_range; > > + max_range_len = q->limits.max_copy_range_sectors << SECTOR_SHIFT; > > + cur_dest = payload->dest; > > + buf = kvmalloc(max_range_len, GFP_ATOMIC); > > Why GFP_ATOMIC and not the passed in gfp_mask? Especially as this is a kvmalloc() > which has the potential to grow quite big. You are right, this is confusing. There's this piece of code at the top of kvmalloc_node: if ((flags & GFP_KERNEL) != GFP_KERNEL) return kmalloc_node(size, flags, node); So, when you use GFP_ATOMIC flag, it will always fall back to kmalloc. Mikulas