On Thu, Apr 18, 2024 at 9:55 AM Barry Song <21cnbao@xxxxxxxxx> wrote: > > On Thu, Apr 18, 2024 at 4:12 AM Kairui Song <ryncsn@xxxxxxxxx> wrote: > > > > From: Kairui Song <kasong@xxxxxxxxxxx> > > > > When applied on swap cache pages, page_index / page_file_offset was used > > to retrieve the swap cache index or swap file offset of a page, and they > > have their folio equivalence version: folio_index / folio_file_pos. > > > > We have eliminated all users for page_index / page_file_offset, everything > > is using folio_index / folio_file_pos now, so remove the old helpers. > > > > Then convert the implementation of folio_index / folio_file_pos to > > to use folio natively. > > > > After this commit, all users that might encounter mixed usage of swap > > cache and page cache will only use following two helpers: > > > > folio_index (calls __folio_swap_cache_index) > > folio_file_pos (calls __folio_swap_file_pos) > > > > The offset in swap file and index in swap cache is still basically the > > same thing at this moment, but will be different in following commits. > > > > Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx> > > Hi Kairui, thanks ! > > I also find it rather odd that folio_file_page() is utilized for both > swp and file. > > mm/memory.c <<do_swap_page>> > page = folio_file_page(folio, swp_offset(entry)); > mm/swap_state.c <<swapin_readahead>> > return folio_file_page(folio, swp_offset(entry)); > mm/swapfile.c <<unuse_pte>> > page = folio_file_page(folio, swp_offset(entry)); > > Do you believe it's worthwhile to tidy up? > Hi Barry, I'm not sure about this. Using folio_file_page doesn't look too bad, and it will be gone once we convert them to always use folio, this shouldn't take too long.