Ah yea, I was trying to do some device memory mapping where there's an offset into the page. Ok, I'll submit a patch that adds a VM_BUG_ON check that "addr" is page aligned and modify the header to reflect that. -Alex On Tue, Nov 5, 2019 at 8:04 AM Vlastimil Babka <vbabka@xxxxxxx> wrote: > > On 10/16/19 9:57 PM, Alex Zhang wrote: > > Hey there! > > > > I was seeing some weird behavior where I was hitting > > random BUG_ONs in memory.c . After a bit of debugging, > > I traced it back to remap_pfn_range being my entry point > > into memory.c . Should the "addr" passed it be page aligned? > > Most likely yes. How would you map if not on page boundary? I suspect it > was a bug in the caller? > > > I see no documentation stating that nor do I see any checks > > in the code for it. > > I suspect it was implicitly assumed. Most callers seem to pass > vma->vm_start as addr, which is page aligned. But 'size' parameter > alignment is fixed up, and it should be a similar case as addr. > Maybe a VM_BUG_ON check? > > > Alex > > > >