From: Hugh Dickins <hughd@google.com>
To: liuyuntao <liuyuntao10@huawei.com>
Cc: hughd@google.com, akpm@linux-foundation.org,
kirill.shutemov@linux.intel.com, kirill@shutemov.name,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
liusirui@huawei.com, windspectator@gmail.com,
wuxu.wu@huawei.com
Subject: Re: [PATCH v2] fix judgment error in shmem_is_huge()
Date: Sun, 26 Sep 2021 13:01:21 -0700 (PDT) [thread overview]
Message-ID: <b2b52cfc-20f2-3f7e-8fc0-ae9b54f34e93@google.com> (raw)
In-Reply-To: <20210926064201.3416154-1-liuyuntao10@huawei.com>
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
prev parent reply other threads:[~2021-09-26 20:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-09 3:20 Liu Yuntao
2021-09-09 6:17 ` Kirill A. Shutemov
2021-09-24 21:31 ` Hugh Dickins
2021-09-25 0:15 ` Hugh Dickins
2021-09-26 6:42 ` liuyuntao
2021-09-26 20:01 ` Hugh Dickins [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b2b52cfc-20f2-3f7e-8fc0-ae9b54f34e93@google.com \
--to=hughd@google.com \
--cc=akpm@linux-foundation.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liusirui@huawei.com \
--cc=liuyuntao10@huawei.com \
--cc=windspectator@gmail.com \
--cc=wuxu.wu@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox