Re: [PATCH v2] fix judgment error in shmem_is_huge()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 26 Sep 2021, liuyuntao wrote:
> On Sat, 25 Sep 2021, Hugh Dickins wrote:
> > On Fri, 24 Sep 2021, Hugh Dickins wrote:
> > > On Thu, 9 Sep 2021, Liu Yuntao wrote:
> > > 
> > > > In the case of SHMEM_HUGE_WITHIN_SIZE, the page index is not rounded
> > > > up correctly. When the page index points to the first page in a huge
> > > > page, round_up() cannot bring it to the end of the huge page, but
> > > > to the end of the previous one.
> > > > 
> > > > an example:
> > > > HPAGE_PMD_NR on my machine is 512(2 MB huge page size).
> > > > After allcoating a 3000 KB buffer, I access it at location 2050 KB.
> > > 
> > > Your example is certainly helpful, but weird!  It's not impossible,
> > > but wouldn't it be easier to understand if you said "2048 KB" there?
> 
> I wanted to emphasize that access to any bit in the first page will
> trigger this problem, so I didn't use "2048 KB".

Okay, thanks, I see your point now.  (And I have to admit that, in my
confusion, I had thought 2050 KB would be index 514 - of course not!)

> > > > In shmem_is_huge(), the corresponding index happens to be 512.

...

> > Your patch makes within_size more sensible than it was for pre-sized
> > files (and I think it's fair to say that the majority of files in
> > shmem's internal mount, subject to thp/shmem_enabled, are likely to
> > be fixed-size files); and better-defined than it used to be on
> > growing files, but they won't get the huge pages they used to.
> 
> Although my patch changes shmem's behaviour, it makes shmem consistent
> with the documentation. I think with the new code, it will be easier
> for our users to understand.

Yes, I do agree with you.  But the change in behaviour when appending at
EOF is significant, and needed to be called out - I think none of quite
realized that effect at first.

Hugh




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux