[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230616234125.GC7371@monkey>
Date: Fri, 16 Jun 2023 16:41:25 -0700
From: Mike Kravetz <mike.kravetz@...cle.com>
To: Sidhartha Kumar <sidhartha.kumar@...cle.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
akpm@...ux-foundation.org, songmuchun@...edance.com,
willy@...radead.org, david@...hat.com, nphamcs@...il.com,
jthoughton@...gle.com
Subject: Re: [PATCH 2/2] mm/hugetlb: add wrapper functions for interactions
with page cache
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@...cle.com>
> >
> > 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
Powered by blists - more mailing lists