On Sat, Jan 30, 2021 at 02:09:11AM +0000, Matthew Wilcox wrote: > On Fri, Jan 29, 2021 at 05:49:11PM -0800, Minchan Kim wrote: > > On Sat, Jan 30, 2021 at 01:28:44AM +0000, Matthew Wilcox wrote: > > > On Fri, Jan 29, 2021 at 05:22:24PM -0800, Minchan Kim wrote: > > > > Hi Mattew, > > > > > > > > On Sat, Jan 30, 2021 at 01:00:02AM +0000, Matthew Wilcox wrote: > > > > > On Fri, Jan 29, 2021 at 04:13:07PM -0800, Minchan Kim wrote: > > > > > > A custom driver overrides (vm_operations_struct.fault) and map their > > > > > > compound page(__GFP_COMP) to page table on userprocess on demand. > > > > > > > > > > You're looking to backport: > > > > > > > > > > commit d01ac3c35214ce362f50cada37cb7bab8c801896 > > > > > Author: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> > > > > > Date: Thu Oct 15 20:05:26 2020 -0700 > > > > > > > > > > mm/memory: remove page fault assumption of compound page size > > > > > > > > > > > > > I guess you meant the check below. > > > > > > > > if (compound_order(page) != HPAGE_PMD_ORDER) > > > > > > > > What happens if driver allcoated HPAGE_PMD_ORDER size? > > > > > > ... then it should be fine to map it with a PMD entry? > > > > I don't think so because following logic assumes it's THP page, > > for example, page_add_file_rmap, count_vm_event(THP_FILE_MAPPED) > > in do_set_pmd. > > > > Isn't it bug? > > Clearly nobody's actually tested it, but I think in principle, if a > device driver returns a PMD sized page (and it's appropriately aligned), > it should be mapped with a PMD entry. Okay, then you mean d01ac3c35214ce362f50cada37cb7bab8c801896 will fix the corruption for every-order driver compound page mapping. I have no idea it's worth to solve THP_FILE_MAPPED misaccounting problem but it doesn't matter for my case, at least. Thanks for the quick answer, Matthew.