On 06/16/23 11:52, Sidhartha Kumar wrote: > On 6/15/23 4:36 PM, Mike Kravetz wrote: > > On 06/09/23 12:52, Sidhartha Kumar wrote: > > > On 6/9/23 12:49 PM, Sidhartha Kumar wrote: > > > > Signed-off-by: Sidhartha Kumar <sidhartha.kumar@xxxxxxxxxx> > > > > Like filemap_lock_hugetlb_folio(), can you just add hstate to existing > > hugetlb_add_to_page_cache() arguments and do arithmetic to convert index > > to PAGE_SIZE based index? > > > > I wanted to avoid using "magic numbers" through doing arithmetic shifts to > convert the index and instead explicitly use the linear_page_index() helper > function. However this does add more complexity as the function parameters > are changed. I can change it to doing the arithmetic shift to minimize code > changes for v2. > I would prefer the arithmetic shifts. The only magic is that it assumes the page cache is managed in PAGE_SIZE units. My guess is more code this this would break if that was changed. Matthew may have a more forward thinking opinion. -- Mike Kravetz