Re: [PATCH] mm: MADV_WILLNEED implementation for anonymous memory

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Peter Zijlstra <a.p.zijlstra@...>
Cc: Andrew Morton <akpm@...>, Hugh Dickins <hugh@...>, linux-kernel <linux-kernel@...>, linux-mm <linux-mm@...>, Nick Piggin <npiggin@...>, riel <riel@...>, Lennart Poettering <mztabzr@...>
Date: Wednesday, January 30, 2008 - 2:15 pm

On Wed, 2008-01-30 at 18:28 +0100, Peter Zijlstra wrote:

That's a pretty reasonable approach. My original approach was to buffer
a page worth of PTEs with all the attendant malloc annoyances. Then
Andrew and I came up with another fix a bit ago by effectively doing a
batch of size 1: mapping and immediately unmapping per PTE. That's
basically a no-op on !HIGHPTE but could potentially be expensive in the
HIGHPTE case. Your approach might be a good complexity/performance
middle ground.

Unfortunately, I think we only implemented our fix in one of the
relevant places: the /proc/pid/pagemap code hooks a callback at the pte
table level and then does its own walk across the table. Perhaps I
should refactor this so that it hooks in at the pte entry level of the
walker instead.


Looks like this could be:

		for (i = 0; i < WALK_BATCH_SIZE && addr + i * PAGE_SIZE != end; i++)
			ptes[i] = pte[i];

		for (i = 0; i < WALK_BATCH_SIZE && addr != end;
			i++, addr+= PAGE_SIZE) {
			err = walk->pte_entry(ptes[i], addr, addr + PAGE_SIZE,
				private);

And we can ditch start.

Also, one wonders if setting batch size to 1 will then convince the
compiler to collapse this into a more trivial loop in the !HIGHPTE case.

-- 
Mathematics is the supreme nostalgia of our time.

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] mm: MADV_WILLNEED implementation for anonymous m..., Matt Mackall, (Wed Jan 30, 2:15 pm)