On 16/04/19 21:47, Jerome Glisse wrote: > On Tue, Apr 16, 2019 at 09:35:04PM +0300, Boaz Harrosh wrote: >> On Thu, Apr 11, 2019 at 05:08:19PM -0400, jglisse@xxxxxxxxxx wrote: >>> From: Jérôme Glisse <jglisse@xxxxxxxxxx> >>> <> >> Why do we need a bv_pfn. Why not just use the lowest bit of the page-ptr >> as a flag (pointer always aligned to 64 bytes in our case). >> >> So yes we need an inline helper for reference of the page but is it not clearer >> that we assume a page* and not any kind of pfn ? >> It will not be the first place using low bits of a pointer for flags. > > Yes i can use the lower bit of struct page * pointer it should be safe on > all architecture. I wanted to change the bv_page field name to make sure > that we catch anyone doing any direct dereference. Do you prefer keeping a > page pointer there ? > Yes I would prefer that personally. Changing the name (And type to ulong) is a good idea, let the compiler check us. But lets make sure we all understand this is a page pointer. And not any kind of pfn. >> >> That said. Why we need it at all? I mean why not have it as a bio flag. If it exist >> at all that a user has a GUP and none-GUP pages to IO at the same request he/she >> can just submit them as two separate BIOs (chained at the block layer). >> >> Many users just submit one page bios and let elevator merge them any way. > > The issue is that bio_vec is use, on its own, outside of bios and for > those use cases i need to track the GUP status within the bio_vec. Thus > it is easier to use the same mechanisms for bio too as adding a flag to > bio would mean that i also have to audit all code path that could merge > bios. While i believe it should be restrictred to block/blk-merge.c it > seems some block and some fs have spawn some custom bio manipulation > (md comes to mind). I would imagine they use mechanics as bio-split and bio-clone so it need only be handled there. but ... > So using same mechanism for bio_vec and bio seems > like a safer and easier course of action. > OK I get it thanks. I would imagine the opposite but I have not audited all call sighs, if you say there are fewer bvec call sites then it makes sense. > Cheers, > Jérôme > Thanks Boaz