[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210313163949.GI2577561@casper.infradead.org>
Date: Sat, 13 Mar 2021 16:39:49 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Mel Gorman <mgorman@...hsingularity.net>
Cc: Jesper Dangaard Brouer <brouer@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Chuck Lever <chuck.lever@...cle.com>,
Christoph Hellwig <hch@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
Linux-Net <netdev@...r.kernel.org>,
Linux-MM <linux-mm@...ck.org>,
Linux-NFS <linux-nfs@...r.kernel.org>
Subject: Re: [PATCH 2/5] mm/page_alloc: Add a bulk page allocator
On Sat, Mar 13, 2021 at 01:16:48PM +0000, Mel Gorman wrote:
> > I'm not claiming the pagevec is definitely a win, but it's very
> > unclear which tradeoff is actually going to lead to better performance.
> > Hopefully Jesper or Chuck can do some tests and figure out what actually
> > works better with their hardware & usage patterns.
>
> The NFS user is often going to need to make round trips to get the pages it
> needs. The pagevec would have to be copied into the target array meaning
> it's not much better than a list manipulation.
I don't think you fully realise how bad CPUs are at list manipulation.
See the attached program (and run it on your own hardware). On my
less-than-a-year-old core-i7:
$ gcc -W -Wall -O2 -g array-vs-list.c -o array-vs-list
$ ./array-vs-list
walked sequential array in 0.001765s
walked sequential list in 0.002920s
walked sequential array in 0.001777s
walked shuffled list in 0.081955s
walked shuffled array in 0.007367s
If you happen to get the objects in-order, it's only 64% worse to walk
a list as an array. If they're out of order, it's *11.1* times as bad.
View attachment "array-vs-list.c" of type "text/plain" (3931 bytes)
Powered by blists - more mailing lists