On Mon, Apr 29, 2024 at 07:54:05PM +0000, Chaitanya Kulkarni wrote: > On 4/29/24 03:23, Keith Busch wrote: > > static void brd_submit_bio(struct bio *bio) > > { > > struct brd_device *brd = bio->bi_bdev->bd_disk->private_data; > > @@ -247,6 +264,12 @@ static void brd_submit_bio(struct bio *bio) > > struct bio_vec bvec; > > struct bvec_iter iter; > > > > + if (unlikely(op_is_discard(bio->bi_opf))) { > > I've been told that unlikely should not be used with discard as it is > bad for discard workloads, if that is still true, then can you please > remove unlikely ? I don't think discard workloads are likely on a ramdisk. > Also, if you are doing this can you please also add support for > write-zeroes for the sake of completeness ? unless that support is > not desired for brd ... That is orthoganal to the goals here. I just need to temporarily reclaim memory for other purposes when the disk is temporarily not being use; I don't care about the zero'ing out part. I found that previous attempts at supporting discard on brd didn't make it, supposedly because of some kind of writeback deadlock. I have no idea what that comment way back from 2.6.35 is referring to though: we allocate pages with NOIO or NOWAIT, so either brd can get a new page when its needed or it fails, and either is fine, but deadlock shouldn't happen.