From: Matthew Wilcox <willy@infradead.org>
To: Kehong Zhang <zhangkehong@hisilicon.com>
Cc: Michal Hocko <mhocko@suse.com>, Rik van Riel <riel@surriel.com>,
Marc Zyngier <marc.zyngier@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Vlastimil Babka <vbabka@suse.cz>,
Will Deacon <will.deacon@arm.com>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Andrey Konovalov <andreyknvl@google.com>,
Andrey Ryabinin <aryabinin@virtuozzo.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-arm-kernel@lists.infradead.org,
Souptick Joarder <jrdr.linux@gmail.com>
Subject: Re: [RFC] mm: add pad in sturct page
Date: Tue, 25 Dec 2018 05:59:40 -0800 [thread overview]
Message-ID: <20181225135940.GA20878@bombadil.infradead.org> (raw)
In-Reply-To: <1545703503-20939-1-git-send-email-zhangkehong@hisilicon.com>
On Tue, Dec 25, 2018 at 10:05:03AM +0800, Kehong Zhang wrote:
> When I analysis the performance of using nginx for static websites.
> I found a high cpu workload in the code below:
>
> mm/filemap.c
> @@ 1425,3 @@ struct page *find_get_entry(struct address_space
> *mapping, pgoff_t offset)
> head = compound_head(page);
> if (!page_cache_get_speculative(head))
> goto repeat;
>
> The code will read page->compound_head and atomic add page->_refcount,
> which two variables are in the same cache-line. As multiple core
> read/write two variables in the same cache-line will cause serious
> slowdown,
page->compound is written at allocation. It's not modified during use,
so your analysis is wrong here. What you're seeing is the first attempt
to access this struct page, so it's a cache-miss. If you take away the
access to page->compound, you'll instead see all of the penalty incurred
on the next attempt to access the struct page.
> I test the performance of using nginx for static websites
> in two cases, add patch below and original.
>
> core num\Scenes add pad no pad
> 8core 317654 344414
These numbers aren't particularly useful. How stable are they from run
to run? That is, if you do five runs, what range do they fall in? Also,
is higher better or is lower better? I can't tell if this is requests
per second or latency or something else being measured.
> As we know, struct page is the most used struct and should be as
> small as possible. And I don't have a better way to solve it, if
> anybody have any idea to solve it?
Obviously we're not going to grow struct page from 64 bytes to 256 bytes.
I have briefly investigated an idea to eliminate the reference counting
for page cache accesses that don't need to sleep, but it's a long way
down my todo list.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2018-12-25 13:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-25 2:05 [RFC] mm: add pad in sturct page Kehong Zhang
2018-12-25 13:59 ` Matthew Wilcox [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=20181225135940.GA20878@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@google.com \
--cc=aryabinin@virtuozzo.com \
--cc=catalin.marinas@arm.com \
--cc=jrdr.linux@gmail.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.com \
--cc=mhocko@suse.com \
--cc=riel@surriel.com \
--cc=vbabka@suse.cz \
--cc=will.deacon@arm.com \
--cc=yamada.masahiro@socionext.com \
--cc=zhangkehong@hisilicon.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;
as well as URLs for NNTP newsgroup(s).