> On 05.06.24 04:20, ran xiaokai wrote: > >> On 04.06.24 07:47, xu.xin16@xxxxxxxxxx wrote: > >>> From: Ran Xiaokai <ran.xiaokai@xxxxxxxxxx> > >>> > >>> When I did a large folios split test, a WARNING > >>> "[ 5059.122759][ T166] Cannot split file folio to non-0 order" > >>> was triggered. But my test cases are only for anonmous folios. > >>> while mapping_large_folio_support() is only reasonable for page > >>> cache folios. > >> > >> Agreed. > >> > >> I wonder if mapping_large_folio_support() should either > >> > >> a) Complain if used for anon folios, so we can detect the wrong use more > >> easily. (VM_WARN_ON_ONCE()) > > > >> b) Return "true" for anonymous mappings, although that's more debatable. > >> > > > > Hi, David, > > Thanks for the review. > > I think a) is better. > > But we have to add a new parameter "folio" to mapping_large_folio_support(), right ? > > something like mapping_large_folio_support(struct address_space *mapping, struct folio *folio) ? > > But in the __filemap_get_folio() path, > > > > __filemap_get_folio() > > no_page: > > .... > > if (!mapping_large_folio_support(mapping)) > > > > the folio is not allocated yet, yes ? > > Or do you mean there is some other way to do this ? > > If we really pass unmodified folio->mapping, you can do what > folio_test_anon() would and make sure PAGE_MAPPING_ANON is not set. I think I just misunderstood your suggestion. How about this ? static inline bool mapping_large_folio_support(struct address_space *mapping) { VM_WARN_ONCE((unsigned long)mapping & PAGE_MAPPING_ANON, "Anonymous mapping always supports large folio"); return IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && test_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags); }