On 2/7/2023 12:50 AM, Matthew Wilcox wrote: > On Mon, Feb 06, 2023 at 11:30:49PM +0800, Yin Fengwei wrote: >> Remove parameter 'compound' from folio_add_file_rmap_range(). >> >> The parameter nr_pages is checked whether same as folio page >> numbers to know whether it's entire folio operation. > > We can't do this yet. Even if a folio is large enough to be PMD mapped, > it may have been mapped askew (or its PMD mapping may have been split). > We still need the caller to tell us whether it's been mapped with > a PMD or with PTEs. OK. My understand is that the info about PMD mapped is only for statistic update. Maybe move the PMD mapped statistic to caller. Another thing I am not sure whether it's worthy: What about maintaining total mapcount for folio? So we don't need to query each page mapcount to know it. So we can use "total_mapoucnt > mapped" to know whether the folio has at least one page mapped more than once. The payback is that we need update total mapcount when map/unmap the folio. Regards Yin, Fengwei >