From: Andrea Arcangeli <andrea@qumranet.com>
To: Christoph Lameter <clameter@sgi.com>
Cc: linux-mm@kvack.org, apw@shadowen.org,
Hugh Dickins <hugh@veritas.com>,
holt@sgi.com, steiner@sgi.com
Subject: Re: [patch 5/5] Convert anon_vma spinlock to rw semaphore
Date: Thu, 26 Jun 2008 03:05:10 +0200 [thread overview]
Message-ID: <20080626010510.GC6938@duo.random> (raw)
In-Reply-To: <20080626003833.966166360@sgi.com>
On Wed, Jun 25, 2008 at 05:36:37PM -0700, Christoph Lameter wrote:
> However:
> - Atomic overhead increases in situations where a new reference
> to the anon_vma has to be established or removed. Overhead also increases
> when a speculative reference is used (try_to_unmap,
> page_mkclean, page migration).
> - There is the potential for more frequent processor change due to up_xxx
> letting waiting tasks run first.
You dropped the benchmark numbers from the comment, that was useful
data. You may want to re-run the benchmark on different hardware just
to be sure it was valid though (just to be sure it's a significant
regression for AIM).
> void __anon_vma_link(struct vm_area_struct *vma)
> {
> struct anon_vma *anon_vma = vma->anon_vma;
>
> - if (anon_vma)
> + if (anon_vma) {
> + get_anon_vma(anon_vma);
> list_add_tail(&vma->anon_vma_node, &anon_vma->head);
> + }
> }
Last time I checked this code the above get_anon_vma was superfluous.
Below a quote of the email where I already pointed this out once in
the middle of the mmu notifier email flooding, so it's fair enough
that it got lost in the noise ;).
I recommend to optimize this and re-run the benchmark and see if my
optimization makes the -10% slowdown go away in AIM. If it does then
it's surely more reasonable to merge those unconditionally. Unless we
can prove no slowdown in small-smp, I doubt it's ok to merge this one
unconditionally (and I also doubt my optimization will fix AIM as it
only removes a atomic op for each vma in fork, and similar during vma
teardown).
Thanks!
------------
Secondly we don't need to increase the refcount in fork() when we
queue the vma-copy in the anon_vma. You should init the refcount to 1
when the anon_vma is allocated, remove the atomic_inc from all code
(except when down_read_trylock fails) and then change anon_vma_unlink
to:
up_write(&anon_vma->sem);
if (empty)
put_anon_vma(anon_vma);
While the down_read_trylock surely won't help in AIM, the second
change will reduce a bit the overhead in the VM core fast paths by
avoiding all refcounting changes by checking the list_empty the same
way the current code does. I really like how I designed the garbage
collection through list_empty and that's efficient and I'd like to
keep it.
--
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>
next prev parent reply other threads:[~2008-06-26 1:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-26 0:36 [patch 0/5] [RFC] Conversion of reverse map locks to semaphores Christoph Lameter
2008-06-26 0:36 ` [patch 1/5] Move tlb handling into free_pgtables() Christoph Lameter
2008-06-26 0:36 ` [patch 2/5] Move tlb flushing inside of unmap vmas Christoph Lameter
2008-06-26 0:36 ` [patch 3/5] Add capability to check if rwsems are contended Christoph Lameter
2008-06-26 0:36 ` [patch 4/5] Convert i_mmap_lock to a rw semaphore Christoph Lameter
2008-06-26 0:36 ` [patch 5/5] Convert anon_vma spinlock to " Christoph Lameter
2008-06-26 1:05 ` Andrea Arcangeli [this message]
2008-06-26 17:23 ` Christoph Lameter
2008-06-26 17:27 ` Andrea Arcangeli
2008-06-26 0:53 ` [patch 0/5] [RFC] Conversion of reverse map locks to semaphores Andrea Arcangeli
2008-06-26 17:19 ` Christoph Lameter
2008-06-27 8:53 ` Peter Zijlstra
2008-06-27 15:46 ` Christoph Lameter
2008-06-27 16:38 ` Peter Zijlstra
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=20080626010510.GC6938@duo.random \
--to=andrea@qumranet.com \
--cc=apw@shadowen.org \
--cc=clameter@sgi.com \
--cc=holt@sgi.com \
--cc=hugh@veritas.com \
--cc=linux-mm@kvack.org \
--cc=steiner@sgi.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