From: Michal Hocko <mhocko@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org
Subject: Re: [PATCH] Get 7% more pages in a pagevec
Date: Wed, 6 Dec 2017 15:23:29 +0100 [thread overview]
Message-ID: <20171206142329.GF7515@dhcp22.suse.cz> (raw)
In-Reply-To: <20171206141535.GC32044@bombadil.infradead.org>
On Wed 06-12-17 06:15:35, Matthew Wilcox wrote:
> On Wed, Dec 06, 2017 at 01:38:42PM +0100, Michal Hocko wrote:
> > On Tue 05-12-17 18:25:21, Matthew Wilcox wrote:
> > > -/* 14 pointers + two long's align the pagevec structure to a power of two */
> > > -#define PAGEVEC_SIZE 14
> > > +/* 15 pointers + header align the pagevec structure to a power of two */
> > > +#define PAGEVEC_SIZE 15
> >
> > And now you have ruined the ultimate constant of the whole MM :p
> > But seriously, I have completely missed that pagevec has such a bad
> > layout.
>
> It's fun to go back into the historical tree and see why.
>
> First it was two 'int's and an array of 16 pointers. Marcelo noticed that
> was three cachelines instead of two, so he shrank it to two shorts and
> an array of 15 pointers:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/include/linux/pagevec.h?id=afead7df5a05118052a238c54285e7119da65831
>
> But then he found out that Pentium 2 and Pentium Pro sucked at 16-bit loads,
> so he changed it to two longs and an array of 14 pointers:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/include/linux/pagevec.h?id=6140f8a54db42320b1d05ce2680b5619210b88ad
Yeah, i've done that exercise several times because 14 is just
_strange_. I always had that feeling that we were trying to be too
clever for minor things while larger ones just got unnotices...
> I wonder what would have happened if he had benchmarked it with 'char'
> instead of 'short'. I think I have a Pentium 2 in the basement somewhere;
> perhaps I'll drag it out and fire it up.
>
> > Acked-by: Michal Hocko <mhocko@suse.com>
>
> Thanks!
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2017-12-06 14:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-06 2:25 Matthew Wilcox
2017-12-06 12:38 ` Michal Hocko
2017-12-06 14:15 ` Matthew Wilcox
2017-12-06 14:23 ` Michal Hocko [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=20171206142329.GF7515@dhcp22.suse.cz \
--to=mhocko@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