From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Hugh Dickins <hugh@veritas.com>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: Re: [patch 12/12] mm: rmap opt
Date: Wed, 23 Nov 2005 11:07:48 +1100 [thread overview]
Message-ID: <4383B2D4.8040303@yahoo.com.au> (raw)
In-Reply-To: <Pine.LNX.4.61.0511221853500.28318@goblin.wat.veritas.com>
Hugh Dickins wrote:
> On Mon, 21 Nov 2005, Nick Piggin wrote:
>
>
>>Optimise rmap functions by minimising atomic operations when
>>we know there will be no concurrent modifications.
>
>
> It's not quite right yet. A few minor points first:
>
Thanks for looking at it.
> You ought to convert the page_add_anon_rmap in fs/exec.c to
> page_add_new_anon_rmap: that won't give a huge leap in performance,
> but it will save someone coming along later and wondering why that
> particular one isn't "new_".
>
Yep, you mentioned that before but I must have lost the hunk.
> The mod to page-flags.h at the end: nowhere is __SetPageReferenced
> used, just cut the page-flags.h change out of your patch.
>
> Perhaps that was at one time a half-way house to removing the
> SetPageReferenced from do_anonymous_page: I support you in that
> removal (I've several times argued that if it's needed there, then
> it's also needed in several other like places which lack it; and I
> think you concluded that it's just not needed); but you ought at least
> to confess to that in the change comments, if it's not a separate patch.
>
You're right. I'll split that and fix the page-flags.h.
> I've spent longest staring at page_remove_rmap. Here's how it looks:
>
> void page_remove_rmap(struct page *page)
> {
> int fast = (page_mapcount(page) == 1) &
> PageAnon(page) & (!PageSwapCache(page));
>
> /* fast page may become SwapCache here, but nothing new will map it. */
> if (fast)
> reset_page_mapcount(page);
> else if (atomic_add_negative(-1, &page->_mapcount))
> BUG_ON(page_mapcount(page) < 0);
> if (page_test_and_clear_dirty(page))
> set_page_dirty(page);
> else
> return; /* non zero mapcount */
> /* [comment snipped for these purposes] */
> __dec_page_state(nr_mapped);
> }
>
> Well, C doesn't yet allow indentation to take the place of braces:
> I think you'll find your /proc/meminfo Mapped goes up and up, since
> only on s390 will page_test_and_clear_dirty ever say yes.
>
Thanks. It is fairly obscure, and possibly has memory ordering problems.
Also the conditional jumps and icache usage are increased, so it isn't
as clear a win as the add_new_anon_rmap's. I'll drop this part for the
moment.
Nick
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
next prev parent reply other threads:[~2005-11-22 23:05 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-21 11:37 [patch 0/12] mm: optimisations Nick Piggin
2005-11-21 11:41 ` [patch 11/12] mm: page_alloc cleanups Nick Piggin
2005-11-21 12:00 ` [patch 7/12] mm: bad_page opt Nick Piggin
2005-11-21 12:00 ` [patch 8/12] mm: remove pcp low Nick Piggin
2005-11-21 12:07 ` [patch 9/12] mm: page_state opt Nick Piggin
2005-11-22 7:54 ` Andrew Morton
2005-11-22 9:04 ` Nick Piggin
2005-11-22 8:08 ` Andrew Morton
2005-11-21 12:08 ` [patch 12/12] mm: rmap opt Nick Piggin
2005-11-22 19:19 ` Hugh Dickins
2005-11-23 0:07 ` Nick Piggin [this message]
2005-11-21 13:07 ` [patch 2/12] mm: pagealloc opt Nick Piggin
2005-11-21 13:08 ` [patch 4/12] mm: set_page_refs opt Nick Piggin
2005-11-21 13:23 ` [patch 1/12] mm: free_pages_and_swap_cache opt Nick Piggin
2005-11-21 13:25 ` [patch 5/12] mm: microopt conditions Nick Piggin
2005-11-21 13:27 ` [patch 10/12] mm: page_state fixes Nick Piggin
2005-11-21 14:29 ` [patch 0/12] mm: optimisations Paul Jackson
2005-11-22 0:26 ` Nick Piggin
2005-11-21 15:10 ` [patch 3/12] mm: release opt Nick Piggin
2005-11-21 15:12 ` [patch 6/12] mm: remove bad_range Nick Piggin
2005-11-22 12:32 ` Dave Hansen
2005-11-23 2:09 ` Nick Piggin
2005-11-23 2:09 ` Nick Piggin
2005-11-22 8:06 ` [patch 0/12] mm: optimisations Andrew Morton
2005-11-22 10:51 ` Nick Piggin
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=4383B2D4.8040303@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.