From: John Hubbard <jhubbard@nvidia.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: <linux-mm@kvack.org>, <linux-fsdevel@vger.kernel.org>
Subject: Re: Are THPs the right model for the pagecache?
Date: Fri, 13 Nov 2020 11:44:42 -0800 [thread overview]
Message-ID: <a548e192-5977-2eef-b0b1-effdf744c35f@nvidia.com> (raw)
In-Reply-To: <20201113174409.GH17076@casper.infradead.org>
On 11/13/20 9:44 AM, Matthew Wilcox wrote:
> On Fri, Nov 13, 2020 at 12:38:36PM +0000, Matthew Wilcox wrote:
>> So what if we had:
>>
>> /* Cache memory */
>> struct cmem {
>> struct page pages[1];
>> };
>
> OK, that's a terrible name. I went with 'folio' for this demonstration.
> Other names suggested include album, sheaf and ream.
+1 for "folio", that's a good name! It stands out, as it should, given that
it's a different type. The others could work too, but this one is especially
nice because there are no pre-existing uses in the kernel, so no baggage.
And it's grep-able too.
Your demo diff looks good to me, and I think it noticeably improves things
and is worth doing. One tiny tweak first:
The struct member should be named .page, rather than .pages. That's because
pages in -mm usually refers to "struct page **", but here you've got a
struct page *. Notice how the various odd things get better in the patch
if you change it to .page:
...
> +static inline atomic_t *folio_mapcount_ptr(struct folio *folio)
> {
> - return &page[1].compound_mapcount;
> + return &folio->pages[1].compound_mapcount;
See, this diff is changing from "page" to "pages", but we don't
especially desire that, *and* it's arguably even more readable like
this anyway:
return &folio->page[1].compound_mapcount;
and...
...
> @@ -166,16 +167,16 @@ void __dump_page(struct page *page, const char *reason)
> out_mapping:
> BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1);
>
> - pr_warn("%sflags: %#lx(%pGp)%s\n", type, head->flags, &head->flags,
> - page_cma ? " CMA" : "");
> + pr_warn("%sflags: %#lx(%pGp)%s\n", type, folio->pages->flags,
> + &(folio->pages->flags), page_cma ? " CMA" : "");
>
> hex_only:
> print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32,
> sizeof(unsigned long), page,
> sizeof(struct page), false);
> - if (head != page)
> + if (folio->pages != page)
This one in particular gets a lot better:
if (folio->page != page)
...is much more natural.
thanks,
--
John Hubbard
NVIDIA
next prev parent reply other threads:[~2020-11-13 19:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 4:46 Matthew Wilcox
2020-11-13 6:39 ` John Hubbard
2020-11-13 12:38 ` Matthew Wilcox
2020-11-13 17:44 ` Matthew Wilcox
2020-11-13 19:44 ` John Hubbard [this message]
2020-11-13 7:08 ` Hugh Dickins
2020-11-13 15:19 ` Zi Yan
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=a548e192-5977-2eef-b0b1-effdf744c35f@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/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